Deleted Added
full compact
udp_usrreq.c (122875) udp_usrreq.c (122922)
1/*
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
1/*
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
34 * $FreeBSD: head/sys/netinet/udp_usrreq.c 122875 2003-11-18 00:39:07Z rwatson $
34 * $FreeBSD: head/sys/netinet/udp_usrreq.c 122922 2003-11-20 20:07:39Z andre $
35 */
36
37#include "opt_ipsec.h"
38#include "opt_inet6.h"
39#include "opt_mac.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>

--- 496 unchanged lines hidden (view full) ---

539 struct in_addr faddr;
540 struct inpcb *inp;
541 int s;
542
543 faddr = ((struct sockaddr_in *)sa)->sin_addr;
544 if (sa->sa_family != AF_INET || faddr.s_addr == INADDR_ANY)
545 return;
546
35 */
36
37#include "opt_ipsec.h"
38#include "opt_inet6.h"
39#include "opt_mac.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>

--- 496 unchanged lines hidden (view full) ---

539 struct in_addr faddr;
540 struct inpcb *inp;
541 int s;
542
543 faddr = ((struct sockaddr_in *)sa)->sin_addr;
544 if (sa->sa_family != AF_INET || faddr.s_addr == INADDR_ANY)
545 return;
546
547 if (PRC_IS_REDIRECT(cmd)) {
547 /*
548 * Redirects don't need to be handled up here.
549 */
550 if (PRC_IS_REDIRECT(cmd))
551 return;
552 /*
553 * Hostdead is ugly because it goes linearly through all PCBs.
554 * XXX: We never get this from ICMP, otherwise it makes an
555 * excellent DoS attack on machines with many connections.
556 */
557 if (cmd == PRC_HOSTDEAD)
548 ip = 0;
558 ip = 0;
549 notify = in_rtchange;
550 } else if (cmd == PRC_HOSTDEAD)
551 ip = 0;
552 else if ((unsigned)cmd >= PRC_NCMDS || inetctlerrmap[cmd] == 0)
553 return;
554 if (ip) {
555 s = splnet();
556 uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2));
557 INP_INFO_RLOCK(&udbinfo);
558 inp = in_pcblookup_hash(&udbinfo, faddr, uh->uh_dport,
559 ip->ip_src, uh->uh_sport, 0, NULL);

--- 308 unchanged lines hidden (view full) ---

868 } else {
869 ui->ui_sum = 0;
870 }
871 ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len;
872 ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */
873 ((struct ip *)ui)->ip_tos = inp->inp_ip_tos; /* XXX */
874 udpstat.udps_opackets++;
875
559 else if ((unsigned)cmd >= PRC_NCMDS || inetctlerrmap[cmd] == 0)
560 return;
561 if (ip) {
562 s = splnet();
563 uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2));
564 INP_INFO_RLOCK(&udbinfo);
565 inp = in_pcblookup_hash(&udbinfo, faddr, uh->uh_dport,
566 ip->ip_src, uh->uh_sport, 0, NULL);

--- 308 unchanged lines hidden (view full) ---

875 } else {
876 ui->ui_sum = 0;
877 }
878 ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len;
879 ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */
880 ((struct ip *)ui)->ip_tos = inp->inp_ip_tos; /* XXX */
881 udpstat.udps_opackets++;
882
876 error = ip_output(m, inp->inp_options, &inp->inp_route, ipflags,
883 error = ip_output(m, inp->inp_options, NULL, ipflags,
877 inp->inp_moptions, inp);
878 return (error);
879
880release:
881 m_freem(m);
882 return (error);
883}
884

--- 239 unchanged lines hidden ---
884 inp->inp_moptions, inp);
885 return (error);
886
887release:
888 m_freem(m);
889 return (error);
890}
891

--- 239 unchanged lines hidden ---