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.171.2.1 retrieving revision 1.173.2.1 diff -u -p -r1.171.2.1 -r1.173.2.1 --- src/sys/netinet/udp_usrreq.c 2008/05/16 02:25:42 1.171.2.1 +++ src/sys/netinet/udp_usrreq.c 2009/01/19 13:20:13 1.173.2.1 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.171.2.1 2008/05/16 02:25:42 yamt Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.173.2.1 2009/01/19 13:20:13 skrll Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,9 +61,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.171.2.1 2008/05/16 02:25:42 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.173.2.1 2009/01/19 13:20:13 skrll Exp $"); #include "opt_inet.h" +#include "opt_compat_netbsd.h" #include "opt_ipsec.h" #include "opt_inet_csum.h" #include "opt_ipkdb.h" @@ -136,6 +137,10 @@ __KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c #include #endif /* IPSEC */ +#ifdef COMPAT_50 +#include +#endif + #ifdef IPKDB #include #endif @@ -639,6 +644,9 @@ udp4_sendup(struct mbuf *m, int off /* o if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) { if (inp && (inp->inp_flags & INP_CONTROLOPTS +#ifdef SO_OTIMESTAMP + || so->so_options & SO_OTIMESTAMP +#endif || so->so_options & SO_TIMESTAMP)) { struct ip *ip = mtod(n, struct ip *); ip_savecontrol(inp, &opts, ip, n); @@ -686,7 +694,10 @@ udp6_sendup(struct mbuf *m, int off /* o if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) { if (in6p && (in6p->in6p_flags & IN6P_CONTROLOPTS - || in6p->in6p_socket->so_options & SO_TIMESTAMP)) { +#ifdef SO_OTIMESTAMP + || in6p->in6p_socket->so_options & SO_OTIMESTAMP +#endif + || in6p->in6p_socket->so_options & SO_TIMESTAMP)) { struct ip6_hdr *ip6 = mtod(n, struct ip6_hdr *); ip6_savecontrol(in6p, &opts, ip6, n); } @@ -1000,14 +1011,13 @@ udp_ctlinput(int cmd, const struct socka } int -udp_ctloutput(int op, struct socket *so, int level, int optname, - struct mbuf **mp) +udp_ctloutput(int op, struct socket *so, struct sockopt *sopt) { int s; int error = 0; - struct mbuf *m; struct inpcb *inp; int family; + int optval; family = so->so_proto->pr_domain->dom_family; @@ -1015,16 +1025,16 @@ udp_ctloutput(int op, struct socket *so, switch (family) { #ifdef INET case PF_INET: - if (level != IPPROTO_UDP) { - error = ip_ctloutput(op, so, level, optname, mp); + if (sopt->sopt_level != IPPROTO_UDP) { + error = ip_ctloutput(op, so, sopt); goto end; } break; #endif #ifdef INET6 case PF_INET6: - if (level != IPPROTO_UDP) { - error = ip6_ctloutput(op, so, level, optname, mp); + if (sopt->sopt_level != IPPROTO_UDP) { + error = ip6_ctloutput(op, so, sopt); goto end; } break; @@ -1037,17 +1047,15 @@ udp_ctloutput(int op, struct socket *so, switch (op) { case PRCO_SETOPT: - m = *mp; inp = sotoinpcb(so); - switch (optname) { + switch (sopt->sopt_name) { case UDP_ENCAP: - if (m == NULL || m->m_len != sizeof(int)) { - error = EINVAL; + error = sockopt_getint(sopt, &optval); + if (error) break; - } - switch(*mtod(m, int *)) { + switch(optval) { #ifdef IPSEC_NAT_T case 0: inp->inp_flags &= ~INP_ESPINUDP_ALL; @@ -1073,9 +1081,6 @@ udp_ctloutput(int op, struct socket *so, error = ENOPROTOOPT; break; } - if (m != NULL) { - m_free(m); - } break; default: