Sat Sep 24 17:22:14 2011 UTC ()
Add inet6 part of the rfc6056 code contributed by Vlad Balan as part of
Google SoC-2011


(christos)
diff -r1.115 -r1.116 src/sys/netinet6/in6_pcb.c
diff -r1.35 -r1.36 src/sys/netinet6/in6_pcb.h
diff -r1.92 -r1.93 src/sys/netinet6/in6_proto.c
diff -r1.51 -r1.52 src/sys/netinet6/in6_src.c
diff -r1.42 -r1.43 src/sys/netinet6/udp6_output.c
diff -r1.89 -r1.90 src/sys/netinet6/udp6_usrreq.c
diff -r1.23 -r1.24 src/sys/netinet6/udp6_var.h

cvs diff -r1.115 -r1.116 src/sys/netinet6/in6_pcb.c (expand / switch to unified diff)

--- src/sys/netinet6/in6_pcb.c 2011/08/31 18:31:03 1.115
+++ src/sys/netinet6/in6_pcb.c 2011/09/24 17:22:14 1.116
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in6_pcb.c,v 1.115 2011/08/31 18:31:03 plunky Exp $ */ 1/* $NetBSD: in6_pcb.c,v 1.116 2011/09/24 17:22:14 christos Exp $ */
2/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */ 2/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -52,27 +52,27 @@ @@ -52,27 +52,27 @@
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE. 59 * SUCH DAMAGE.
60 * 60 *
61 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 61 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.115 2011/08/31 18:31:03 plunky Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.116 2011/09/24 17:22:14 christos Exp $");
66 66
67#include "opt_inet.h" 67#include "opt_inet.h"
68#include "opt_ipsec.h" 68#include "opt_ipsec.h"
69 69
70#include <sys/param.h> 70#include <sys/param.h>
71#include <sys/systm.h> 71#include <sys/systm.h>
72#include <sys/malloc.h> 72#include <sys/malloc.h>
73#include <sys/mbuf.h> 73#include <sys/mbuf.h>
74#include <sys/protosw.h> 74#include <sys/protosw.h>
75#include <sys/socket.h> 75#include <sys/socket.h>
76#include <sys/socketvar.h> 76#include <sys/socketvar.h>
77#include <sys/ioctl.h> 77#include <sys/ioctl.h>
78#include <sys/errno.h> 78#include <sys/errno.h>
@@ -81,26 +81,27 @@ __KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v  @@ -81,26 +81,27 @@ __KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v
81#include <sys/kauth.h> 81#include <sys/kauth.h>
82#include <sys/domain.h> 82#include <sys/domain.h>
83#include <sys/once.h> 83#include <sys/once.h>
84 84
85#include <net/if.h> 85#include <net/if.h>
86#include <net/route.h> 86#include <net/route.h>
87 87
88#include <netinet/in.h> 88#include <netinet/in.h>
89#include <netinet/in_var.h> 89#include <netinet/in_var.h>
90#include <netinet/in_systm.h> 90#include <netinet/in_systm.h>
91#include <netinet/ip.h> 91#include <netinet/ip.h>
92#include <netinet/in_pcb.h> 92#include <netinet/in_pcb.h>
93#include <netinet/ip6.h> 93#include <netinet/ip6.h>
 94#include <netinet/rfc6056.h>
94#include <netinet6/ip6_var.h> 95#include <netinet6/ip6_var.h>
95#include <netinet6/in6_pcb.h> 96#include <netinet6/in6_pcb.h>
96#include <netinet6/scope6_var.h> 97#include <netinet6/scope6_var.h>
97#include <netinet6/nd6.h> 98#include <netinet6/nd6.h>
98 99
99#include "faith.h" 100#include "faith.h"
100 101
101#ifdef IPSEC 102#ifdef IPSEC
102#include <netinet6/ipsec.h> 103#include <netinet6/ipsec.h>
103#include <netkey/key.h> 104#include <netkey/key.h>
104#endif /* IPSEC */ 105#endif /* IPSEC */
105 106
106#ifdef FAST_IPSEC 107#ifdef FAST_IPSEC
@@ -166,26 +167,28 @@ in6_pcballoc(struct socket *so, void *v) @@ -166,26 +167,28 @@ in6_pcballoc(struct socket *so, void *v)
166#endif 167#endif
167 168
168 s = splnet(); 169 s = splnet();
169 in6p = pool_get(&in6pcb_pool, PR_NOWAIT); 170 in6p = pool_get(&in6pcb_pool, PR_NOWAIT);
170 splx(s); 171 splx(s);
171 if (in6p == NULL) 172 if (in6p == NULL)
172 return (ENOBUFS); 173 return (ENOBUFS);
173 memset((void *)in6p, 0, sizeof(*in6p)); 174 memset((void *)in6p, 0, sizeof(*in6p));
174 in6p->in6p_af = AF_INET6; 175 in6p->in6p_af = AF_INET6;
175 in6p->in6p_table = table; 176 in6p->in6p_table = table;
176 in6p->in6p_socket = so; 177 in6p->in6p_socket = so;
177 in6p->in6p_hops = -1; /* use kernel default */ 178 in6p->in6p_hops = -1; /* use kernel default */
178 in6p->in6p_icmp6filt = NULL; 179 in6p->in6p_icmp6filt = NULL;
 180 in6p->in6p_rfc6056algo = RFC6056_ALGO_DEFAULT;
 181 in6p->in6p_bindportonsend = false;
179#if defined(IPSEC) || defined(FAST_IPSEC) 182#if defined(IPSEC) || defined(FAST_IPSEC)
180 error = ipsec_init_pcbpolicy(so, &in6p->in6p_sp); 183 error = ipsec_init_pcbpolicy(so, &in6p->in6p_sp);
181 if (error != 0) { 184 if (error != 0) {
182 s = splnet(); 185 s = splnet();
183 pool_put(&in6pcb_pool, in6p); 186 pool_put(&in6pcb_pool, in6p);
184 splx(s); 187 splx(s);
185 return error; 188 return error;
186 } 189 }
187#endif /* IPSEC */ 190#endif /* IPSEC */
188 s = splnet(); 191 s = splnet();
189 CIRCLEQ_INSERT_HEAD(&table->inpt_queue, (struct inpcb_hdr*)in6p, 192 CIRCLEQ_INSERT_HEAD(&table->inpt_queue, (struct inpcb_hdr*)in6p,
190 inph_queue); 193 inph_queue);
191 LIST_INSERT_HEAD(IN6PCBHASH_PORT(table, in6p->in6p_lport), 194 LIST_INSERT_HEAD(IN6PCBHASH_PORT(table, in6p->in6p_lport),
@@ -537,26 +540,38 @@ in6_pcbconnect(void *v, struct mbuf *nam @@ -537,26 +540,38 @@ in6_pcbconnect(void *v, struct mbuf *nam
537 if (IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) || 540 if (IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) ||
538 (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_laddr) && 541 (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_laddr) &&
539 in6p->in6p_laddr.s6_addr32[3] == 0)) 542 in6p->in6p_laddr.s6_addr32[3] == 0))
540 { 543 {
541 if (in6p->in6p_lport == 0) { 544 if (in6p->in6p_lport == 0) {
542 error = in6_pcbbind(in6p, (struct mbuf *)0, l); 545 error = in6_pcbbind(in6p, (struct mbuf *)0, l);
543 if (error != 0) 546 if (error != 0)
544 return error; 547 return error;
545 } 548 }
546 in6p->in6p_laddr = *in6a; 549 in6p->in6p_laddr = *in6a;
547 } 550 }
548 in6p->in6p_faddr = sin6->sin6_addr; 551 in6p->in6p_faddr = sin6->sin6_addr;
549 in6p->in6p_fport = sin6->sin6_port; 552 in6p->in6p_fport = sin6->sin6_port;
 553
 554 /* Late bind, if needed */
 555 if (in6p->in6p_bindportonsend) {
 556 struct sockaddr_in6 lsin = *((const struct sockaddr_in6 *)
 557 in6p->in6p_socket->so_proto->pr_domain->dom_sa_any);
 558 lsin.sin6_addr = in6p->in6p_laddr;
 559 lsin.sin6_port = 0;
 560
 561 if ((error = in6_pcbbind_port(in6p, &lsin, l)) != 0)
 562 return error;
 563 }
 564
