Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet/udp_usrreq.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/netinet/udp_usrreq.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.103.2.5 retrieving revision 1.121 diff -u -p -r1.103.2.5 -r1.121 --- src/sys/netinet/udp_usrreq.c 2004/12/18 09:33:06 1.103.2.5 +++ src/sys/netinet/udp_usrreq.c 2004/05/07 00:55:15 1.121 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.103.2.5 2004/12/18 09:33:06 skrll Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.121 2004/05/07 00:55:15 jonathan Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.103.2.5 2004/12/18 09:33:06 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.121 2004/05/07 00:55:15 jonathan Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -141,7 +141,6 @@ int udpcksum = 1; #else int udpcksum = 0; /* XXX */ #endif -int udp_do_loopback_cksum = 1; struct inpcbtable udbtable; struct udpstat udpstat; @@ -288,17 +287,10 @@ udp_input(struct mbuf *m, ...) break; default: - /* - * Need to compute it ourselves. Maybe skip checksum - * on loopback interfaces. - */ - if (__predict_true(!(m->m_pkthdr.rcvif->if_flags & - IFF_LOOPBACK) || - udp_do_loopback_cksum)) { - UDP_CSUM_COUNTER_INCR(&udp_swcsum); - if (in4_cksum(m, IPPROTO_UDP, iphlen, len) != 0) - goto badcsum; - } + /* Need to compute it ourselves. */ + UDP_CSUM_COUNTER_INCR(&udp_swcsum); + if (in4_cksum(m, IPPROTO_UDP, iphlen, len) != 0) + goto badcsum; break; } } @@ -427,20 +419,15 @@ udp6_input(struct mbuf **mp, int *offp, } /* - * Checksum extended UDP header and data. Maybe skip checksum - * on loopback interfaces. + * Checksum extended UDP header and data. */ - if (__predict_true(!(m->m_pkthdr.rcvif->if_flags & - IFF_LOOPBACK) || - udp_do_loopback_cksum)) { - if (uh->uh_sum == 0) { - udp6stat.udp6s_nosum++; - goto bad; - } - if (in6_cksum(m, IPPROTO_UDP, off, ulen) != 0) { - udp6stat.udp6s_badsum++; - goto bad; - } + if (uh->uh_sum == 0) { + udp6stat.udp6s_nosum++; + goto bad; + } + if (in6_cksum(m, IPPROTO_UDP, off, ulen) != 0) { + udp6stat.udp6s_badsum++; + goto bad; } /* @@ -524,7 +511,6 @@ udp4_sendup(struct mbuf *m, int off /* o m_freem(n); if (opts) m_freem(opts); - so->so_rcv.sb_overflowed++; udpstat.udps_fullsock++; } else sorwakeup(so); @@ -570,7 +556,6 @@ udp6_sendup(struct mbuf *m, int off /* o m_freem(n); if (opts) m_freem(opts); - so->so_rcv.sb_overflowed++; udp6stat.udp6s_fullsock++; } else sorwakeup(so); @@ -843,7 +828,6 @@ udp_output(struct mbuf *m, ...) { struct inpcb *inp; struct udpiphdr *ui; - struct route *ro; int len = m->m_pkthdr.len; int error = 0; va_list ap; @@ -884,8 +868,6 @@ udp_output(struct mbuf *m, ...) ui->ui_dport = inp->inp_fport; ui->ui_ulen = htons((u_int16_t)len + sizeof(struct udphdr)); - ro = &inp->inp_route; - /* * Set up checksum and output datagram. */ @@ -893,18 +875,11 @@ udp_output(struct mbuf *m, ...) /* * XXX Cache pseudo-header checksum part for * XXX "connected" UDP sockets. - * Maybe skip checksums on loopback interfaces. */ ui->ui_sum = in_cksum_phdr(ui->ui_src.s_addr, ui->ui_dst.s_addr, htons((u_int16_t)len + sizeof(struct udphdr) + IPPROTO_UDP)); - if (__predict_true(ro->ro_rt == NULL || - !(ro->ro_rt->rt_ifp->if_flags & - IFF_LOOPBACK) || - udp_do_loopback_cksum)) - m->m_pkthdr.csum_flags = M_CSUM_UDPv4; - else - m->m_pkthdr.csum_flags = 0; + m->m_pkthdr.csum_flags = M_CSUM_UDPv4; m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); } else ui->ui_sum = 0; @@ -913,7 +888,7 @@ udp_output(struct mbuf *m, ...) ((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos; /* XXX */ udpstat.udps_opackets++; - return (ip_output(m, inp->inp_options, ro, + return (ip_output(m, inp->inp_options, &inp->inp_route, inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST), inp->inp_moptions, inp->inp_socket)); @@ -929,14 +904,12 @@ int udp_recvspace = 40 * (1024 + sizeof( /*ARGSUSED*/ int udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, - struct mbuf *control, struct lwp *l) + struct mbuf *control, struct proc *p) { struct inpcb *inp; - struct proc *p; int s; int error = 0; - p = l ? l->l_proc : NULL; if (req == PRU_CONTROL) return (in_control(so, (long)m, (caddr_t)nam, (struct ifnet *)control, p)); @@ -1116,38 +1089,27 @@ SYSCTL_SETUP(sysctl_net_inet_udp_setup, CTL_NET, PF_INET, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT, - CTLTYPE_NODE, "udp", - SYSCTL_DESCR("UDPv4 related settings"), + CTLTYPE_NODE, "udp", NULL, NULL, 0, NULL, 0, CTL_NET, PF_INET, IPPROTO_UDP, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, - CTLTYPE_INT, "checksum", - SYSCTL_DESCR("Compute UDP checksums"), + CTLTYPE_INT, "checksum", NULL, NULL, 0, &udpcksum, 0, CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_CHECKSUM, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, - CTLTYPE_INT, "sendspace", - SYSCTL_DESCR("Default UDP send buffer size"), + CTLTYPE_INT, "sendspace", NULL, NULL, 0, &udp_sendspace, 0, CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_SENDSPACE, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, - CTLTYPE_INT, "recvspace", - SYSCTL_DESCR("Default UDP receive buffer size"), + CTLTYPE_INT, "recvspace", NULL, NULL, 0, &udp_recvspace, 0, CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_RECVSPACE, CTL_EOL); - sysctl_createv(clog, 0, NULL, NULL, - CTLFLAG_PERMANENT|CTLFLAG_READWRITE, - CTLTYPE_INT, "do_loopback_cksum", - SYSCTL_DESCR("Perform UDP checksum on loopback"), - NULL, 0, &udp_do_loopback_cksum, 0, - CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_LOOPBACKCKSUM, - CTL_EOL); } #endif