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.158 retrieving revision 1.160.8.2 diff -u -p -r1.158 -r1.160.8.2 --- src/sys/netinet/udp_usrreq.c 2007/03/04 06:03:22 1.158 +++ src/sys/netinet/udp_usrreq.c 2008/01/09 01:57:31 1.160.8.2 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.158 2007/03/04 06:03:22 christos Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.160.8.2 2008/01/09 01:57:31 matt Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.158 2007/03/04 06:03:22 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.160.8.2 2008/01/09 01:57:31 matt Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -384,16 +384,8 @@ udp_input(struct mbuf *m, ...) goto badcsum; /* construct source and dst sockaddrs. */ - bzero(&src, sizeof(src)); - src.sin_family = AF_INET; - src.sin_len = sizeof(struct sockaddr_in); - bcopy(&ip->ip_src, &src.sin_addr, sizeof(src.sin_addr)); - src.sin_port = uh->uh_sport; - bzero(&dst, sizeof(dst)); - dst.sin_family = AF_INET; - dst.sin_len = sizeof(struct sockaddr_in); - bcopy(&ip->ip_dst, &dst.sin_addr, sizeof(dst.sin_addr)); - dst.sin_port = uh->uh_dport; + sockaddr_in_init(&src, &ip->ip_src, uh->uh_sport); + sockaddr_in_init(&dst, &ip->ip_dst, uh->uh_dport); if ((n = udp4_realinput(&src, &dst, &m, iphlen)) == -1) { udpstat.udps_hdrops++; @@ -625,14 +617,14 @@ udp4_sendup(struct mbuf *m, int off /* o /* check AH/ESP integrity. */ if (so != NULL && ipsec4_in_reject_so(m, so)) { ipsecstat.in_polvio++; - if ((n = m_copy(m, 0, M_COPYALL)) != NULL) + if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) icmp_error(n, ICMP_UNREACH, ICMP_UNREACH_ADMIN_PROHIBIT, 0, 0); return; } #endif /*IPSEC*/ - if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { + if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) { if (inp && (inp->inp_flags & INP_CONTROLOPTS || so->so_options & SO_TIMESTAMP)) { struct ip *ip = mtod(n, struct ip *); @@ -672,14 +664,14 @@ udp6_sendup(struct mbuf *m, int off /* o /* check AH/ESP integrity. */ if (so != NULL && ipsec6_in_reject_so(m, so)) { ipsec6stat.in_polvio++; - if ((n = m_copy(m, 0, M_COPYALL)) != NULL) + if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) icmp6_error(n, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADMIN, 0); return; } #endif /*IPSEC*/ - if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { + if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) { if (in6p && (in6p->in6p_flags & IN6P_CONTROLOPTS || in6p->in6p_socket->so_options & SO_TIMESTAMP)) { struct ip6_hdr *ip6 = mtod(n, struct ip6_hdr *); @@ -1037,7 +1029,7 @@ udp_ctloutput(int op, struct socket *so, switch (optname) { case UDP_ENCAP: - if (m == NULL || m->m_len < sizeof (int)) { + if (m == NULL || m->m_len != sizeof(int)) { error = EINVAL; break; } @@ -1536,7 +1528,7 @@ udp4_espinudp(struct mbuf **mp, int off, m_tag_prepend(n, tag); #ifdef FAST_IPSEC - ipsec4_common_input(n, iphdrlen); + ipsec4_common_input(n, iphdrlen, IPPROTO_ESP); #else esp4_input(n, iphdrlen); #endif