550 in6_pcbstate(in6p, IN6P_CONNECTED); 565 in6_pcbstate(in6p, IN6P_CONNECTED);
551 in6p->in6p_flowinfo &= ~IPV6_FLOWLABEL_MASK; 566 in6p->in6p_flowinfo &= ~IPV6_FLOWLABEL_MASK;
552 if (ip6_auto_flowlabel) 567 if (ip6_auto_flowlabel)
553 in6p->in6p_flowinfo |= 568 in6p->in6p_flowinfo |=
554 (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK); 569 (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK);
555#if defined(IPSEC) || defined(FAST_IPSEC) 570#if defined(IPSEC) || defined(FAST_IPSEC)
556 if (in6p->in6p_socket->so_type == SOCK_STREAM) 571 if (in6p->in6p_socket->so_type == SOCK_STREAM)
557 ipsec_pcbconn(in6p->in6p_sp); 572 ipsec_pcbconn(in6p->in6p_sp);
558#endif 573#endif
559 return (0); 574 return (0);
560} 575}
561 576
562void 577void

cvs diff -r1.35 -r1.36 src/sys/netinet6/in6_pcb.h (expand / switch to unified diff)

--- src/sys/netinet6/in6_pcb.h 2011/05/03 18:28:45 1.35
+++ src/sys/netinet6/in6_pcb.h 2011/09/24 17:22:14 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in6_pcb.h,v 1.35 2011/05/03 18:28:45 dyoung Exp $ */ 1/* $NetBSD: in6_pcb.h,v 1.36 2011/09/24 17:22:14 christos Exp $ */
2/* $KAME: in6_pcb.h,v 1.45 2001/02/09 05:59:46 itojun Exp $ */ 2/* $KAME: in6_pcb.h,v 1.45 2001/02/09 05:59:46 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -68,46 +68,48 @@ @@ -68,46 +68,48 @@
68#include <netinet/in_pcb_hdr.h> 68#include <netinet/in_pcb_hdr.h>
69 69
70/* 70/*
71 * Common structure pcb for internet protocol implementation. 71 * Common structure pcb for internet protocol implementation.
72 * Here are stored pointers to local and foreign host table 72 * Here are stored pointers to local and foreign host table
73 * entries, local and foreign socket numbers, and pointers 73 * entries, local and foreign socket numbers, and pointers
74 * up (to a socket structure) and down (to a protocol-specific) 74 * up (to a socket structure) and down (to a protocol-specific)
75 * control block. 75 * control block.
76 */ 76 */
77struct icmp6_filter; 77struct icmp6_filter;
78 78
79struct in6pcb { 79struct in6pcb {
80 struct inpcb_hdr in6p_head; 80 struct inpcb_hdr in6p_head;
81#define in6p_hash in6p_head.inph_hash 81#define in6p_hash in6p_head.inph_hash
82#define in6p_queue in6p_head.inph_queue 82#define in6p_queue in6p_head.inph_queue
83#define in6p_af in6p_head.inph_af 83#define in6p_af in6p_head.inph_af
84#define in6p_ppcb in6p_head.inph_ppcb 84#define in6p_ppcb in6p_head.inph_ppcb
85#define in6p_state in6p_head.inph_state 85#define in6p_state in6p_head.inph_state
86#define in6p_socket in6p_head.inph_socket 86#define in6p_rfc6056algo in6p_head.inph_rfc6056algo
87#define in6p_table in6p_head.inph_table 87#define in6p_socket in6p_head.inph_socket
88#define in6p_sp in6p_head.inph_sp 88#define in6p_table in6p_head.inph_table
 89#define in6p_sp in6p_head.inph_sp
89 struct route in6p_route; /* placeholder for routing entry */ 90 struct route in6p_route; /* placeholder for routing entry */
90 u_int16_t in6p_fport; /* foreign port */ 91 u_int16_t in6p_fport; /* foreign port */
91 u_int16_t in6p_lport; /* local port */ 92 u_int16_t in6p_lport; /* local port */
92 u_int32_t in6p_flowinfo; /* priority and flowlabel */ 93 u_int32_t in6p_flowinfo; /* priority and flowlabel */
93 int in6p_flags; /* generic IP6/datagram flags */ 94 int in6p_flags; /* generic IP6/datagram flags */
94 int in6p_hops; /* default hop limit */ 95 int in6p_hops; /* default hop limit */
95 struct ip6_hdr in6p_ip6; /* header prototype */ 96 struct ip6_hdr in6p_ip6; /* header prototype */
96 struct mbuf *in6p_options; /* IP6 options */ 97 struct mbuf *in6p_options; /* IP6 options */
97 struct ip6_pktopts *in6p_outputopts; /* IP6 options for outgoing packets */ 98 struct ip6_pktopts *in6p_outputopts; /* IP6 options for outgoing packets */
98 struct ip6_moptions *in6p_moptions; /* IP6 multicast options */ 99 struct ip6_moptions *in6p_moptions; /* IP6 multicast options */
99 struct icmp6_filter *in6p_icmp6filt; 100 struct icmp6_filter *in6p_icmp6filt;
100 int in6p_cksum; /* IPV6_CHECKSUM setsockopt */ 101 int in6p_cksum; /* IPV6_CHECKSUM setsockopt */
 102 bool in6p_bindportonsend;
101}; 103};
102 104
103#define in6p_faddr in6p_ip6.ip6_dst 105#define in6p_faddr in6p_ip6.ip6_dst
104#define in6p_laddr in6p_ip6.ip6_src 106#define in6p_laddr in6p_ip6.ip6_src
105 107
106/* states in inp_state: */ 108/* states in inp_state: */
107#define IN6P_ATTACHED INP_ATTACHED 109#define IN6P_ATTACHED INP_ATTACHED
108#define IN6P_BOUND INP_BOUND 110#define IN6P_BOUND INP_BOUND
109#define IN6P_CONNECTED INP_CONNECTED 111#define IN6P_CONNECTED INP_CONNECTED
110 112
111/* 113/*
112 * Flags in in6p_flags 114 * Flags in in6p_flags
113 * We define KAME's original flags in higher 16 bits as much as possible 115 * We define KAME's original flags in higher 16 bits as much as possible

cvs diff -r1.92 -r1.93 src/sys/netinet6/in6_proto.c (expand / switch to unified diff)

--- src/sys/netinet6/in6_proto.c 2011/05/24 18:07:11 1.92
+++ src/sys/netinet6/in6_proto.c 2011/09/24 17:22:14 1.93
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in6_proto.c,v 1.92 2011/05/24 18:07:11 spz Exp $ */ 1/* $NetBSD: in6_proto.c,v 1.93 2011/09/24 17:22:14 christos Exp $ */
2/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */ 2/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -52,27 +52,27 @@ @@ -52,27 +52,27 @@
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE. 59 * SUCH DAMAGE.
60 * 60 *
61 * @(#)in_proto.c 8.1 (Berkeley) 6/10/93 61 * @(#)in_proto.c 8.1 (Berkeley) 6/10/93
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.92 2011/05/24 18:07:11 spz Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.93 2011/09/24 17:22:14 christos Exp $");
66 66
67#include "opt_gateway.h" 67#include "opt_gateway.h"
68#include "opt_inet.h" 68#include "opt_inet.h"
69#include "opt_ipsec.h" 69#include "opt_ipsec.h"
70#include "opt_iso.h" 70#include "opt_iso.h"
71 71
72#include <sys/param.h> 72#include <sys/param.h>
73#include <sys/socket.h> 73#include <sys/socket.h>
74#include <sys/protosw.h> 74#include <sys/protosw.h>
75#include <sys/kernel.h> 75#include <sys/kernel.h>
76#include <sys/domain.h> 76#include <sys/domain.h>
77#include <sys/mbuf.h> 77#include <sys/mbuf.h>
78 78
@@ -158,33 +158,33 @@ PR_WRAP_USRREQ(tcp_usrreq) @@ -158,33 +158,33 @@ PR_WRAP_USRREQ(tcp_usrreq)
158#define tcp_usrreq tcp_usrreq_wrapper 158#define tcp_usrreq tcp_usrreq_wrapper
159 159
160PR_WRAP_CTLINPUT(rip6_ctlinput) 160PR_WRAP_CTLINPUT(rip6_ctlinput)
161PR_WRAP_CTLINPUT(encap6_ctlinput) 161PR_WRAP_CTLINPUT(encap6_ctlinput)
162PR_WRAP_CTLINPUT(udp6_ctlinput) 162PR_WRAP_CTLINPUT(udp6_ctlinput)
163PR_WRAP_CTLINPUT(tcp6_ctlinput) 163PR_WRAP_CTLINPUT(tcp6_ctlinput)
164 164
165#define rip6_ctlinput rip6_ctlinput_wrapper 165#define rip6_ctlinput rip6_ctlinput_wrapper
166#define encap6_ctlinput encap6_ctlinput_wrapper 166#define encap6_ctlinput encap6_ctlinput_wrapper
167#define udp6_ctlinput udp6_ctlinput_wrapper 167#define udp6_ctlinput udp6_ctlinput_wrapper
168#define tcp6_ctlinput tcp6_ctlinput_wrapper 168#define tcp6_ctlinput tcp6_ctlinput_wrapper
169 169
170PR_WRAP_CTLOUTPUT(rip6_ctloutput) 170PR_WRAP_CTLOUTPUT(rip6_ctloutput)
171PR_WRAP_CTLOUTPUT(ip6_ctloutput) 
172PR_WRAP_CTLOUTPUT(tcp_ctloutput) 171PR_WRAP_CTLOUTPUT(tcp_ctloutput)
 172PR_WRAP_CTLOUTPUT(udp6_ctloutput)
173PR_WRAP_CTLOUTPUT(icmp6_ctloutput) 173PR_WRAP_CTLOUTPUT(icmp6_ctloutput)
174 174
175#define rip6_ctloutput rip6_ctloutput_wrapper 175#define rip6_ctloutput rip6_ctloutput_wrapper
176#define ip6_ctloutput ip6_ctloutput_wrapper 
177#define tcp_ctloutput tcp_ctloutput_wrapper 176#define tcp_ctloutput tcp_ctloutput_wrapper
 177#define udp6_ctloutput udp6_ctloutput_wrapper
178#define icmp6_ctloutput icmp6_ctloutput_wrapper 178#define icmp6_ctloutput icmp6_ctloutput_wrapper
179 179
180#if defined(IPSEC) || defined(FAST_IPSEC) 180#if defined(IPSEC) || defined(FAST_IPSEC)
181PR_WRAP_CTLINPUT(ah6_ctlinput) 181PR_WRAP_CTLINPUT(ah6_ctlinput)
182 182
183#define ah6_ctlinput ah6_ctlinput_wrapper 183#define ah6_ctlinput ah6_ctlinput_wrapper
184#endif 184#endif
185 185
186#if (defined(IPSEC) && defined(IPSEC_ESP)) || defined(FAST_IPSEC) 186#if (defined(IPSEC) && defined(IPSEC_ESP)) || defined(FAST_IPSEC)
187PR_WRAP_CTLINPUT(esp6_ctlinput) 187PR_WRAP_CTLINPUT(esp6_ctlinput)
188 188
189#define esp6_ctlinput esp6_ctlinput_wrapper 189#define esp6_ctlinput esp6_ctlinput_wrapper
190#endif 190#endif
@@ -193,27 +193,27 @@ const struct ip6protosw inet6sw[] = { @@ -193,27 +193,27 @@ const struct ip6protosw inet6sw[] = {
193{ .pr_domain = &inet6domain, 193{ .pr_domain = &inet6domain,
194 .pr_protocol = IPPROTO_IPV6, 194 .pr_protocol = IPPROTO_IPV6,
195 .pr_init = ip6_init, 195 .pr_init = ip6_init,
196 .pr_fasttimo = frag6_fasttimo, 196 .pr_fasttimo = frag6_fasttimo,
197 .pr_slowtimo = frag6_slowtimo, 197 .pr_slowtimo = frag6_slowtimo,
198 .pr_drain = frag6_drainstub, 198 .pr_drain = frag6_drainstub,
199}, 199},
200{ .pr_type = SOCK_DGRAM, 200{ .pr_type = SOCK_DGRAM,
201 .pr_domain = &inet6domain, 201 .pr_domain = &inet6domain,
202 .pr_protocol = IPPROTO_UDP, 202 .pr_protocol = IPPROTO_UDP,
203 .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF, 203 .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF,
204 .pr_input = udp6_input, 204 .pr_input = udp6_input,
205 .pr_ctlinput = udp6_ctlinput, 205 .pr_ctlinput = udp6_ctlinput,
206 .pr_ctloutput = ip6_ctloutput, 206 .pr_ctloutput = udp6_ctloutput,
207 .pr_usrreq = udp6_usrreq, 207 .pr_usrreq = udp6_usrreq,
208 .pr_init = udp6_init, 208 .pr_init = udp6_init,
209}, 209},
210{ .pr_type = SOCK_STREAM, 210{ .pr_type = SOCK_STREAM,
211 .pr_domain = &inet6domain, 211 .pr_domain = &inet6domain,
212 .pr_protocol = IPPROTO_TCP, 212 .pr_protocol = IPPROTO_TCP,
213 .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS|PR_PURGEIF, 213 .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_ABRTACPTDIS|PR_PURGEIF,
214 .pr_input = tcp6_input, 214 .pr_input = tcp6_input,
215 .pr_ctlinput = tcp6_ctlinput, 215 .pr_ctlinput = tcp6_ctlinput,
216 .pr_ctloutput = tcp_ctloutput, 216 .pr_ctloutput = tcp_ctloutput,
217 .pr_usrreq = tcp_usrreq, 217 .pr_usrreq = tcp_usrreq,
218#ifndef INET /* don't call initialization and timeout routines twice */ 218#ifndef INET /* don't call initialization and timeout routines twice */
219 .pr_init = tcp_init, 219 .pr_init = tcp_init,

cvs diff -r1.51 -r1.52 src/sys/netinet6/in6_src.c (expand / switch to unified diff)

--- src/sys/netinet6/in6_src.c 2011/05/17 04:39:57 1.51
+++ src/sys/netinet6/in6_src.c 2011/09/24 17:22:14 1.52
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in6_src.c,v 1.51 2011/05/17 04:39:57 dholland Exp $ */ 1/* $NetBSD: in6_src.c,v 1.52 2011/09/24 17:22:14 christos Exp $ */
2/* $KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $ */ 2/* $KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -56,53 +56,54 @@ @@ -56,53 +56,54 @@
56 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 56 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE. 63 * SUCH DAMAGE.
64 * 64 *
65 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 65 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94
66 */ 66 */
67 67
68#include <sys/cdefs.h> 68#include <sys/cdefs.h>
69__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.51 2011/05/17 04:39:57 dholland Exp $"); 69__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.52 2011/09/24 17:22:14 christos Exp $");
70 70
71#include "opt_inet.h" 71#include "opt_inet.h"
72 72
73#include <sys/param.h> 73#include <sys/param.h>
74#include <sys/systm.h> 74#include <sys/systm.h>
75#include <sys/malloc.h> 75#include <sys/malloc.h>
76#include <sys/mbuf.h> 76#include <sys/mbuf.h>
77#include <sys/protosw.h> 77#include <sys/protosw.h>
78#include <sys/socket.h> 78#include <sys/socket.h>
79#include <sys/socketvar.h> 79#include <sys/socketvar.h>
80#include <sys/ioctl.h> 80#include <sys/ioctl.h>
81#include <sys/errno.h> 81#include <sys/errno.h>
82#include <sys/time.h> 82#include <sys/time.h>
83#include <sys/kernel.h> 83#include <sys/kernel.h>
84#include <sys/proc.h> 84#include <sys/proc.h>
85#include <sys/kauth.h> 85#include <sys/kauth.h>
86 86
87#include <net/if.h> 87#include <net/if.h>
88#include <net/if_types.h> 88#include <net/if_types.h>
89#include <net/route.h> 89#include <net/route.h>
90 90
91#include <netinet/in.h> 91#include <netinet/in.h>
92#include <netinet/in_var.h> 92#include <netinet/in_var.h>
93#include <netinet/in_systm.h> 93#include <netinet/in_systm.h>
94#include <netinet/ip.h> 94#include <netinet/ip.h>
95#include <netinet/in_pcb.h> 95#include <netinet/in_pcb.h>
 96#include <netinet/rfc6056.h>
96#include <netinet6/in6_var.h> 97#include <netinet6/in6_var.h>
97#include <netinet/ip6.h> 98#include <netinet/ip6.h>
98#include <netinet6/in6_pcb.h> 99#include <netinet6/in6_pcb.h>
99#include <netinet6/ip6_var.h> 100#include <netinet6/ip6_var.h>
100#include <netinet6/ip6_private.h> 101#include <netinet6/ip6_private.h>
101#include <netinet6/nd6.h> 102#include <netinet6/nd6.h>
102#include <netinet6/scope6_var.h> 103#include <netinet6/scope6_var.h>
103 104
104#include <net/net_osdep.h> 105#include <net/net_osdep.h>
105 106
106#ifdef MIP6 107#ifdef MIP6
107#include <netinet6/mip6.h> 108#include <netinet6/mip6.h>
108#include <netinet6/mip6_var.h> 109#include <netinet6/mip6_var.h>
@@ -791,110 +792,56 @@ in6_selecthlim(struct in6pcb *in6p, stru @@ -791,110 +792,56 @@ in6_selecthlim(struct in6pcb *in6p, stru
791 return (ND_IFINFO(ifp)->chlim); 792 return (ND_IFINFO(ifp)->chlim);
792 else 793 else
793 return (ip6_defhlim); 794 return (ip6_defhlim);
794} 795}
795 796
796/* 797/*
797 * Find an empty port and set it to the specified PCB. 798 * Find an empty port and set it to the specified PCB.
798 */ 799 */
799int 800int
800in6_pcbsetport(struct sockaddr_in6 *sin6, struct in6pcb *in6p, struct lwp *l) 801in6_pcbsetport(struct sockaddr_in6 *sin6, struct in6pcb *in6p, struct lwp *l)
801{ 802{
802 struct socket *so = in6p->in6p_socket; 803 struct socket *so = in6p->in6p_socket;
803 struct inpcbtable *table = in6p->in6p_table; 804 struct inpcbtable *table = in6p->in6p_table;
804 int cnt; 
805 u_int16_t minport, maxport; 
806 u_int16_t lport, *lastport; 805 u_int16_t lport, *lastport;
807 int wild = 0; 
808 void *t; 
809 int error; 
810 enum kauth_network_req req; 806 enum kauth_network_req req;
811 807 int error = 0;
812 /* XXX: this is redundant when called from in6_pcbbind */ 808
813 if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0 && 
814 ((so->so_proto->pr_flags & PR_CONNREQUIRED) == 0 || 
815 (so->so_options & SO_ACCEPTCONN) == 0)) 
816 wild = 1; 
817 
818 if (in6p->in6p_flags & IN6P_LOWPORT) { 809 if (in6p->in6p_flags & IN6P_LOWPORT) {
819#ifndef IPNOPRIVPORTS 810#ifndef IPNOPRIVPORTS
820 req = KAUTH_REQ_NETWORK_BIND_PRIVPORT; 811 req = KAUTH_REQ_NETWORK_BIND_PRIVPORT;
821#else 812#else
822 req = KAUTH_REQ_NETWORK_BIND_PORT; 813 req = KAUTH_REQ_NETWORK_BIND_PORT;
823#endif 814#endif
824 
825 minport = ip6_lowportmin; 
826 maxport = ip6_lowportmax; 
827 lastport = &table->inpt_lastlow; 815 lastport = &table->inpt_lastlow;
828 } else { 816 } else {
829 req = KAUTH_REQ_NETWORK_BIND_PORT; 817 req = KAUTH_REQ_NETWORK_BIND_PORT;
830 818
831 minport = ip6_anonportmin; 
832 maxport = ip6_anonportmax; 
833 lastport = &table->inpt_lastport; 819 lastport = &table->inpt_lastport;
834 } 820 }
835 821
836 /* XXX-kauth: KAUTH_REQ_NETWORK_BIND_AUTOASSIGN_{,PRIV}PORT */ 822 /* XXX-kauth: KAUTH_REQ_NETWORK_BIND_AUTOASSIGN_{,PRIV}PORT */
837 error = kauth_authorize_network(l->l_cred, KAUTH_NETWORK_BIND, req, so, 823 error = kauth_authorize_network(l->l_cred, KAUTH_NETWORK_BIND, req, so,
838 sin6, NULL); 824 sin6, NULL);
839 if (error) 825 if (error)
840 return (EACCES); 826 return (EACCES);
841 827
842 if (minport > maxport) { /* sanity check */ 828 /*
843 u_int16_t swp; 829 * Use RFC6056 randomized port selection
844  830 */
845 swp = minport; 831 error = rfc6056_randport(&lport, &in6p->in6p_head, l->l_cred);
846 minport = maxport; 832 if (error)
847 maxport = swp; 833 return error;
848 } 
849 
850 lport = *lastport - 1; 
851 for (cnt = maxport - minport + 1; cnt; cnt--, lport--) { 
852 vestigial_inpcb_t vestige; 
853 
854 if (lport < minport || lport > maxport) 
855 lport = maxport; 
856#ifdef INET 
857 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { 
858 t = in_pcblookup_port(table, 
859 *(struct in_addr *)&sin6->sin6_addr.s6_addr32[3], 
860 htons(lport), wild, &vestige); 
861 if (!t && vestige.valid) 
862 continue; 
863 } else 
864#endif 
865 { 
866 t = in6_pcblookup_port(table, &sin6->sin6_addr, 
867 htons(lport), wild, &vestige); 
868 if (!t && vestige.valid) 
869 continue; 
870 } 
871 if (t == 0) { 
872 /* We have a free port. Check with the secmodel. */ 
873 sin6->sin6_port = lport; 
874 error = kauth_authorize_network(l->l_cred, 
875 KAUTH_NETWORK_BIND, req, so, sin6, NULL); 
876 if (error) { 
877 /* Secmodel says no. Keep looking. */ 
878 continue; 
879 } 
880  834
881 goto found; 
882 } 
883 } 
884 
885 return (EAGAIN); 
886 
887found: 
888 in6p->in6p_flags |= IN6P_ANONPORT; 835 in6p->in6p_flags |= IN6P_ANONPORT;
889 *lastport = lport; 836 *lastport = lport;
890 in6p->in6p_lport = htons(lport); 837 in6p->in6p_lport = htons(lport);
891 in6_pcbstate(in6p, IN6P_BOUND); 838 in6_pcbstate(in6p, IN6P_BOUND);
892 return (0); /* success */ 839 return (0); /* success */
893} 840}
894 841
895void 842void
896addrsel_policy_init(void) 843addrsel_policy_init(void)
897{ 844{
898 init_policy_queue(); 845 init_policy_queue();
899 846
900 /* initialize the "last resort" policy */ 847 /* initialize the "last resort" policy */

cvs diff -r1.42 -r1.43 src/sys/netinet6/Attic/udp6_output.c (expand / switch to unified diff)

--- src/sys/netinet6/Attic/udp6_output.c 2011/08/31 18:31:03 1.42
+++ src/sys/netinet6/Attic/udp6_output.c 2011/09/24 17:22:14 1.43
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: udp6_output.c,v 1.42 2011/08/31 18:31:03 plunky Exp $ */ 1/* $NetBSD: udp6_output.c,v 1.43 2011/09/24 17:22:14 christos Exp $ */
2/* $KAME: udp6_output.c,v 1.43 2001/10/15 09:19:52 itojun Exp $ */ 2/* $KAME: udp6_output.c,v 1.43 2001/10/15 09:19:52 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -52,27 +52,27 @@ @@ -52,27 +52,27 @@
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE. 59 * SUCH DAMAGE.
60 * 60 *
61 * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 61 * @(#)udp_var.h 8.1 (Berkeley) 6/10/93
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: udp6_output.c,v 1.42 2011/08/31 18:31:03 plunky Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: udp6_output.c,v 1.43 2011/09/24 17:22:14 christos Exp $");
66 66
67#include "opt_inet.h" 67#include "opt_inet.h"
68 68
69#include <sys/param.h> 69#include <sys/param.h>
70#include <sys/malloc.h> 70#include <sys/malloc.h>
71#include <sys/mbuf.h> 71#include <sys/mbuf.h>
72#include <sys/protosw.h> 72#include <sys/protosw.h>
73#include <sys/socket.h> 73#include <sys/socket.h>
74#include <sys/socketvar.h> 74#include <sys/socketvar.h>
75#include <sys/errno.h> 75#include <sys/errno.h>
76#include <sys/stat.h> 76#include <sys/stat.h>
77#include <sys/systm.h> 77#include <sys/systm.h>
78#include <sys/proc.h> 78#include <sys/proc.h>
@@ -172,30 +172,29 @@ udp6_output(struct in6pcb * const in6p,  @@ -172,30 +172,29 @@ udp6_output(struct in6pcb * const in6p,
172 in6p->in6p_outputopts, l->l_cred, IPPROTO_UDP)) != 0) 172 in6p->in6p_outputopts, l->l_cred, IPPROTO_UDP)) != 0)
173 goto release; 173 goto release;
174 optp = &opt; 174 optp = &opt;
175 } else 175 } else
176 optp = in6p->in6p_outputopts; 176 optp = in6p->in6p_outputopts;
177 177
178 178
179 if (sin6) { 179 if (sin6) {
180 faddr = &sin6->sin6_addr; 180 faddr = &sin6->sin6_addr;
181 181
182 /* 182 /*
183 * IPv4 version of udp_output calls in_pcbconnect in this case, 183 * IPv4 version of udp_output calls in_pcbconnect in this case,
184 * which needs splnet and affects performance. 184 * which needs splnet and affects performance.
185 * Since we saw no essential reason for calling in_pcbconnect, 185 * We have to do this as well, since in6_pcbsetport needs to
186 * we get rid of such kind of logic, and call in6_selectsrc 186 * know the foreign address for some of the algorithms that
187 * and in6_pcbsetport in order to fill in the local address 187 * it employs.
188 * and the local port. 
189 */ 188 */
190 if (sin6->sin6_port == 0) { 189 if (sin6->sin6_port == 0) {
191 error = EADDRNOTAVAIL; 190 error = EADDRNOTAVAIL;
192 goto release; 191 goto release;
193 } 192 }
194 193
195 if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) { 194 if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) {
196 /* how about ::ffff:0.0.0.0 case? */ 195 /* how about ::ffff:0.0.0.0 case? */
197 error = EISCONN; 196 error = EISCONN;
198 goto release; 197 goto release;
199 } 198 }
200 199
201 200
@@ -282,27 +281,29 @@ udp6_output(struct in6pcb * const in6p,  @@ -282,27 +281,29 @@ udp6_output(struct in6pcb * const in6p,
282 } 281 }
283 if (in6p->in6p_lport == 0) { 282 if (in6p->in6p_lport == 0) {
284 /* 283 /*
285 * Craft a sockaddr_in6 for the local endpoint. Use the 284 * Craft a sockaddr_in6 for the local endpoint. Use the
286 * "any" as a base, set the address, and recover the 285 * "any" as a base, set the address, and recover the
287 * scope. 286 * scope.
288 */ 287 */
289 struct sockaddr_in6 lsin6 = 288 struct sockaddr_in6 lsin6 =
290 *((const struct sockaddr_in6 *)in6p->in6p_socket->so_proto->pr_domain->dom_sa_any); 289 *((const struct sockaddr_in6 *)in6p->in6p_socket->so_proto->pr_domain->dom_sa_any);
291 lsin6.sin6_addr = *laddr; 290 lsin6.sin6_addr = *laddr;
292 error = sa6_recoverscope(&lsin6); 291 error = sa6_recoverscope(&lsin6);
293 if (error) 292 if (error)
294 goto release; 293 goto release;
295 error = in6_pcbsetport(&lsin6, in6p, l); 294
 295 error = in6_pcbconnect(in6p, addr6, l);
 296
296 if (error) 297 if (error)
297 goto release; 298 goto release;
298 } 299 }
299 } else { 300 } else {
300 if (IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) { 301 if (IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr)) {
301 error = ENOTCONN; 302 error = ENOTCONN;
302 goto release; 303 goto release;
303 } 304 }
304 if (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_faddr)) { 305 if (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_faddr)) {
305 if ((in6p->in6p_flags & IN6P_IPV6_V6ONLY)) 306 if ((in6p->in6p_flags & IN6P_IPV6_V6ONLY))
306 { 307 {
307 /* 308 /*
308 * XXX: this case would happen when the 309 * XXX: this case would happen when the

cvs diff -r1.89 -r1.90 src/sys/netinet6/udp6_usrreq.c (expand / switch to unified diff)

--- src/sys/netinet6/udp6_usrreq.c 2011/05/03 18:28:45 1.89
+++ src/sys/netinet6/udp6_usrreq.c 2011/09/24 17:22:14 1.90
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: udp6_usrreq.c,v 1.89 2011/05/03 18:28:45 dyoung Exp $ */ 1/* $NetBSD: udp6_usrreq.c,v 1.90 2011/09/24 17:22:14 christos Exp $ */
2/* $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $ */ 2/* $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -52,53 +52,57 @@ @@ -52,53 +52,57 @@
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE. 59 * SUCH DAMAGE.
60 * 60 *
61 * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 61 * @(#)udp_var.h 8.1 (Berkeley) 6/10/93
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.89 2011/05/03 18:28:45 dyoung Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.90 2011/09/24 17:22:14 christos Exp $");
 66
 67#include "opt_inet.h"
66 68
67#include <sys/param.h> 69#include <sys/param.h>
68#include <sys/malloc.h> 70#include <sys/malloc.h>
69#include <sys/mbuf.h> 71#include <sys/mbuf.h>
70#include <sys/protosw.h> 72#include <sys/protosw.h>
71#include <sys/socket.h> 73#include <sys/socket.h>
72#include <sys/socketvar.h> 74#include <sys/socketvar.h>
73#include <sys/errno.h> 75#include <sys/errno.h>
74#include <sys/stat.h> 76#include <sys/stat.h>
75#include <sys/systm.h> 77#include <sys/systm.h>
76#include <sys/proc.h> 78#include <sys/proc.h>
77#include <sys/syslog.h> 79#include <sys/syslog.h>
 80#include <sys/domain.h>
78#include <sys/sysctl.h> 81#include <sys/sysctl.h>
79 82
80#include <net/if.h> 83#include <net/if.h>
81#include <net/route.h> 84#include <net/route.h>
82#include <net/if_types.h> 85#include <net/if_types.h>
83 86
84#include <netinet/in.h> 87#include <netinet/in.h>
85#include <netinet/in_var.h> 88#include <netinet/in_var.h>
86#include <netinet/in_systm.h> 89#include <netinet/in_systm.h>
87#include <netinet/ip.h> 90#include <netinet/ip.h>
88#include <netinet/ip_var.h> 91#include <netinet/ip_var.h>
89#include <netinet/in_pcb.h> 92#include <netinet/in_pcb.h>
90#include <netinet/udp.h> 93#include <netinet/udp.h>
91#include <netinet/udp_var.h> 94#include <netinet/udp_var.h>
 95#include <netinet/rfc6056.h>
92#include <netinet/ip6.h> 96#include <netinet/ip6.h>
93#include <netinet6/ip6_var.h> 97#include <netinet6/ip6_var.h>
94#include <netinet6/in6_pcb.h> 98#include <netinet6/in6_pcb.h>
95#include <netinet/icmp6.h> 99#include <netinet/icmp6.h>
96#include <netinet6/udp6_var.h> 100#include <netinet6/udp6_var.h>
97#include <netinet6/udp6_private.h> 101#include <netinet6/udp6_private.h>
98#include <netinet6/ip6protosw.h> 102#include <netinet6/ip6protosw.h>
99#include <netinet/in_offload.h> 103#include <netinet/in_offload.h>
100 104
101#include "faith.h" 105#include "faith.h"
102#if defined(NFAITH) && NFAITH > 0 106#if defined(NFAITH) && NFAITH > 0
103#include <net/if_faith.h> 107#include <net/if_faith.h>
104#endif 108#endif
@@ -244,26 +248,91 @@ udp6_ctlinput(int cmd, const struct sock @@ -244,26 +248,91 @@ udp6_ctlinput(int cmd, const struct sock
244 */ 248 */
245 } 249 }
246 250
247 (void) in6_pcbnotify(&udbtable, sa, uh.uh_dport, 251 (void) in6_pcbnotify(&udbtable, sa, uh.uh_dport,
248 (const struct sockaddr *)sa6_src, uh.uh_sport, cmd, cmdarg, 252 (const struct sockaddr *)sa6_src, uh.uh_sport, cmd, cmdarg,
249 notify); 253 notify);
250 } else { 254 } else {
251 (void) in6_pcbnotify(&udbtable, sa, 0, 255 (void) in6_pcbnotify(&udbtable, sa, 0,
252 (const struct sockaddr *)sa6_src, 0, cmd, cmdarg, notify); 256 (const struct sockaddr *)sa6_src, 0, cmd, cmdarg, notify);
253 } 257 }
254 return NULL; 258 return NULL;
255} 259}
256 260
 261int
 262udp6_ctloutput(int op, struct socket *so, struct sockopt *sopt)
 263{
 264 int s;
 265 int error = 0;
 266 struct inpcb *inp;
 267 int family;
 268 int optval;
 269
 270 family = so->so_proto->pr_domain->dom_family;
 271
 272 s = splsoftnet();
 273 switch (family) {
 274#ifdef INET
 275 case PF_INET:
 276 if (sopt->sopt_level != IPPROTO_UDP) {
 277 error = ip_ctloutput(op, so, sopt);
 278 goto end;
 279 }
 280 break;
 281#endif
 282#ifdef INET6
 283 case PF_INET6:
 284 if (sopt->sopt_level != IPPROTO_UDP) {
 285 error = ip6_ctloutput(op, so, sopt);
 286 goto end;
 287 }
 288 break;
 289#endif
 290 default:
 291 error = EAFNOSUPPORT;
 292 goto end;
 293 }
 294
 295 switch (op) {
 296 case PRCO_SETOPT:
 297 inp = sotoinpcb(so);
 298
 299 switch (sopt->sopt_name) {
 300 case UDP_RFC6056ALGO:
 301 error = sockopt_getint(sopt, &optval);
 302 if (error)
 303 break;
 304
 305 error = rfc6056_algo_index_select(
 306 (struct inpcb_hdr *)inp, optval);
 307 break;
 308
 309 default:
 310 error = ENOPROTOOPT;
 311 break;
 312 }
 313 break;
 314
 315 default:
 316 error = EINVAL;
 317 break;
 318 }
 319
 320end:
 321 splx(s);
 322 return error;
 323}
 324
 325
257extern int udp6_sendspace; 326extern int udp6_sendspace;
258extern int udp6_recvspace; 327extern int udp6_recvspace;
259 328
260int 329int
261udp6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr6, 330udp6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr6,
262 struct mbuf *control, struct lwp *l) 331 struct mbuf *control, struct lwp *l)
263{ 332{
264 struct in6pcb *in6p = sotoin6pcb(so); 333 struct in6pcb *in6p = sotoin6pcb(so);
265 int error = 0; 334 int error = 0;
266 int s; 335 int s;
267 336
268 /* 337 /*
269 * MAPPED_ADDR implementation info: 338 * MAPPED_ADDR implementation info:
@@ -409,26 +478,28 @@ release: @@ -409,26 +478,28 @@ release:
409 return error; 478 return error;
410} 479}
411 480
412static int 481static int
413sysctl_net_inet6_udp6_stats(SYSCTLFN_ARGS) 482sysctl_net_inet6_udp6_stats(SYSCTLFN_ARGS)
414{ 483{
415 484
416 return (NETSTAT_SYSCTL(udp6stat_percpu, UDP6_NSTATS)); 485 return (NETSTAT_SYSCTL(udp6stat_percpu, UDP6_NSTATS));
417} 486}
418 487
419static void 488static void
420sysctl_net_inet6_udp6_setup(struct sysctllog **clog) 489sysctl_net_inet6_udp6_setup(struct sysctllog **clog)
421{ 490{
 491 const struct sysctlnode *rfc6056_node;
 492
422 sysctl_createv(clog, 0, NULL, NULL, 493 sysctl_createv(clog, 0, NULL, NULL,
423 CTLFLAG_PERMANENT, 494 CTLFLAG_PERMANENT,
424 CTLTYPE_NODE, "net", NULL, 495 CTLTYPE_NODE, "net", NULL,
425 NULL, 0, NULL, 0, 496 NULL, 0, NULL, 0,
426 CTL_NET, CTL_EOL); 497 CTL_NET, CTL_EOL);
427 sysctl_createv(clog, 0, NULL, NULL, 498 sysctl_createv(clog, 0, NULL, NULL,
428 CTLFLAG_PERMANENT, 499 CTLFLAG_PERMANENT,
429 CTLTYPE_NODE, "inet6", NULL, 500 CTLTYPE_NODE, "inet6", NULL,
430 NULL, 0, NULL, 0, 501 NULL, 0, NULL, 0,
431 CTL_NET, PF_INET6, CTL_EOL); 502 CTL_NET, PF_INET6, CTL_EOL);
432 sysctl_createv(clog, 0, NULL, NULL, 503 sysctl_createv(clog, 0, NULL, NULL,
433 CTLFLAG_PERMANENT, 504 CTLFLAG_PERMANENT,
434 CTLTYPE_NODE, "udp6", 505 CTLTYPE_NODE, "udp6",
@@ -461,22 +532,41 @@ sysctl_net_inet6_udp6_setup(struct sysct @@ -461,22 +532,41 @@ sysctl_net_inet6_udp6_setup(struct sysct
461 CTLFLAG_PERMANENT, 532 CTLFLAG_PERMANENT,
462 CTLTYPE_STRUCT, "pcblist", 533 CTLTYPE_STRUCT, "pcblist",
463 SYSCTL_DESCR("UDP protocol control block list"), 534 SYSCTL_DESCR("UDP protocol control block list"),
464 sysctl_inpcblist, 0, &udbtable, 0, 535 sysctl_inpcblist, 0, &udbtable, 0,
465 CTL_NET, PF_INET6, IPPROTO_UDP, CTL_CREATE, 536 CTL_NET, PF_INET6, IPPROTO_UDP, CTL_CREATE,
466 CTL_EOL); 537 CTL_EOL);
467 sysctl_createv(clog, 0, NULL, NULL, 538 sysctl_createv(clog, 0, NULL, NULL,
468 CTLFLAG_PERMANENT, 539 CTLFLAG_PERMANENT,
469 CTLTYPE_STRUCT, "stats", 540 CTLTYPE_STRUCT, "stats",
470 SYSCTL_DESCR("UDPv6 statistics"), 541 SYSCTL_DESCR("UDPv6 statistics"),
471 sysctl_net_inet6_udp6_stats, 0, NULL, 0, 542 sysctl_net_inet6_udp6_stats, 0, NULL, 0,
472 CTL_NET, PF_INET6, IPPROTO_UDP, UDP6CTL_STATS, 543 CTL_NET, PF_INET6, IPPROTO_UDP, UDP6CTL_STATS,
473 CTL_EOL); 544 CTL_EOL);
 545 /* RFC6056 subtree */
 546 sysctl_createv(clog, 0, NULL, &rfc6056_node,
 547 CTLFLAG_PERMANENT,
 548 CTLTYPE_NODE, "rfc6056",
 549 SYSCTL_DESCR("RFC 6056"),
 550 NULL, 0, NULL, 0,
 551 CTL_NET, PF_INET6, IPPROTO_UDP, CTL_CREATE, CTL_EOL);
 552 sysctl_createv(clog, 0, &rfc6056_node, NULL,
 553 CTLFLAG_PERMANENT,
 554 CTLTYPE_STRING, "available",
 555 SYSCTL_DESCR("RFC 6056 available algorithms"),
 556 sysctl_rfc6056_available, 0, NULL, RFC6056_MAXLEN,
 557 CTL_CREATE, CTL_EOL);
 558 sysctl_createv(clog, 0, &rfc6056_node, NULL,
 559 CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
 560 CTLTYPE_STRING, "selected",
 561 SYSCTL_DESCR("RFC 6056 selected algorithm"),
 562 sysctl_rfc6056_selected6, 0, NULL, RFC6056_MAXLEN,
 563 CTL_CREATE, CTL_EOL);
474} 564}
475 565
476void 566void
477udp6_statinc(u_int stat) 567udp6_statinc(u_int stat)
478{ 568{
479 569
480 KASSERT(stat < UDP6_NSTATS); 570 KASSERT(stat < UDP6_NSTATS);
481 UDP6_STATINC(stat); 571 UDP6_STATINC(stat);
482} 572}

cvs diff -r1.23 -r1.24 src/sys/netinet6/udp6_var.h (expand / switch to unified diff)

--- src/sys/netinet6/udp6_var.h 2008/04/24 11:38:38 1.23
+++ src/sys/netinet6/udp6_var.h 2011/09/24 17:22:14 1.24
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: udp6_var.h,v 1.23 2008/04/24 11:38:38 ad Exp $ */ 1/* $NetBSD: udp6_var.h,v 1.24 2011/09/24 17:22:14 christos Exp $ */
2/* $KAME: udp6_var.h,v 1.11 2000/06/05 00:14:31 itojun Exp $ */ 2/* $KAME: udp6_var.h,v 1.11 2000/06/05 00:14:31 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -74,42 +74,43 @@ @@ -74,42 +74,43 @@
74#define UDP6_STAT_NOSUM 3 /* no checksum */ 74#define UDP6_STAT_NOSUM 3 /* no checksum */
75#define UDP6_STAT_BADLEN 4 /* data length larger than packet */ 75#define UDP6_STAT_BADLEN 4 /* data length larger than packet */
76#define UDP6_STAT_NOPORT 5 /* no socket on port */ 76#define UDP6_STAT_NOPORT 5 /* no socket on port */
77#define UDP6_STAT_NOPORTMCAST 6 /* of above, arrived as multicast */ 77#define UDP6_STAT_NOPORTMCAST 6 /* of above, arrived as multicast */
78#define UDP6_STAT_FULLSOCK 7 /* not delivered, input socket full */ 78#define UDP6_STAT_FULLSOCK 7 /* not delivered, input socket full */
79#define UDP6_STAT_PCBCACHEMISS 8 /* input packets missing pcb cache */ 79#define UDP6_STAT_PCBCACHEMISS 8 /* input packets missing pcb cache */
80#define UDP6_STAT_OPACKETS 9 /* total output packets */ 80#define UDP6_STAT_OPACKETS 9 /* total output packets */
81 81
82#define UDP6_NSTATS 10 82#define UDP6_NSTATS 10
83 83
84/* 84/*
85 * Names for UDP6 sysctl objects 85 * Names for UDP6 sysctl objects
86 */ 86 */
87#define UDP6CTL_SENDSPACE 1 /* default send buffer */ 87#define UDP6CTL_SENDSPACE 1 /* default send buffer */
88#define UDP6CTL_RECVSPACE 2 /* default recv buffer */ 88#define UDP6CTL_RECVSPACE 2 /* default recv buffer */
89#define UDP6CTL_LOOPBACKCKSUM 3 /* do UDP checksum on loopback? */ 89#define UDP6CTL_LOOPBACKCKSUM 3 /* do UDP checksum on loopback? */
90#define UDP6CTL_STATS 4 /* udp6 statistics */ 90#define UDP6CTL_STATS 4 /* udp6 statistics */
91#define UDP6CTL_MAXID 5 91#define UDP6CTL_RFC6056 5 /* RFC 6056 algorithm selection */
 92#define UDP6CTL_MAXID 6
92 93
93#define UDP6CTL_NAMES { \ 94#define UDP6CTL_NAMES { \
94 { 0, 0 }, \ 95 { 0, 0 }, \
95 { "sendspace", CTLTYPE_INT }, \ 96 { "sendspace", CTLTYPE_INT }, \
96 { "recvspace", CTLTYPE_INT }, \ 97 { "recvspace", CTLTYPE_INT }, \
97 { "do_loopback_cksum", CTLTYPE_INT }, \ 98 { "do_loopback_cksum", CTLTYPE_INT }, \
98 { "stats", CTLTYPE_STRUCT }, \ 99 { "stats", CTLTYPE_STRUCT }, \
99} 100}
100 101
101#ifdef _KERNEL 102#ifdef _KERNEL
102void *udp6_ctlinput(int, const struct sockaddr *, void *); 103void *udp6_ctlinput(int, const struct sockaddr *, void *);
 104int udp6_ctloutput(int, struct socket *, struct sockopt *);
103void udp6_init(void); 105void udp6_init(void);
104int udp6_input(struct mbuf **, int *, int); 106int udp6_input(struct mbuf **, int *, int);
105int udp6_output(struct in6pcb *, struct mbuf *, struct mbuf *, 107int udp6_output(struct in6pcb *, struct mbuf *, struct mbuf *,
106 struct mbuf *, struct lwp *); 108 struct mbuf *, struct lwp *);
107int udp6_sysctl(int *, u_int, void *, size_t *, void *, size_t); 109int udp6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
108int udp6_usrreq(struct socket *, 110int udp6_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
109 int, struct mbuf *, struct mbuf *, struct mbuf *, 111 struct mbuf *, struct lwp *);
110 struct lwp *); 
111 112
112void udp6_statinc(u_int); 113void udp6_statinc(u_int);
113#endif /* _KERNEL */ 114#endif /* _KERNEL */
114 115
115#endif /* !_NETINET6_UDP6_VAR_H_ */ 116#endif /* !_NETINET6_UDP6_VAR_H_ */