Eliminate struct protosw::pr_output. You can't use this unless you know what it is a priori: the formal prototype is variadic, and the different instances (e.g., ip_output, route_output) have different real prototypes. Convert the only user of it, raw_send in net/raw_cb.c, to take an explicit callback argument. Convert the only instances of it, route_output and key_output, to such explicit callbacks for raw_send. Use assertions to make sure the conversion to explicit callbacks is warranted. Discussed on tech-net with no objections: https://mail-index.netbsd.org/tech-net/2016/01/16/msg005484.htmldiff -r1.82 -r1.83 src/sys/net/if_stf.c
(riastradh)
--- src/sys/net/if_stf.c 2015/08/24 22:21:26 1.82
+++ src/sys/net/if_stf.c 2016/01/20 21:43:59 1.83
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_stf.c,v 1.82 2015/08/24 22:21:26 pooka Exp $ */ | 1 | /* $NetBSD: if_stf.c,v 1.83 2016/01/20 21:43:59 riastradh Exp $ */ | |
2 | /* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */ | 2 | /* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 2000 WIDE Project. | 5 | * Copyright (C) 2000 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 | |
@@ -65,27 +65,27 @@ | @@ -65,27 +65,27 @@ | |||
65 | * Even if we assign link-locals to interface, we cannot really | 65 | * Even if we assign link-locals to interface, we cannot really | |
66 | * use link-local unicast/multicast on top of 6to4 cloud (since there's no | 66 | * use link-local unicast/multicast on top of 6to4 cloud (since there's no | |
67 | * encapsulation defined for link-local address), and the above analysis does | 67 | * encapsulation defined for link-local address), and the above analysis does | |
68 | * not change. RFC3056 does not mandate the assignment of link-local address | 68 | * not change. RFC3056 does not mandate the assignment of link-local address | |
69 | * either. | 69 | * either. | |
70 | * | 70 | * | |
71 | * 6to4 interface has security issues. Refer to | 71 | * 6to4 interface has security issues. Refer to | |
72 | * http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt | 72 | * http://playground.iijlab.net/i-d/draft-itojun-ipv6-transition-abuse-00.txt | |
73 | * for details. The code tries to filter out some of malicious packets. | 73 | * for details. The code tries to filter out some of malicious packets. | |
74 | * Note that there is no way to be 100% secure. | 74 | * Note that there is no way to be 100% secure. | |
75 | */ | 75 | */ | |
76 | 76 | |||
77 | #include <sys/cdefs.h> | 77 | #include <sys/cdefs.h> | |
78 | __KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.82 2015/08/24 22:21:26 pooka Exp $"); | 78 | __KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.83 2016/01/20 21:43:59 riastradh Exp $"); | |
79 | 79 | |||
80 | #ifdef _KERNEL_OPT | 80 | #ifdef _KERNEL_OPT | |
81 | #include "opt_inet.h" | 81 | #include "opt_inet.h" | |
82 | #endif | 82 | #endif | |
83 | 83 | |||
84 | #ifndef INET6 | 84 | #ifndef INET6 | |
85 | #error "pseudo-device stf requires options INET6" | 85 | #error "pseudo-device stf requires options INET6" | |
86 | #endif | 86 | #endif | |
87 | 87 | |||
88 | #include <sys/param.h> | 88 | #include <sys/param.h> | |
89 | #include <sys/systm.h> | 89 | #include <sys/systm.h> | |
90 | #include <sys/socket.h> | 90 | #include <sys/socket.h> | |
91 | #include <sys/sockio.h> | 91 | #include <sys/sockio.h> | |
@@ -155,27 +155,26 @@ extern int ip_gif_ttl; /*XXX*/ | @@ -155,27 +155,26 @@ extern int ip_gif_ttl; /*XXX*/ | |||
155 | #else | 155 | #else | |
156 | static int ip_gif_ttl = 40; /*XXX*/ | 156 | static int ip_gif_ttl = 40; /*XXX*/ | |
157 | #endif | 157 | #endif | |
158 | 158 | |||
159 | extern struct domain inetdomain; | 159 | extern struct domain inetdomain; | |
160 | 160 | |||
161 | static const struct protosw in_stf_protosw = | 161 | static const struct protosw in_stf_protosw = | |
162 | { | 162 | { | |
163 | .pr_type = SOCK_RAW, | 163 | .pr_type = SOCK_RAW, | |
164 | .pr_domain = &inetdomain, | 164 | .pr_domain = &inetdomain, | |
165 | .pr_protocol = IPPROTO_IPV6, | 165 | .pr_protocol = IPPROTO_IPV6, | |
166 | .pr_flags = PR_ATOMIC|PR_ADDR, | 166 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
167 | .pr_input = in_stf_input, | 167 | .pr_input = in_stf_input, | |
168 | .pr_output = rip_output, | |||
169 | .pr_ctlinput = NULL, | 168 | .pr_ctlinput = NULL, | |
170 | .pr_ctloutput = rip_ctloutput, | 169 | .pr_ctloutput = rip_ctloutput, | |
171 | .pr_usrreqs = &rip_usrreqs, | 170 | .pr_usrreqs = &rip_usrreqs, | |
172 | }; | 171 | }; | |
173 | 172 | |||
174 | static int stf_encapcheck(struct mbuf *, int, int, void *); | 173 | static int stf_encapcheck(struct mbuf *, int, int, void *); | |
175 | static struct in6_ifaddr *stf_getsrcifa6(struct ifnet *); | 174 | static struct in6_ifaddr *stf_getsrcifa6(struct ifnet *); | |
176 | static int stf_output(struct ifnet *, struct mbuf *, const struct sockaddr *, | 175 | static int stf_output(struct ifnet *, struct mbuf *, const struct sockaddr *, | |
177 | struct rtentry *); | 176 | struct rtentry *); | |
178 | static int isrfc1918addr(const struct in_addr *); | 177 | static int isrfc1918addr(const struct in_addr *); | |
179 | static int stf_checkaddr4(struct stf_softc *, const struct in_addr *, | 178 | static int stf_checkaddr4(struct stf_softc *, const struct in_addr *, | |
180 | struct ifnet *); | 179 | struct ifnet *); | |
181 | static int stf_checkaddr6(struct stf_softc *, const struct in6_addr *, | 180 | static int stf_checkaddr6(struct stf_softc *, const struct in6_addr *, |
--- src/sys/net/raw_cb.h 2015/05/02 17:18:03 1.25
+++ src/sys/net/raw_cb.h 2016/01/20 21:43:59 1.26
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: raw_cb.h,v 1.25 2015/05/02 17:18:03 rtr Exp $ */ | 1 | /* $NetBSD: raw_cb.h,v 1.26 2016/01/20 21:43:59 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1980, 1986, 1993 | 4 | * Copyright (c) 1980, 1986, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -61,18 +61,19 @@ LIST_HEAD(rawcbhead, rawcb); | @@ -61,18 +61,19 @@ LIST_HEAD(rawcbhead, rawcb); | |||
61 | extern struct rawcbhead rawcb; /* head of list */ | 61 | extern struct rawcbhead rawcb; /* head of list */ | |
62 | 62 | |||
63 | int raw_attach(struct socket *, int); | 63 | int raw_attach(struct socket *, int); | |
64 | void *raw_ctlinput(int, const struct sockaddr *, void *); | 64 | void *raw_ctlinput(int, const struct sockaddr *, void *); | |
65 | void raw_detach(struct socket *); | 65 | void raw_detach(struct socket *); | |
66 | void raw_disconnect(struct rawcb *); | 66 | void raw_disconnect(struct rawcb *); | |
67 | void raw_init(void); | 67 | void raw_init(void); | |
68 | void raw_input(struct mbuf *, ...); | 68 | void raw_input(struct mbuf *, ...); | |
69 | int raw_usrreq(struct socket *, | 69 | int raw_usrreq(struct socket *, | |
70 | int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *); | 70 | int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *); | |
71 | void raw_setsockaddr(struct rawcb *, struct sockaddr *); | 71 | void raw_setsockaddr(struct rawcb *, struct sockaddr *); | |
72 | void raw_setpeeraddr(struct rawcb *, struct sockaddr *); | 72 | void raw_setpeeraddr(struct rawcb *, struct sockaddr *); | |
73 | int raw_send(struct socket *, | 73 | int raw_send(struct socket *, | |
74 | struct mbuf *, struct sockaddr *, struct mbuf *, struct lwp *); | 74 | struct mbuf *, struct sockaddr *, struct mbuf *, struct lwp *, | |
75 | int (*)(struct mbuf *, struct socket *)); | |||
75 | 76 | |||
76 | #endif /* _KERNEL */ | 77 | #endif /* _KERNEL */ | |
77 | 78 | |||
78 | #endif /* !_NET_RAW_CB_H_ */ | 79 | #endif /* !_NET_RAW_CB_H_ */ |
--- src/sys/net/raw_usrreq.c 2015/05/02 17:18:03 1.54
+++ src/sys/net/raw_usrreq.c 2016/01/20 21:43:59 1.55
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: raw_usrreq.c,v 1.54 2015/05/02 17:18:03 rtr Exp $ */ | 1 | /* $NetBSD: raw_usrreq.c,v 1.55 2016/01/20 21:43:59 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1980, 1986, 1993 | 4 | * Copyright (c) 1980, 1986, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -26,27 +26,27 @@ | @@ -26,27 +26,27 @@ | |||
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. | |
30 | * | 30 | * | |
31 | * @(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93 | 31 | * @(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93 | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | /* | 34 | /* | |
35 | * Raw protocol interface. | 35 | * Raw protocol interface. | |
36 | */ | 36 | */ | |
37 | 37 | |||
38 | #include <sys/cdefs.h> | 38 | #include <sys/cdefs.h> | |
39 | __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.54 2015/05/02 17:18:03 rtr Exp $"); | 39 | __KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.55 2016/01/20 21:43:59 riastradh Exp $"); | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/mbuf.h> | 42 | #include <sys/mbuf.h> | |
43 | #include <sys/domain.h> | 43 | #include <sys/domain.h> | |
44 | #include <sys/protosw.h> | 44 | #include <sys/protosw.h> | |
45 | #include <sys/socket.h> | 45 | #include <sys/socket.h> | |
46 | #include <sys/socketvar.h> | 46 | #include <sys/socketvar.h> | |
47 | #include <sys/errno.h> | 47 | #include <sys/errno.h> | |
48 | #include <sys/systm.h> | 48 | #include <sys/systm.h> | |
49 | #include <sys/proc.h> | 49 | #include <sys/proc.h> | |
50 | #include <sys/kauth.h> | 50 | #include <sys/kauth.h> | |
51 | 51 | |||
52 | #include <net/if.h> | 52 | #include <net/if.h> | |
@@ -143,27 +143,28 @@ raw_setsockaddr(struct rawcb *rp, struct | @@ -143,27 +143,28 @@ raw_setsockaddr(struct rawcb *rp, struct | |||
143 | 143 | |||
144 | memcpy(nam, rp->rcb_laddr, rp->rcb_laddr->sa_len); | 144 | memcpy(nam, rp->rcb_laddr, rp->rcb_laddr->sa_len); | |
145 | } | 145 | } | |
146 | 146 | |||
147 | void | 147 | void | |
148 | raw_setpeeraddr(struct rawcb *rp, struct sockaddr *nam) | 148 | raw_setpeeraddr(struct rawcb *rp, struct sockaddr *nam) | |
149 | { | 149 | { | |
150 | 150 | |||
151 | memcpy(nam, rp->rcb_faddr, rp->rcb_faddr->sa_len); | 151 | memcpy(nam, rp->rcb_faddr, rp->rcb_faddr->sa_len); | |
152 | } | 152 | } | |
153 | 153 | |||
154 | int | 154 | int | |
155 | raw_send(struct socket *so, struct mbuf *m, struct sockaddr *nam, | 155 | raw_send(struct socket *so, struct mbuf *m, struct sockaddr *nam, | |
156 | struct mbuf *control, struct lwp *l) | 156 | struct mbuf *control, struct lwp *l, | |
157 | int (*output)(struct mbuf *, struct socket *)) | |||
157 | { | 158 | { | |
158 | struct rawcb *rp = sotorawcb(so); | 159 | struct rawcb *rp = sotorawcb(so); | |
159 | int error = 0; | 160 | int error = 0; | |
160 | 161 | |||
161 | KASSERT(rp != NULL); | 162 | KASSERT(rp != NULL); | |
162 | 163 | |||
163 | /* | 164 | /* | |
164 | * Ship a packet out. The appropriate raw output | 165 | * Ship a packet out. The appropriate raw output | |
165 | * routine handles any massaging necessary. | 166 | * routine handles any massaging necessary. | |
166 | */ | 167 | */ | |
167 | if (control && control->m_len) { | 168 | if (control && control->m_len) { | |
168 | m_freem(control); | 169 | m_freem(control); | |
169 | m_freem(m); | 170 | m_freem(m); | |
@@ -176,27 +177,27 @@ raw_send(struct socket *so, struct mbuf | @@ -176,27 +177,27 @@ raw_send(struct socket *so, struct mbuf | |||
176 | } | 177 | } | |
177 | error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam, l); | 178 | error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam, l); | |
178 | if (error) { | 179 | if (error) { | |
179 | die: | 180 | die: | |
180 | m_freem(m); | 181 | m_freem(m); | |
181 | return error; | 182 | return error; | |
182 | } | 183 | } | |
183 | } else { | 184 | } else { | |
184 | if ((so->so_state & SS_ISCONNECTED) == 0) { | 185 | if ((so->so_state & SS_ISCONNECTED) == 0) { | |
185 | error = ENOTCONN; | 186 | error = ENOTCONN; | |
186 | goto die; | 187 | goto die; | |
187 | } | 188 | } | |
188 | } | 189 | } | |
189 | error = (*so->so_proto->pr_output)(m, so); | 190 | error = (*output)(m, so); | |
190 | if (nam) | 191 | if (nam) | |
191 | raw_disconnect(rp); | 192 | raw_disconnect(rp); | |
192 | 193 | |||
193 | return error; | 194 | return error; | |
194 | } | 195 | } | |
195 | 196 | |||
196 | int | 197 | int | |
197 | raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, | 198 | raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, | |
198 | struct mbuf *control, struct lwp *l) | 199 | struct mbuf *control, struct lwp *l) | |
199 | { | 200 | { | |
200 | 201 | |||
201 | KASSERT(req != PRU_ATTACH); | 202 | KASSERT(req != PRU_ATTACH); | |
202 | KASSERT(req != PRU_DETACH); | 203 | KASSERT(req != PRU_DETACH); |
--- src/sys/net/rtsock.c 2015/10/13 21:28:34 1.174
+++ src/sys/net/rtsock.c 2016/01/20 21:43:59 1.175
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: rtsock.c,v 1.174 2015/10/13 21:28:34 rjs Exp $ */ | 1 | /* $NetBSD: rtsock.c,v 1.175 2016/01/20 21:43:59 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -51,27 +51,27 @@ | @@ -51,27 +51,27 @@ | |||
51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
58 | * SUCH DAMAGE. | 58 | * SUCH DAMAGE. | |
59 | * | 59 | * | |
60 | * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 | 60 | * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 | |
61 | */ | 61 | */ | |
62 | 62 | |||
63 | #include <sys/cdefs.h> | 63 | #include <sys/cdefs.h> | |
64 | __KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.174 2015/10/13 21:28:34 rjs Exp $"); | 64 | __KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.175 2016/01/20 21:43:59 riastradh Exp $"); | |
65 | 65 | |||
66 | #ifdef _KERNEL_OPT | 66 | #ifdef _KERNEL_OPT | |
67 | #include "opt_inet.h" | 67 | #include "opt_inet.h" | |
68 | #include "opt_mpls.h" | 68 | #include "opt_mpls.h" | |
69 | #include "opt_compat_netbsd.h" | 69 | #include "opt_compat_netbsd.h" | |
70 | #include "opt_sctp.h" | 70 | #include "opt_sctp.h" | |
71 | #endif | 71 | #endif | |
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/proc.h> | 75 | #include <sys/proc.h> | |
76 | #include <sys/socket.h> | 76 | #include <sys/socket.h> | |
77 | #include <sys/socketvar.h> | 77 | #include <sys/socketvar.h> | |
@@ -141,40 +141,42 @@ DOMAIN_DEFINE(routedomain); /* forward d | @@ -141,40 +141,42 @@ DOMAIN_DEFINE(routedomain); /* forward d | |||
141 | #define RT_IN_PRINT(b, a) (in_print((b), sizeof(b), \ | 141 | #define RT_IN_PRINT(b, a) (in_print((b), sizeof(b), \ | |
142 | &((const struct sockaddr_in *)info.rti_info[(a)])->sin_addr), (b)) | 142 | &((const struct sockaddr_in *)info.rti_info[(a)])->sin_addr), (b)) | |
143 | #endif /* RTSOCK_DEBUG */ | 143 | #endif /* RTSOCK_DEBUG */ | |
144 | 144 | |||
145 | struct route_info COMPATNAME(route_info) = { | 145 | struct route_info COMPATNAME(route_info) = { | |
146 | .ri_dst = { .sa_len = 2, .sa_family = PF_XROUTE, }, | 146 | .ri_dst = { .sa_len = 2, .sa_family = PF_XROUTE, }, | |
147 | .ri_src = { .sa_len = 2, .sa_family = PF_XROUTE, }, | 147 | .ri_src = { .sa_len = 2, .sa_family = PF_XROUTE, }, | |
148 | .ri_maxqlen = IFQ_MAXLEN, | 148 | .ri_maxqlen = IFQ_MAXLEN, | |
149 | }; | 149 | }; | |
150 | 150 | |||
151 | #define PRESERVED_RTF (RTF_UP | RTF_GATEWAY | RTF_HOST | RTF_DONE | RTF_MASK) | 151 | #define PRESERVED_RTF (RTF_UP | RTF_GATEWAY | RTF_HOST | RTF_DONE | RTF_MASK) | |
152 | 152 | |||
153 | static void COMPATNAME(route_init)(void); | 153 | static void COMPATNAME(route_init)(void); | |
154 | static int COMPATNAME(route_output)(struct mbuf *, ...); | 154 | static int COMPATNAME(route_output)(struct mbuf *, struct socket *); | |
155 | 155 | |||
156 | static int rt_msg2(int, struct rt_addrinfo *, void *, struct rt_walkarg *, int *); | 156 | static int rt_msg2(int, struct rt_addrinfo *, void *, struct rt_walkarg *, int *); | |
157 | static int rt_xaddrs(u_char, const char *, const char *, struct rt_addrinfo *); | 157 | static int rt_xaddrs(u_char, const char *, const char *, struct rt_addrinfo *); | |
158 | static struct mbuf *rt_makeifannouncemsg(struct ifnet *, int, int, | 158 | static struct mbuf *rt_makeifannouncemsg(struct ifnet *, int, int, | |
159 | struct rt_addrinfo *); | 159 | struct rt_addrinfo *); | |
160 | static void rt_setmetrics(int, const struct rt_xmsghdr *, struct rtentry *); | 160 | static void rt_setmetrics(int, const struct rt_xmsghdr *, struct rtentry *); | |
161 | static void rtm_setmetrics(const struct rtentry *, struct rt_xmsghdr *); | 161 | static void rtm_setmetrics(const struct rtentry *, struct rt_xmsghdr *); | |
162 | static void sysctl_net_route_setup(struct sysctllog **); | 162 | static void sysctl_net_route_setup(struct sysctllog **); | |
163 | static int sysctl_dumpentry(struct rtentry *, void *); | 163 | static int sysctl_dumpentry(struct rtentry *, void *); | |
164 | static int sysctl_iflist(int, struct rt_walkarg *, int); | 164 | static int sysctl_iflist(int, struct rt_walkarg *, int); | |
165 | static int sysctl_rtable(SYSCTLFN_PROTO); | 165 | static int sysctl_rtable(SYSCTLFN_PROTO); | |
166 | static void rt_adjustcount(int, int); | 166 | static void rt_adjustcount(int, int); | |
167 | 167 | |||
168 | static const struct protosw COMPATNAME(route_protosw)[]; | |||
169 | ||||
168 | static void | 170 | static void | |
169 | rt_adjustcount(int af, int cnt) | 171 | rt_adjustcount(int af, int cnt) | |
170 | { | 172 | { | |
171 | struct route_cb * const cb = &COMPATNAME(route_info).ri_cb; | 173 | struct route_cb * const cb = &COMPATNAME(route_info).ri_cb; | |
172 | 174 | |||
173 | cb->any_count += cnt; | 175 | cb->any_count += cnt; | |
174 | 176 | |||
175 | switch (af) { | 177 | switch (af) { | |
176 | case AF_INET: | 178 | case AF_INET: | |
177 | cb->ip_count += cnt; | 179 | cb->ip_count += cnt; | |
178 | return; | 180 | return; | |
179 | #ifdef INET6 | 181 | #ifdef INET6 | |
180 | case AF_INET6: | 182 | case AF_INET6: | |
@@ -380,29 +382,30 @@ COMPATNAME(route_recvoob)(struct socket | @@ -380,29 +382,30 @@ COMPATNAME(route_recvoob)(struct socket | |||
380 | KASSERT(solocked(so)); | 382 | KASSERT(solocked(so)); | |
381 | 383 | |||
382 | return EOPNOTSUPP; | 384 | return EOPNOTSUPP; | |
383 | } | 385 | } | |
384 | 386 | |||
385 | static int | 387 | static int | |
386 | COMPATNAME(route_send)(struct socket *so, struct mbuf *m, | 388 | COMPATNAME(route_send)(struct socket *so, struct mbuf *m, | |
387 | struct sockaddr *nam, struct mbuf *control, struct lwp *l) | 389 | struct sockaddr *nam, struct mbuf *control, struct lwp *l) | |
388 | { | 390 | { | |
389 | int error = 0; | 391 | int error = 0; | |
390 | int s; | 392 | int s; | |
391 | 393 | |||
392 | KASSERT(solocked(so)); | 394 | KASSERT(solocked(so)); | |
395 | KASSERT(so->so_proto == &COMPATNAME(route_protosw)[0]); | |||
393 | 396 | |||
394 | s = splsoftnet(); | 397 | s = splsoftnet(); | |
395 | error = raw_send(so, m, nam, control, l); | 398 | error = raw_send(so, m, nam, control, l, &COMPATNAME(route_output)); | |
396 | splx(s); | 399 | splx(s); | |
397 | 400 | |||
398 | return error; | 401 | return error; | |
399 | } | 402 | } | |
400 | 403 | |||
401 | static int | 404 | static int | |
402 | COMPATNAME(route_sendoob)(struct socket *so, struct mbuf *m, | 405 | COMPATNAME(route_sendoob)(struct socket *so, struct mbuf *m, | |
403 | struct mbuf *control) | 406 | struct mbuf *control) | |
404 | { | 407 | { | |
405 | KASSERT(solocked(so)); | 408 | KASSERT(solocked(so)); | |
406 | 409 | |||
407 | m_freem(m); | 410 | m_freem(m); | |
408 | m_freem(control); | 411 | m_freem(control); | |
@@ -410,45 +413,39 @@ COMPATNAME(route_sendoob)(struct socket | @@ -410,45 +413,39 @@ COMPATNAME(route_sendoob)(struct socket | |||
410 | return EOPNOTSUPP; | 413 | return EOPNOTSUPP; | |
411 | } | 414 | } | |
412 | static int | 415 | static int | |
413 | COMPATNAME(route_purgeif)(struct socket *so, struct ifnet *ifp) | 416 | COMPATNAME(route_purgeif)(struct socket *so, struct ifnet *ifp) | |
414 | { | 417 | { | |
415 | 418 | |||
416 | panic("route_purgeif"); | 419 | panic("route_purgeif"); | |
417 | 420 | |||
418 | return EOPNOTSUPP; | 421 | return EOPNOTSUPP; | |
419 | } | 422 | } | |
420 | 423 | |||
421 | /*ARGSUSED*/ | 424 | /*ARGSUSED*/ | |
422 | int | 425 | int | |
423 | COMPATNAME(route_output)(struct mbuf *m, ...) | 426 | COMPATNAME(route_output)(struct mbuf *m, struct socket *so) | |
424 | { | 427 | { | |
425 | struct sockproto proto = { .sp_family = PF_XROUTE, }; | 428 | struct sockproto proto = { .sp_family = PF_XROUTE, }; | |
426 | struct rt_xmsghdr *rtm = NULL; | 429 | struct rt_xmsghdr *rtm = NULL; | |
427 | struct rt_xmsghdr *old_rtm = NULL; | 430 | struct rt_xmsghdr *old_rtm = NULL; | |
428 | struct rtentry *rt = NULL; | 431 | struct rtentry *rt = NULL; | |
429 | struct rtentry *saved_nrt = NULL; | 432 | struct rtentry *saved_nrt = NULL; | |
430 | struct rt_addrinfo info; | 433 | struct rt_addrinfo info; | |
431 | int len, error = 0; | 434 | int len, error = 0; | |
432 | struct ifnet *ifp = NULL; | 435 | struct ifnet *ifp = NULL; | |
433 | struct ifaddr *ifa = NULL; | 436 | struct ifaddr *ifa = NULL; | |
434 | struct socket *so; | |||
435 | va_list ap; | |||
436 | sa_family_t family; | 437 | sa_family_t family; | |
437 | 438 | |||
438 | va_start(ap, m); | |||
439 | so = va_arg(ap, struct socket *); | |||
440 | va_end(ap); | |||
441 | ||||
442 | #define senderr(e) do { error = e; goto flush;} while (/*CONSTCOND*/ 0) | 439 | #define senderr(e) do { error = e; goto flush;} while (/*CONSTCOND*/ 0) | |
443 | if (m == NULL || ((m->m_len < sizeof(int32_t)) && | 440 | if (m == NULL || ((m->m_len < sizeof(int32_t)) && | |
444 | (m = m_pullup(m, sizeof(int32_t))) == NULL)) | 441 | (m = m_pullup(m, sizeof(int32_t))) == NULL)) | |
445 | return ENOBUFS; | 442 | return ENOBUFS; | |
446 | if ((m->m_flags & M_PKTHDR) == 0) | 443 | if ((m->m_flags & M_PKTHDR) == 0) | |
447 | panic("%s", __func__); | 444 | panic("%s", __func__); | |
448 | len = m->m_pkthdr.len; | 445 | len = m->m_pkthdr.len; | |
449 | if (len < sizeof(*rtm) || | 446 | if (len < sizeof(*rtm) || | |
450 | len != mtod(m, struct rt_xmsghdr *)->rtm_msglen) { | 447 | len != mtod(m, struct rt_xmsghdr *)->rtm_msglen) { | |
451 | info.rti_info[RTAX_DST] = NULL; | 448 | info.rti_info[RTAX_DST] = NULL; | |
452 | senderr(EINVAL); | 449 | senderr(EINVAL); | |
453 | } | 450 | } | |
454 | R_Malloc(rtm, struct rt_xmsghdr *, len); | 451 | R_Malloc(rtm, struct rt_xmsghdr *, len); | |
@@ -1531,27 +1528,26 @@ static const struct pr_usrreqs route_usr | @@ -1531,27 +1528,26 @@ static const struct pr_usrreqs route_usr | |||
1531 | .pr_rcvd = COMPATNAME(route_rcvd_wrapper), | 1528 | .pr_rcvd = COMPATNAME(route_rcvd_wrapper), | |
1532 | .pr_recvoob = COMPATNAME(route_recvoob_wrapper), | 1529 | .pr_recvoob = COMPATNAME(route_recvoob_wrapper), | |
1533 | .pr_send = COMPATNAME(route_send_wrapper), | 1530 | .pr_send = COMPATNAME(route_send_wrapper), | |
1534 | .pr_sendoob = COMPATNAME(route_sendoob_wrapper), | 1531 | .pr_sendoob = COMPATNAME(route_sendoob_wrapper), | |
1535 | .pr_purgeif = COMPATNAME(route_purgeif_wrapper), | 1532 | .pr_purgeif = COMPATNAME(route_purgeif_wrapper), | |
1536 | }; | 1533 | }; | |
1537 | 1534 | |||
1538 | static const struct protosw COMPATNAME(route_protosw)[] = { | 1535 | static const struct protosw COMPATNAME(route_protosw)[] = { | |
1539 | { | 1536 | { | |
1540 | .pr_type = SOCK_RAW, | 1537 | .pr_type = SOCK_RAW, | |
1541 | .pr_domain = &COMPATNAME(routedomain), | 1538 | .pr_domain = &COMPATNAME(routedomain), | |
1542 | .pr_flags = PR_ATOMIC|PR_ADDR, | 1539 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
1543 | .pr_input = raw_input, | 1540 | .pr_input = raw_input, | |
1544 | .pr_output = COMPATNAME(route_output), | |||
1545 | .pr_ctlinput = raw_ctlinput, | 1541 | .pr_ctlinput = raw_ctlinput, | |
1546 | .pr_usrreqs = &route_usrreqs, | 1542 | .pr_usrreqs = &route_usrreqs, | |
1547 | .pr_init = raw_init, | 1543 | .pr_init = raw_init, | |
1548 | }, | 1544 | }, | |
1549 | }; | 1545 | }; | |
1550 | 1546 | |||
1551 | struct domain COMPATNAME(routedomain) = { | 1547 | struct domain COMPATNAME(routedomain) = { | |
1552 | .dom_family = PF_XROUTE, | 1548 | .dom_family = PF_XROUTE, | |
1553 | .dom_name = DOMAINNAME, | 1549 | .dom_name = DOMAINNAME, | |
1554 | .dom_init = COMPATNAME(route_init), | 1550 | .dom_init = COMPATNAME(route_init), | |
1555 | .dom_protosw = COMPATNAME(route_protosw), | 1551 | .dom_protosw = COMPATNAME(route_protosw), | |
1556 | .dom_protoswNPROTOSW = | 1552 | .dom_protoswNPROTOSW = | |
1557 | &COMPATNAME(route_protosw)[__arraycount(COMPATNAME(route_protosw))], | 1553 | &COMPATNAME(route_protosw)[__arraycount(COMPATNAME(route_protosw))], |
--- src/sys/netatalk/at_proto.c 2014/05/18 14:46:16 1.18
+++ src/sys/netatalk/at_proto.c 2016/01/20 21:43:59 1.19
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: at_proto.c,v 1.18 2014/05/18 14:46:16 rmind Exp $ */ | 1 | /* $NetBSD: at_proto.c,v 1.19 2016/01/20 21:43:59 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1990,1991 Regents of The University of Michigan. | 4 | * Copyright (c) 1990,1991 Regents of The University of Michigan. | |
5 | * All Rights Reserved. | 5 | * All Rights Reserved. | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software and | 7 | * Permission to use, copy, modify, and distribute this software and | |
8 | * its documentation for any purpose and without fee is hereby granted, | 8 | * its documentation for any purpose and without fee is hereby granted, | |
9 | * provided that the above copyright notice appears in all copies and | 9 | * provided that the above copyright notice appears in all copies and | |
10 | * that both that copyright notice and this permission notice appear | 10 | * that both that copyright notice and this permission notice appear | |
11 | * in supporting documentation, and that the name of The University | 11 | * in supporting documentation, and that the name of The University | |
12 | * of Michigan not be used in advertising or publicity pertaining to | 12 | * of Michigan not be used in advertising or publicity pertaining to | |
13 | * distribution of the software without specific, written prior | 13 | * distribution of the software without specific, written prior | |
14 | * permission. This software is supplied as is without expressed or | 14 | * permission. This software is supplied as is without expressed or | |
@@ -17,27 +17,27 @@ | @@ -17,27 +17,27 @@ | |||
17 | * This product includes software developed by the University of | 17 | * This product includes software developed by the University of | |
18 | * California, Berkeley and its contributors. | 18 | * California, Berkeley and its contributors. | |
19 | * | 19 | * | |
20 | * Research Systems Unix Group | 20 | * Research Systems Unix Group | |
21 | * The University of Michigan | 21 | * The University of Michigan | |
22 | * c/o Wesley Craig | 22 | * c/o Wesley Craig | |
23 | * 535 W. William Street | 23 | * 535 W. William Street | |
24 | * Ann Arbor, Michigan | 24 | * Ann Arbor, Michigan | |
25 | * +1-313-764-2278 | 25 | * +1-313-764-2278 | |
26 | * netatalk@umich.edu | 26 | * netatalk@umich.edu | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include <sys/cdefs.h> | 29 | #include <sys/cdefs.h> | |
30 | __KERNEL_RCSID(0, "$NetBSD: at_proto.c,v 1.18 2014/05/18 14:46:16 rmind Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: at_proto.c,v 1.19 2016/01/20 21:43:59 riastradh Exp $"); | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/systm.h> | 33 | #include <sys/systm.h> | |
34 | #include <sys/protosw.h> | 34 | #include <sys/protosw.h> | |
35 | #include <sys/domain.h> | 35 | #include <sys/domain.h> | |
36 | #include <sys/socket.h> | 36 | #include <sys/socket.h> | |
37 | 37 | |||
38 | #include <sys/kernel.h> | 38 | #include <sys/kernel.h> | |
39 | #include <net/if.h> | 39 | #include <net/if.h> | |
40 | #include <net/if_ether.h> | 40 | #include <net/if_ether.h> | |
41 | #include <netinet/in.h> | 41 | #include <netinet/in.h> | |
42 | #include <net/route.h> | 42 | #include <net/route.h> | |
43 | 43 | |||
@@ -45,27 +45,26 @@ __KERNEL_RCSID(0, "$NetBSD: at_proto.c,v | @@ -45,27 +45,26 @@ __KERNEL_RCSID(0, "$NetBSD: at_proto.c,v | |||
45 | #include <netatalk/ddp.h> | 45 | #include <netatalk/ddp.h> | |
46 | #include <netatalk/at_var.h> | 46 | #include <netatalk/at_var.h> | |
47 | #include <netatalk/ddp_var.h> | 47 | #include <netatalk/ddp_var.h> | |
48 | #include <netatalk/at_extern.h> | 48 | #include <netatalk/at_extern.h> | |
49 | 49 | |||
50 | DOMAIN_DEFINE(atalkdomain); /* forward declare and add to link set */ | 50 | DOMAIN_DEFINE(atalkdomain); /* forward declare and add to link set */ | |
51 | 51 | |||
52 | const struct protosw atalksw[] = { | 52 | const struct protosw atalksw[] = { | |
53 | { | 53 | { | |
54 | .pr_type = SOCK_DGRAM, | 54 | .pr_type = SOCK_DGRAM, | |
55 | .pr_domain = &atalkdomain, | 55 | .pr_domain = &atalkdomain, | |
56 | .pr_protocol = ATPROTO_DDP, | 56 | .pr_protocol = ATPROTO_DDP, | |
57 | .pr_flags = PR_ATOMIC|PR_ADDR, | 57 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
58 | .pr_output = ddp_output, | |||
59 | .pr_usrreqs = &ddp_usrreqs, | 58 | .pr_usrreqs = &ddp_usrreqs, | |
60 | .pr_init = ddp_init, | 59 | .pr_init = ddp_init, | |
61 | }, | 60 | }, | |
62 | }; | 61 | }; | |
63 | 62 | |||
64 | struct domain atalkdomain = { | 63 | struct domain atalkdomain = { | |
65 | .dom_family = PF_APPLETALK, | 64 | .dom_family = PF_APPLETALK, | |
66 | .dom_name = "appletalk", | 65 | .dom_name = "appletalk", | |
67 | .dom_init = NULL, | 66 | .dom_init = NULL, | |
68 | .dom_externalize = NULL, | 67 | .dom_externalize = NULL, | |
69 | .dom_dispose = NULL, | 68 | .dom_dispose = NULL, | |
70 | .dom_protosw = atalksw, | 69 | .dom_protosw = atalksw, | |
71 | .dom_protoswNPROTOSW = &atalksw[__arraycount(atalksw)], | 70 | .dom_protoswNPROTOSW = &atalksw[__arraycount(atalksw)], |
--- src/sys/netinet/if_arp.c 2016/01/05 05:37:06 1.199
+++ src/sys/netinet/if_arp.c 2016/01/20 21:43:59 1.200
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_arp.c,v 1.199 2016/01/05 05:37:06 ozaki-r Exp $ */ | 1 | /* $NetBSD: if_arp.c,v 1.200 2016/01/20 21:43:59 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Public Access Networks Corporation ("Panix"). It was developed under | 8 | * by Public Access Networks Corporation ("Panix"). It was developed under | |
9 | * contract to Panix by Eric Haszlakiewicz and Thor Lancelot Simon. | 9 | * contract to Panix by Eric Haszlakiewicz and Thor Lancelot Simon. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -58,27 +58,27 @@ | @@ -58,27 +58,27 @@ | |||
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 | * @(#)if_ether.c 8.2 (Berkeley) 9/26/94 | 61 | * @(#)if_ether.c 8.2 (Berkeley) 9/26/94 | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | /* | 64 | /* | |
65 | * Ethernet address resolution protocol. | 65 | * Ethernet address resolution protocol. | |
66 | * TODO: | 66 | * TODO: | |
67 | * add "inuse/lock" bit (or ref. count) along with valid bit | 67 | * add "inuse/lock" bit (or ref. count) along with valid bit | |
68 | */ | 68 | */ | |
69 | 69 | |||
70 | #include <sys/cdefs.h> | 70 | #include <sys/cdefs.h> | |
71 | __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.199 2016/01/05 05:37:06 ozaki-r Exp $"); | 71 | __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.200 2016/01/20 21:43:59 riastradh Exp $"); | |
72 | 72 | |||
73 | #ifdef _KERNEL_OPT | 73 | #ifdef _KERNEL_OPT | |
74 | #include "opt_ddb.h" | 74 | #include "opt_ddb.h" | |
75 | #include "opt_inet.h" | 75 | #include "opt_inet.h" | |
76 | #endif | 76 | #endif | |
77 | 77 | |||
78 | #ifdef INET | 78 | #ifdef INET | |
79 | 79 | |||
80 | #include "bridge.h" | 80 | #include "bridge.h" | |
81 | 81 | |||
82 | #include <sys/param.h> | 82 | #include <sys/param.h> | |
83 | #include <sys/systm.h> | 83 | #include <sys/systm.h> | |
84 | #include <sys/callout.h> | 84 | #include <sys/callout.h> | |
@@ -260,27 +260,26 @@ arp_fasttimo(void) | @@ -260,27 +260,26 @@ arp_fasttimo(void) | |||
260 | { | 260 | { | |
261 | if (arp_drainwanted) { | 261 | if (arp_drainwanted) { | |
262 | arp_drain(); | 262 | arp_drain(); | |
263 | arp_drainwanted = 0; | 263 | arp_drainwanted = 0; | |
264 | } | 264 | } | |
265 | } | 265 | } | |
266 | 266 | |||
267 | const struct protosw arpsw[] = { | 267 | const struct protosw arpsw[] = { | |
268 | { .pr_type = 0, | 268 | { .pr_type = 0, | |
269 | .pr_domain = &arpdomain, | 269 | .pr_domain = &arpdomain, | |
270 | .pr_protocol = 0, | 270 | .pr_protocol = 0, | |
271 | .pr_flags = 0, | 271 | .pr_flags = 0, | |
272 | .pr_input = 0, | 272 | .pr_input = 0, | |
273 | .pr_output = 0, | |||
274 | .pr_ctlinput = 0, | 273 | .pr_ctlinput = 0, | |
275 | .pr_ctloutput = 0, | 274 | .pr_ctloutput = 0, | |
276 | .pr_usrreqs = 0, | 275 | .pr_usrreqs = 0, | |
277 | .pr_init = arp_init, | 276 | .pr_init = arp_init, | |
278 | .pr_fasttimo = arp_fasttimo, | 277 | .pr_fasttimo = arp_fasttimo, | |
279 | .pr_slowtimo = 0, | 278 | .pr_slowtimo = 0, | |
280 | .pr_drain = arp_drainstub, | 279 | .pr_drain = arp_drainstub, | |
281 | } | 280 | } | |
282 | }; | 281 | }; | |
283 | 282 | |||
284 | struct domain arpdomain = { | 283 | struct domain arpdomain = { | |
285 | .dom_family = PF_ARP, | 284 | .dom_family = PF_ARP, | |
286 | .dom_name = "arp", | 285 | .dom_name = "arp", |
--- src/sys/netinet/in_gif.c 2016/01/18 06:08:26 1.68
+++ src/sys/netinet/in_gif.c 2016/01/20 21:43:59 1.69
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: in_gif.c,v 1.68 2016/01/18 06:08:26 knakahara Exp $ */ | 1 | /* $NetBSD: in_gif.c,v 1.69 2016/01/20 21:43:59 riastradh Exp $ */ | |
2 | /* $KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $ */ | 2 | /* $KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 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 | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | * SUCH DAMAGE. | 30 | * SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.68 2016/01/18 06:08:26 knakahara Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.69 2016/01/20 21:43:59 riastradh Exp $"); | |
35 | 35 | |||
36 | #ifdef _KERNEL_OPT | 36 | #ifdef _KERNEL_OPT | |
37 | #include "opt_inet.h" | 37 | #include "opt_inet.h" | |
38 | #endif | 38 | #endif | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/socket.h> | 42 | #include <sys/socket.h> | |
43 | #include <sys/sockio.h> | 43 | #include <sys/sockio.h> | |
44 | #include <sys/mbuf.h> | 44 | #include <sys/mbuf.h> | |
45 | #include <sys/errno.h> | 45 | #include <sys/errno.h> | |
46 | #include <sys/ioctl.h> | 46 | #include <sys/ioctl.h> | |
47 | #include <sys/syslog.h> | 47 | #include <sys/syslog.h> | |
@@ -75,27 +75,26 @@ static int gif_validate4(const struct ip | @@ -75,27 +75,26 @@ static int gif_validate4(const struct ip | |||
75 | 75 | |||
76 | #if NGIF > 0 | 76 | #if NGIF > 0 | |
77 | int ip_gif_ttl = GIF_TTL; | 77 | int ip_gif_ttl = GIF_TTL; | |
78 | #else | 78 | #else | |
79 | int ip_gif_ttl = 0; | 79 | int ip_gif_ttl = 0; | |
80 | #endif | 80 | #endif | |
81 | 81 | |||
82 | static const struct protosw in_gif_protosw = { | 82 | static const struct protosw in_gif_protosw = { | |
83 | .pr_type = SOCK_RAW, | 83 | .pr_type = SOCK_RAW, | |
84 | .pr_domain = &inetdomain, | 84 | .pr_domain = &inetdomain, | |
85 | .pr_protocol = 0 /* IPPROTO_IPV[46] */, | 85 | .pr_protocol = 0 /* IPPROTO_IPV[46] */, | |
86 | .pr_flags = PR_ATOMIC|PR_ADDR, | 86 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
87 | .pr_input = in_gif_input, | 87 | .pr_input = in_gif_input, | |
88 | .pr_output = rip_output, | |||
89 | .pr_ctlinput = NULL, | 88 | .pr_ctlinput = NULL, | |
90 | .pr_ctloutput = rip_ctloutput, | 89 | .pr_ctloutput = rip_ctloutput, | |
91 | .pr_usrreqs = &rip_usrreqs, | 90 | .pr_usrreqs = &rip_usrreqs, | |
92 | }; | 91 | }; | |
93 | 92 | |||
94 | int | 93 | int | |
95 | in_gif_output(struct ifnet *ifp, int family, struct mbuf *m) | 94 | in_gif_output(struct ifnet *ifp, int family, struct mbuf *m) | |
96 | { | 95 | { | |
97 | struct rtentry *rt; | 96 | struct rtentry *rt; | |
98 | struct gif_softc *sc = ifp->if_softc; | 97 | struct gif_softc *sc = ifp->if_softc; | |
99 | struct sockaddr_in *sin_src = satosin(sc->gif_psrc); | 98 | struct sockaddr_in *sin_src = satosin(sc->gif_psrc); | |
100 | struct sockaddr_in *sin_dst = satosin(sc->gif_pdst); | 99 | struct sockaddr_in *sin_dst = satosin(sc->gif_pdst); | |
101 | struct ip iphdr; /* capsule IP header, host byte ordered */ | 100 | struct ip iphdr; /* capsule IP header, host byte ordered */ |
--- src/sys/netinet/in_proto.c 2015/10/13 21:28:35 1.115
+++ src/sys/netinet/in_proto.c 2016/01/20 21:43:59 1.116
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: in_proto.c,v 1.115 2015/10/13 21:28:35 rjs Exp $ */ | 1 | /* $NetBSD: in_proto.c,v 1.116 2016/01/20 21:43:59 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -51,27 +51,27 @@ | @@ -51,27 +51,27 @@ | |||
51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
58 | * SUCH DAMAGE. | 58 | * SUCH DAMAGE. | |
59 | * | 59 | * | |
60 | * @(#)in_proto.c 8.2 (Berkeley) 2/9/95 | 60 | * @(#)in_proto.c 8.2 (Berkeley) 2/9/95 | |
61 | */ | 61 | */ | |
62 | 62 | |||
63 | #include <sys/cdefs.h> | 63 | #include <sys/cdefs.h> | |
64 | __KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.115 2015/10/13 21:28:35 rjs Exp $"); | 64 | __KERNEL_RCSID(0, "$NetBSD: in_proto.c,v 1.116 2016/01/20 21:43:59 riastradh Exp $"); | |
65 | 65 | |||
66 | #ifdef _KERNEL_OPT | 66 | #ifdef _KERNEL_OPT | |
67 | #include "opt_mrouting.h" | 67 | #include "opt_mrouting.h" | |
68 | #include "opt_inet.h" | 68 | #include "opt_inet.h" | |
69 | #include "opt_ipsec.h" | 69 | #include "opt_ipsec.h" | |
70 | #include "opt_pim.h" | 70 | #include "opt_pim.h" | |
71 | #include "opt_gateway.h" | 71 | #include "opt_gateway.h" | |
72 | #include "opt_dccp.h" | 72 | #include "opt_dccp.h" | |
73 | #include "opt_sctp.h" | 73 | #include "opt_sctp.h" | |
74 | #include "opt_compat_netbsd.h" | 74 | #include "opt_compat_netbsd.h" | |
75 | #endif | 75 | #endif | |
76 | 76 | |||
77 | #include <sys/param.h> | 77 | #include <sys/param.h> | |
@@ -189,27 +189,26 @@ PR_WRAP_CTLOUTPUT(sctp_ctloutput) | @@ -189,27 +189,26 @@ PR_WRAP_CTLOUTPUT(sctp_ctloutput) | |||
189 | 189 | |||
190 | #if defined(IPSEC) | 190 | #if defined(IPSEC) | |
191 | PR_WRAP_CTLINPUT(ah4_ctlinput) | 191 | PR_WRAP_CTLINPUT(ah4_ctlinput) | |
192 | 192 | |||
193 | #define ah4_ctlinput ah4_ctlinput_wrapper | 193 | #define ah4_ctlinput ah4_ctlinput_wrapper | |
194 | PR_WRAP_CTLINPUT(esp4_ctlinput) | 194 | PR_WRAP_CTLINPUT(esp4_ctlinput) | |
195 | 195 | |||
196 | #define esp4_ctlinput esp4_ctlinput_wrapper | 196 | #define esp4_ctlinput esp4_ctlinput_wrapper | |
197 | #endif | 197 | #endif | |
198 | 198 | |||
199 | const struct protosw inetsw[] = { | 199 | const struct protosw inetsw[] = { | |
200 | { .pr_domain = &inetdomain, | 200 | { .pr_domain = &inetdomain, | |
201 | .pr_init = ip_init, | 201 | .pr_init = ip_init, | |
202 | .pr_output = ip_output, | |||
203 | .pr_fasttimo = ip_fasttimo, | 202 | .pr_fasttimo = ip_fasttimo, | |
204 | .pr_slowtimo = ip_slowtimo, | 203 | .pr_slowtimo = ip_slowtimo, | |
205 | .pr_drain = ip_drainstub, | 204 | .pr_drain = ip_drainstub, | |
206 | }, | 205 | }, | |
207 | { .pr_type = SOCK_DGRAM, | 206 | { .pr_type = SOCK_DGRAM, | |
208 | .pr_domain = &inetdomain, | 207 | .pr_domain = &inetdomain, | |
209 | .pr_protocol = IPPROTO_UDP, | 208 | .pr_protocol = IPPROTO_UDP, | |
210 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF, | 209 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF, | |
211 | .pr_input = udp_input, | 210 | .pr_input = udp_input, | |
212 | .pr_ctlinput = udp_ctlinput, | 211 | .pr_ctlinput = udp_ctlinput, | |
213 | .pr_ctloutput = udp_ctloutput, | 212 | .pr_ctloutput = udp_ctloutput, | |
214 | .pr_usrreqs = &udp_usrreqs, | 213 | .pr_usrreqs = &udp_usrreqs, | |
215 | .pr_init = udp_init, | 214 | .pr_init = udp_init, | |
@@ -266,37 +265,35 @@ const struct protosw inetsw[] = { | @@ -266,37 +265,35 @@ const struct protosw inetsw[] = { | |||
266 | .pr_flags = PR_CONNREQUIRED|PR_ADDR_OPT|PR_WANTRCVD|PR_LISTEN, | 265 | .pr_flags = PR_CONNREQUIRED|PR_ADDR_OPT|PR_WANTRCVD|PR_LISTEN, | |
267 | .pr_input = sctp_input, | 266 | .pr_input = sctp_input, | |
268 | .pr_ctlinput = sctp_ctlinput, | 267 | .pr_ctlinput = sctp_ctlinput, | |
269 | .pr_ctloutput = sctp_ctloutput, | 268 | .pr_ctloutput = sctp_ctloutput, | |
270 | .pr_usrreqs = &sctp_usrreqs, | 269 | .pr_usrreqs = &sctp_usrreqs, | |
271 | .pr_drain = sctp_drain | 270 | .pr_drain = sctp_drain | |
272 | }, | 271 | }, | |
273 | #endif /* SCTP */ | 272 | #endif /* SCTP */ | |
274 | { .pr_type = SOCK_RAW, | 273 | { .pr_type = SOCK_RAW, | |
275 | .pr_domain = &inetdomain, | 274 | .pr_domain = &inetdomain, | |
276 | .pr_protocol = IPPROTO_RAW, | 275 | .pr_protocol = IPPROTO_RAW, | |
277 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF, | 276 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF, | |
278 | .pr_input = rip_input, | 277 | .pr_input = rip_input, | |
279 | .pr_output = rip_output, | |||
280 | .pr_ctlinput = rip_ctlinput, | 278 | .pr_ctlinput = rip_ctlinput, | |
281 | .pr_ctloutput = rip_ctloutput, | 279 | .pr_ctloutput = rip_ctloutput, | |
282 | .pr_usrreqs = &rip_usrreqs, | 280 | .pr_usrreqs = &rip_usrreqs, | |
283 | }, | 281 | }, | |
284 | { .pr_type = SOCK_RAW, | 282 | { .pr_type = SOCK_RAW, | |
285 | .pr_domain = &inetdomain, | 283 | .pr_domain = &inetdomain, | |
286 | .pr_protocol = IPPROTO_ICMP, | 284 | .pr_protocol = IPPROTO_ICMP, | |
287 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 285 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
288 | .pr_input = icmp_input, | 286 | .pr_input = icmp_input, | |
289 | .pr_output = rip_output, | |||
290 | .pr_ctlinput = rip_ctlinput, | 287 | .pr_ctlinput = rip_ctlinput, | |
291 | .pr_ctloutput = rip_ctloutput, | 288 | .pr_ctloutput = rip_ctloutput, | |
292 | .pr_usrreqs = &rip_usrreqs, | 289 | .pr_usrreqs = &rip_usrreqs, | |
293 | .pr_init = icmp_init, | 290 | .pr_init = icmp_init, | |
294 | }, | 291 | }, | |
295 | #ifdef GATEWAY | 292 | #ifdef GATEWAY | |
296 | { .pr_domain = &inetdomain, | 293 | { .pr_domain = &inetdomain, | |
297 | .pr_protocol = IPPROTO_IP, | 294 | .pr_protocol = IPPROTO_IP, | |
298 | .pr_slowtimo = ipflow_slowtimo, | 295 | .pr_slowtimo = ipflow_slowtimo, | |
299 | .pr_init = ipflow_poolinit, | 296 | .pr_init = ipflow_poolinit, | |
300 | }, | 297 | }, | |
301 | #endif /* GATEWAY */ | 298 | #endif /* GATEWAY */ | |
302 | #ifdef IPSEC | 299 | #ifdef IPSEC | |
@@ -316,111 +313,103 @@ const struct protosw inetsw[] = { | @@ -316,111 +313,103 @@ const struct protosw inetsw[] = { | |||
316 | }, | 313 | }, | |
317 | { .pr_type = SOCK_RAW, | 314 | { .pr_type = SOCK_RAW, | |
318 | .pr_domain = &inetdomain, | 315 | .pr_domain = &inetdomain, | |
319 | .pr_protocol = IPPROTO_IPCOMP, | 316 | .pr_protocol = IPPROTO_IPCOMP, | |
320 | .pr_flags = PR_ATOMIC|PR_ADDR, | 317 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
321 | .pr_input = ipsec4_common_input, | 318 | .pr_input = ipsec4_common_input, | |
322 | }, | 319 | }, | |
323 | #endif /* IPSEC */ | 320 | #endif /* IPSEC */ | |
324 | { .pr_type = SOCK_RAW, | 321 | { .pr_type = SOCK_RAW, | |
325 | .pr_domain = &inetdomain, | 322 | .pr_domain = &inetdomain, | |
326 | .pr_protocol = IPPROTO_IPV4, | 323 | .pr_protocol = IPPROTO_IPV4, | |
327 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 324 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
328 | .pr_input = encap4_input, | 325 | .pr_input = encap4_input, | |
329 | .pr_output = rip_output, | |||
330 | .pr_ctlinput = rip_ctlinput, | 326 | .pr_ctlinput = rip_ctlinput, | |
331 | .pr_ctloutput = rip_ctloutput, | 327 | .pr_ctloutput = rip_ctloutput, | |
332 | .pr_usrreqs = &rip_usrreqs, | 328 | .pr_usrreqs = &rip_usrreqs, | |
333 | .pr_init = encap_init, | 329 | .pr_init = encap_init, | |
334 | }, | 330 | }, | |
335 | #ifdef INET6 | 331 | #ifdef INET6 | |
336 | { .pr_type = SOCK_RAW, | 332 | { .pr_type = SOCK_RAW, | |
337 | .pr_domain = &inetdomain, | 333 | .pr_domain = &inetdomain, | |
338 | .pr_protocol = IPPROTO_IPV6, | 334 | .pr_protocol = IPPROTO_IPV6, | |
339 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 335 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
340 | .pr_input = encap4_input, | 336 | .pr_input = encap4_input, | |
341 | .pr_output = rip_output, | |||
342 | .pr_ctlinput = rip_ctlinput, | 337 | .pr_ctlinput = rip_ctlinput, | |
343 | .pr_ctloutput = rip_ctloutput, | 338 | .pr_ctloutput = rip_ctloutput, | |
344 | .pr_usrreqs = &rip_usrreqs, | 339 | .pr_usrreqs = &rip_usrreqs, | |
345 | .pr_init = encap_init, | 340 | .pr_init = encap_init, | |
346 | }, | 341 | }, | |
347 | #endif /* INET6 */ | 342 | #endif /* INET6 */ | |
348 | #if NETHERIP > 0 | 343 | #if NETHERIP > 0 | |
349 | { .pr_type = SOCK_RAW, | 344 | { .pr_type = SOCK_RAW, | |
350 | .pr_domain = &inetdomain, | 345 | .pr_domain = &inetdomain, | |
351 | .pr_protocol = IPPROTO_ETHERIP, | 346 | .pr_protocol = IPPROTO_ETHERIP, | |
352 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 347 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
353 | .pr_input = ip_etherip_input, | 348 | .pr_input = ip_etherip_input, | |
354 | .pr_output = rip_output, | |||
355 | .pr_ctlinput = rip_ctlinput, | 349 | .pr_ctlinput = rip_ctlinput, | |
356 | .pr_ctloutput = rip_ctloutput, | 350 | .pr_ctloutput = rip_ctloutput, | |
357 | .pr_usrreqs = &rip_usrreqs, | 351 | .pr_usrreqs = &rip_usrreqs, | |
358 | }, | 352 | }, | |
359 | #endif /* NETHERIP > 0 */ | 353 | #endif /* NETHERIP > 0 */ | |
360 | #if NCARP > 0 | 354 | #if NCARP > 0 | |
361 | { .pr_type = SOCK_RAW, | 355 | { .pr_type = SOCK_RAW, | |
362 | .pr_domain = &inetdomain, | 356 | .pr_domain = &inetdomain, | |
363 | .pr_protocol = IPPROTO_CARP, | 357 | .pr_protocol = IPPROTO_CARP, | |
364 | .pr_flags = PR_ATOMIC|PR_ADDR, | 358 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
365 | .pr_input = carp_proto_input, | 359 | .pr_input = carp_proto_input, | |
366 | .pr_output = rip_output, | |||
367 | .pr_ctloutput = rip_ctloutput, | 360 | .pr_ctloutput = rip_ctloutput, | |
368 | .pr_usrreqs = &rip_usrreqs, | 361 | .pr_usrreqs = &rip_usrreqs, | |
369 | .pr_init = carp_init, | 362 | .pr_init = carp_init, | |
370 | }, | 363 | }, | |
371 | #endif /* NCARP > 0 */ | 364 | #endif /* NCARP > 0 */ | |
372 | #if NPFSYNC > 0 | 365 | #if NPFSYNC > 0 | |
373 | { .pr_type = SOCK_RAW, | 366 | { .pr_type = SOCK_RAW, | |
374 | .pr_domain = &inetdomain, | 367 | .pr_domain = &inetdomain, | |
375 | .pr_protocol = IPPROTO_PFSYNC, | 368 | .pr_protocol = IPPROTO_PFSYNC, | |
376 | .pr_flags = PR_ATOMIC|PR_ADDR, | 369 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
377 | .pr_input = pfsync_input, | 370 | .pr_input = pfsync_input, | |
378 | .pr_output = rip_output, | |||
379 | .pr_ctloutput = rip_ctloutput, | 371 | .pr_ctloutput = rip_ctloutput, | |
380 | .pr_usrreqs = &rip_usrreqs, | 372 | .pr_usrreqs = &rip_usrreqs, | |
381 | }, | 373 | }, | |
382 | #endif /* NPFSYNC > 0 */ | 374 | #endif /* NPFSYNC > 0 */ | |
383 | { .pr_type = SOCK_RAW, | 375 | { .pr_type = SOCK_RAW, | |
384 | .pr_domain = &inetdomain, | 376 | .pr_domain = &inetdomain, | |
385 | .pr_protocol = IPPROTO_IGMP, | 377 | .pr_protocol = IPPROTO_IGMP, | |
386 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 378 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
387 | .pr_input = igmp_input, | 379 | .pr_input = igmp_input, | |
388 | .pr_output = rip_output, | |||
389 | .pr_ctloutput = rip_ctloutput, | 380 | .pr_ctloutput = rip_ctloutput, | |
390 | .pr_ctlinput = rip_ctlinput, | 381 | .pr_ctlinput = rip_ctlinput, | |
391 | .pr_usrreqs = &rip_usrreqs, | 382 | .pr_usrreqs = &rip_usrreqs, | |
392 | .pr_fasttimo = igmp_fasttimo, | 383 | .pr_fasttimo = igmp_fasttimo, | |
393 | .pr_slowtimo = igmp_slowtimo, | 384 | .pr_slowtimo = igmp_slowtimo, | |
394 | .pr_init = igmp_init, | 385 | .pr_init = igmp_init, | |
395 | }, | 386 | }, | |
396 | #ifdef PIM | 387 | #ifdef PIM | |
397 | { .pr_type = SOCK_RAW, | 388 | { .pr_type = SOCK_RAW, | |
398 | .pr_domain = &inetdomain, | 389 | .pr_domain = &inetdomain, | |
399 | .pr_protocol = IPPROTO_PIM, | 390 | .pr_protocol = IPPROTO_PIM, | |
400 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 391 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
401 | .pr_input = pim_input, | 392 | .pr_input = pim_input, | |
402 | .pr_output = rip_output, | |||
403 | .pr_ctloutput = rip_ctloutput, | 393 | .pr_ctloutput = rip_ctloutput, | |
404 | .pr_ctlinput = rip_ctlinput, | 394 | .pr_ctlinput = rip_ctlinput, | |
405 | .pr_usrreqs = &rip_usrreqs, | 395 | .pr_usrreqs = &rip_usrreqs, | |
406 | }, | 396 | }, | |
407 | #endif /* PIM */ | 397 | #endif /* PIM */ | |
408 | /* raw wildcard */ | 398 | /* raw wildcard */ | |
409 | { .pr_type = SOCK_RAW, | 399 | { .pr_type = SOCK_RAW, | |
410 | .pr_domain = &inetdomain, | 400 | .pr_domain = &inetdomain, | |
411 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 401 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
412 | .pr_input = rip_input, | 402 | .pr_input = rip_input, | |
413 | .pr_output = rip_output, | |||
414 | .pr_ctloutput = rip_ctloutput, | 403 | .pr_ctloutput = rip_ctloutput, | |
415 | .pr_ctlinput = rip_ctlinput, | 404 | .pr_ctlinput = rip_ctlinput, | |
416 | .pr_usrreqs = &rip_usrreqs, | 405 | .pr_usrreqs = &rip_usrreqs, | |
417 | .pr_init = rip_init, | 406 | .pr_init = rip_init, | |
418 | }, | 407 | }, | |
419 | }; | 408 | }; | |
420 | 409 | |||
421 | const struct sockaddr_in in_any = { | 410 | const struct sockaddr_in in_any = { | |
422 | .sin_len = sizeof(struct sockaddr_in) | 411 | .sin_len = sizeof(struct sockaddr_in) | |
423 | , .sin_family = AF_INET | 412 | , .sin_family = AF_INET | |
424 | , .sin_port = 0 | 413 | , .sin_port = 0 | |
425 | , .sin_addr = {.s_addr = 0 /* INADDR_ANY */} | 414 | , .sin_addr = {.s_addr = 0 /* INADDR_ANY */} | |
426 | }; | 415 | }; |
--- src/sys/netinet/ip_mroute.c 2016/01/17 15:08:10 1.133
+++ src/sys/netinet/ip_mroute.c 2016/01/20 21:43:59 1.134
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip_mroute.c,v 1.133 2016/01/17 15:08:10 christos Exp $ */ | 1 | /* $NetBSD: ip_mroute.c,v 1.134 2016/01/20 21:43:59 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1992, 1993 | 4 | * Copyright (c) 1992, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Stephen Deering of Stanford University. | 8 | * Stephen Deering of Stanford University. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -83,27 +83,27 @@ | @@ -83,27 +83,27 @@ | |||
83 | * Modified by Charles M. Hannum, NetBSD, May 1995. | 83 | * Modified by Charles M. Hannum, NetBSD, May 1995. | |
84 | * Modified by Ahmed Helmy, SGI, June 1996 | 84 | * Modified by Ahmed Helmy, SGI, June 1996 | |
85 | * Modified by George Edmond Eddy (Rusty), ISI, February 1998 | 85 | * Modified by George Edmond Eddy (Rusty), ISI, February 1998 | |
86 | * Modified by Pavlin Radoslavov, USC/ISI, May 1998, August 1999, October 2000 | 86 | * Modified by Pavlin Radoslavov, USC/ISI, May 1998, August 1999, October 2000 | |
87 | * Modified by Hitoshi Asaeda, WIDE, August 2000 | 87 | * Modified by Hitoshi Asaeda, WIDE, August 2000 | |
88 | * Modified by Pavlin Radoslavov, ICSI, October 2002 | 88 | * Modified by Pavlin Radoslavov, ICSI, October 2002 | |
89 | * | 89 | * | |
90 | * MROUTING Revision: 1.2 | 90 | * MROUTING Revision: 1.2 | |
91 | * and PIM-SMv2 and PIM-DM support, advanced API support, | 91 | * and PIM-SMv2 and PIM-DM support, advanced API support, | |
92 | * bandwidth metering and signaling | 92 | * bandwidth metering and signaling | |
93 | */ | 93 | */ | |
94 | 94 | |||
95 | #include <sys/cdefs.h> | 95 | #include <sys/cdefs.h> | |
96 | __KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.133 2016/01/17 15:08:10 christos Exp $"); | 96 | __KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.134 2016/01/20 21:43:59 riastradh Exp $"); | |
97 | 97 | |||
98 | #ifdef _KERNEL_OPT | 98 | #ifdef _KERNEL_OPT | |
99 | #include "opt_inet.h" | 99 | #include "opt_inet.h" | |
100 | #include "opt_ipsec.h" | 100 | #include "opt_ipsec.h" | |
101 | #include "opt_pim.h" | 101 | #include "opt_pim.h" | |
102 | #endif | 102 | #endif | |
103 | 103 | |||
104 | #ifdef PIM | 104 | #ifdef PIM | |
105 | #define _PIM_VT 1 | 105 | #define _PIM_VT 1 | |
106 | #endif | 106 | #endif | |
107 | 107 | |||
108 | #include <sys/param.h> | 108 | #include <sys/param.h> | |
109 | #include <sys/systm.h> | 109 | #include <sys/systm.h> | |
@@ -189,27 +189,26 @@ extern int rsvp_on; | @@ -189,27 +189,26 @@ extern int rsvp_on; | |||
189 | #define RSVP_DPRINTF(a) do {} while (/*CONSTCOND*/0) | 189 | #define RSVP_DPRINTF(a) do {} while (/*CONSTCOND*/0) | |
190 | #endif /* RSVP_ISI */ | 190 | #endif /* RSVP_ISI */ | |
191 | 191 | |||
192 | /* vif attachment using sys/netinet/ip_encap.c */ | 192 | /* vif attachment using sys/netinet/ip_encap.c */ | |
193 | static void vif_input(struct mbuf *, ...); | 193 | static void vif_input(struct mbuf *, ...); | |
194 | static int vif_encapcheck(struct mbuf *, int, int, void *); | 194 | static int vif_encapcheck(struct mbuf *, int, int, void *); | |
195 | 195 | |||
196 | static const struct protosw vif_protosw = { | 196 | static const struct protosw vif_protosw = { | |
197 | .pr_type = SOCK_RAW, | 197 | .pr_type = SOCK_RAW, | |
198 | .pr_domain = &inetdomain, | 198 | .pr_domain = &inetdomain, | |
199 | .pr_protocol = IPPROTO_IPV4, | 199 | .pr_protocol = IPPROTO_IPV4, | |
200 | .pr_flags = PR_ATOMIC|PR_ADDR, | 200 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
201 | .pr_input = vif_input, | 201 | .pr_input = vif_input, | |
202 | .pr_output = rip_output, | |||
203 | .pr_ctloutput = rip_ctloutput, | 202 | .pr_ctloutput = rip_ctloutput, | |
204 | .pr_usrreqs = &rip_usrreqs, | 203 | .pr_usrreqs = &rip_usrreqs, | |
205 | }; | 204 | }; | |
206 | 205 | |||
207 | #define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */ | 206 | #define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */ | |
208 | #define UPCALL_EXPIRE 6 /* number of timeouts */ | 207 | #define UPCALL_EXPIRE 6 /* number of timeouts */ | |
209 | 208 | |||
210 | /* | 209 | /* | |
211 | * Define the token bucket filter structures | 210 | * Define the token bucket filter structures | |
212 | */ | 211 | */ | |
213 | 212 | |||
214 | #define TBF_REPROCESS (hz / 100) /* 100x / second */ | 213 | #define TBF_REPROCESS (hz / 100) /* 100x / second */ | |
215 | 214 |
--- src/sys/netinet6/in6_gif.c 2016/01/18 06:08:26 1.65
+++ src/sys/netinet6/in6_gif.c 2016/01/20 21:44:00 1.66
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: in6_gif.c,v 1.65 2016/01/18 06:08:26 knakahara Exp $ */ | 1 | /* $NetBSD: in6_gif.c,v 1.66 2016/01/20 21:44:00 riastradh Exp $ */ | |
2 | /* $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $ */ | 2 | /* $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 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 | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | * SUCH DAMAGE. | 30 | * SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.65 2016/01/18 06:08:26 knakahara Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.66 2016/01/20 21:44:00 riastradh Exp $"); | |
35 | 35 | |||
36 | #ifdef _KERNEL_OPT | 36 | #ifdef _KERNEL_OPT | |
37 | #include "opt_inet.h" | 37 | #include "opt_inet.h" | |
38 | #endif | 38 | #endif | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/socket.h> | 42 | #include <sys/socket.h> | |
43 | #include <sys/sockio.h> | 43 | #include <sys/sockio.h> | |
44 | #include <sys/mbuf.h> | 44 | #include <sys/mbuf.h> | |
45 | #include <sys/errno.h> | 45 | #include <sys/errno.h> | |
46 | #include <sys/ioctl.h> | 46 | #include <sys/ioctl.h> | |
47 | #include <sys/queue.h> | 47 | #include <sys/queue.h> | |
@@ -454,18 +454,17 @@ PR_WRAP_CTLINPUT(in6_gif_ctlinput) | @@ -454,18 +454,17 @@ PR_WRAP_CTLINPUT(in6_gif_ctlinput) | |||
454 | PR_WRAP_CTLOUTPUT(rip6_ctloutput) | 454 | PR_WRAP_CTLOUTPUT(rip6_ctloutput) | |
455 | 455 | |||
456 | #define in6_gif_ctlinput in6_gif_ctlinput_wrapper | 456 | #define in6_gif_ctlinput in6_gif_ctlinput_wrapper | |
457 | #define rip6_ctloutput rip6_ctloutput_wrapper | 457 | #define rip6_ctloutput rip6_ctloutput_wrapper | |
458 | 458 | |||
459 | extern struct domain inet6domain; | 459 | extern struct domain inet6domain; | |
460 | 460 | |||
461 | static const struct ip6protosw in6_gif_protosw = { | 461 | static const struct ip6protosw in6_gif_protosw = { | |
462 | .pr_type = SOCK_RAW, | 462 | .pr_type = SOCK_RAW, | |
463 | .pr_domain = &inet6domain, | 463 | .pr_domain = &inet6domain, | |
464 | .pr_protocol = 0 /* IPPROTO_IPV[46] */, | 464 | .pr_protocol = 0 /* IPPROTO_IPV[46] */, | |
465 | .pr_flags = PR_ATOMIC | PR_ADDR, | 465 | .pr_flags = PR_ATOMIC | PR_ADDR, | |
466 | .pr_input = in6_gif_input, | 466 | .pr_input = in6_gif_input, | |
467 | .pr_output = rip6_output, | |||
468 | .pr_ctlinput = in6_gif_ctlinput, | 467 | .pr_ctlinput = in6_gif_ctlinput, | |
469 | .pr_ctloutput = rip6_ctloutput, | 468 | .pr_ctloutput = rip6_ctloutput, | |
470 | .pr_usrreqs = &rip6_usrreqs, | 469 | .pr_usrreqs = &rip6_usrreqs, | |
471 | }; | 470 | }; |
--- src/sys/netinet6/in6_proto.c 2015/10/13 21:28:35 1.107
+++ src/sys/netinet6/in6_proto.c 2016/01/20 21:44:00 1.108
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: in6_proto.c,v 1.107 2015/10/13 21:28:35 rjs Exp $ */ | 1 | /* $NetBSD: in6_proto.c,v 1.108 2016/01/20 21:44:00 riastradh 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.107 2015/10/13 21:28:35 rjs Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.108 2016/01/20 21:44:00 riastradh Exp $"); | |
66 | 66 | |||
67 | #ifdef _KERNEL_OPT | 67 | #ifdef _KERNEL_OPT | |
68 | #include "opt_gateway.h" | 68 | #include "opt_gateway.h" | |
69 | #include "opt_inet.h" | 69 | #include "opt_inet.h" | |
70 | #include "opt_ipsec.h" | 70 | #include "opt_ipsec.h" | |
71 | #include "opt_dccp.h" | 71 | #include "opt_dccp.h" | |
72 | #include "opt_sctp.h" | 72 | #include "opt_sctp.h" | |
73 | #endif | 73 | #endif | |
74 | 74 | |||
75 | #include <sys/param.h> | 75 | #include <sys/param.h> | |
76 | #include <sys/socket.h> | 76 | #include <sys/socket.h> | |
77 | #include <sys/protosw.h> | 77 | #include <sys/protosw.h> | |
78 | #include <sys/kernel.h> | 78 | #include <sys/kernel.h> | |
@@ -278,44 +278,42 @@ const struct ip6protosw inet6sw[] = { | @@ -278,44 +278,42 @@ const struct ip6protosw inet6sw[] = { | |||
278 | .pr_protocol = IPPROTO_SCTP, | 278 | .pr_protocol = IPPROTO_SCTP, | |
279 | .pr_flags = PR_CONNREQUIRED|PR_ADDR_OPT|PR_WANTRCVD|PR_LISTEN, | 279 | .pr_flags = PR_CONNREQUIRED|PR_ADDR_OPT|PR_WANTRCVD|PR_LISTEN, | |
280 | .pr_input = sctp6_input, | 280 | .pr_input = sctp6_input, | |
281 | .pr_ctlinput = sctp6_ctlinput, | 281 | .pr_ctlinput = sctp6_ctlinput, | |
282 | .pr_ctloutput = sctp_ctloutput, | 282 | .pr_ctloutput = sctp_ctloutput, | |
283 | .pr_drain = sctp_drain, | 283 | .pr_drain = sctp_drain, | |
284 | }, | 284 | }, | |
285 | #endif /* SCTP */ | 285 | #endif /* SCTP */ | |
286 | { .pr_type = SOCK_RAW, | 286 | { .pr_type = SOCK_RAW, | |
287 | .pr_domain = &inet6domain, | 287 | .pr_domain = &inet6domain, | |
288 | .pr_protocol = IPPROTO_RAW, | 288 | .pr_protocol = IPPROTO_RAW, | |
289 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF, | 289 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_PURGEIF, | |
290 | .pr_input = rip6_input, | 290 | .pr_input = rip6_input, | |
291 | .pr_output = rip6_output, | |||
292 | .pr_ctlinput = rip6_ctlinput, | 291 | .pr_ctlinput = rip6_ctlinput, | |
293 | .pr_ctloutput = rip6_ctloutput, | 292 | .pr_ctloutput = rip6_ctloutput, | |
294 | .pr_usrreqs = &rip6_usrreqs, | 293 | .pr_usrreqs = &rip6_usrreqs, | |
295 | }, | 294 | }, | |
296 | #ifdef GATEWAY | 295 | #ifdef GATEWAY | |
297 | { .pr_domain = &inet6domain, | 296 | { .pr_domain = &inet6domain, | |
298 | .pr_protocol = IPPROTO_IPV6, | 297 | .pr_protocol = IPPROTO_IPV6, | |
299 | .pr_slowtimo = ip6flow_slowtimo, | 298 | .pr_slowtimo = ip6flow_slowtimo, | |
300 | .pr_init = ip6flow_poolinit, | 299 | .pr_init = ip6flow_poolinit, | |
301 | }, | 300 | }, | |
302 | #endif /* GATEWAY */ | 301 | #endif /* GATEWAY */ | |
303 | { .pr_type = SOCK_RAW, | 302 | { .pr_type = SOCK_RAW, | |
304 | .pr_domain = &inet6domain, | 303 | .pr_domain = &inet6domain, | |
305 | .pr_protocol = IPPROTO_ICMPV6, | 304 | .pr_protocol = IPPROTO_ICMPV6, | |
306 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 305 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
307 | .pr_input = icmp6_input, | 306 | .pr_input = icmp6_input, | |
308 | .pr_output = rip6_output, | |||
309 | .pr_ctlinput = rip6_ctlinput, | 307 | .pr_ctlinput = rip6_ctlinput, | |
310 | .pr_ctloutput = icmp6_ctloutput, | 308 | .pr_ctloutput = icmp6_ctloutput, | |
311 | .pr_usrreqs = &rip6_usrreqs, | 309 | .pr_usrreqs = &rip6_usrreqs, | |
312 | .pr_init = icmp6_init, | 310 | .pr_init = icmp6_init, | |
313 | }, | 311 | }, | |
314 | { .pr_type = SOCK_RAW, | 312 | { .pr_type = SOCK_RAW, | |
315 | .pr_domain = &inet6domain, | 313 | .pr_domain = &inet6domain, | |
316 | .pr_protocol = IPPROTO_DSTOPTS, | 314 | .pr_protocol = IPPROTO_DSTOPTS, | |
317 | .pr_flags = PR_ATOMIC|PR_ADDR, | 315 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
318 | .pr_input = dest6_input, | 316 | .pr_input = dest6_input, | |
319 | }, | 317 | }, | |
320 | { .pr_type = SOCK_RAW, | 318 | { .pr_type = SOCK_RAW, | |
321 | .pr_domain = &inet6domain, | 319 | .pr_domain = &inet6domain, | |
@@ -347,83 +345,77 @@ const struct ip6protosw inet6sw[] = { | @@ -347,83 +345,77 @@ const struct ip6protosw inet6sw[] = { | |||
347 | { .pr_type = SOCK_RAW, | 345 | { .pr_type = SOCK_RAW, | |
348 | .pr_domain = &inet6domain, | 346 | .pr_domain = &inet6domain, | |
349 | .pr_protocol = IPPROTO_IPCOMP, | 347 | .pr_protocol = IPPROTO_IPCOMP, | |
350 | .pr_flags = PR_ATOMIC|PR_ADDR, | 348 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
351 | .pr_input = ipsec6_common_input, | 349 | .pr_input = ipsec6_common_input, | |
352 | }, | 350 | }, | |
353 | #endif /* IPSEC */ | 351 | #endif /* IPSEC */ | |
354 | #ifdef INET | 352 | #ifdef INET | |
355 | { .pr_type = SOCK_RAW, | 353 | { .pr_type = SOCK_RAW, | |
356 | .pr_domain = &inet6domain, | 354 | .pr_domain = &inet6domain, | |
357 | .pr_protocol = IPPROTO_IPV4, | 355 | .pr_protocol = IPPROTO_IPV4, | |
358 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 356 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
359 | .pr_input = encap6_input, | 357 | .pr_input = encap6_input, | |
360 | .pr_output = rip6_output, | |||
361 | .pr_ctlinput = encap6_ctlinput, | 358 | .pr_ctlinput = encap6_ctlinput, | |
362 | .pr_ctloutput = rip6_ctloutput, | 359 | .pr_ctloutput = rip6_ctloutput, | |
363 | .pr_usrreqs = &rip6_usrreqs, | 360 | .pr_usrreqs = &rip6_usrreqs, | |
364 | .pr_init = encap_init, | 361 | .pr_init = encap_init, | |
365 | }, | 362 | }, | |
366 | #endif | 363 | #endif | |
367 | { .pr_type = SOCK_RAW, | 364 | { .pr_type = SOCK_RAW, | |
368 | .pr_domain = &inet6domain, | 365 | .pr_domain = &inet6domain, | |
369 | .pr_protocol = IPPROTO_IPV6, | 366 | .pr_protocol = IPPROTO_IPV6, | |
370 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 367 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
371 | .pr_input = encap6_input, | 368 | .pr_input = encap6_input, | |
372 | .pr_output = rip6_output, | |||
373 | .pr_ctlinput = encap6_ctlinput, | 369 | .pr_ctlinput = encap6_ctlinput, | |
374 | .pr_ctloutput = rip6_ctloutput, | 370 | .pr_ctloutput = rip6_ctloutput, | |
375 | .pr_usrreqs = &rip6_usrreqs, | 371 | .pr_usrreqs = &rip6_usrreqs, | |
376 | .pr_init = encap_init, | 372 | .pr_init = encap_init, | |
377 | }, | 373 | }, | |
378 | #if NETHERIP > 0 | 374 | #if NETHERIP > 0 | |
379 | { .pr_type = SOCK_RAW, | 375 | { .pr_type = SOCK_RAW, | |
380 | .pr_domain = &inet6domain, | 376 | .pr_domain = &inet6domain, | |
381 | .pr_protocol = IPPROTO_ETHERIP, | 377 | .pr_protocol = IPPROTO_ETHERIP, | |
382 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 378 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
383 | .pr_input = ip6_etherip_input, | 379 | .pr_input = ip6_etherip_input, | |
384 | .pr_output = rip6_output, | |||
385 | .pr_ctlinput = rip6_ctlinput, | 380 | .pr_ctlinput = rip6_ctlinput, | |
386 | .pr_ctloutput = rip6_ctloutput, | 381 | .pr_ctloutput = rip6_ctloutput, | |
387 | .pr_usrreqs = &rip6_usrreqs, | 382 | .pr_usrreqs = &rip6_usrreqs, | |
388 | }, | 383 | }, | |
389 | #endif | 384 | #endif | |
390 | #if NCARP > 0 | 385 | #if NCARP > 0 | |
391 | { .pr_type = SOCK_RAW, | 386 | { .pr_type = SOCK_RAW, | |
392 | .pr_domain = &inet6domain, | 387 | .pr_domain = &inet6domain, | |
393 | .pr_protocol = IPPROTO_CARP, | 388 | .pr_protocol = IPPROTO_CARP, | |
394 | .pr_flags = PR_ATOMIC|PR_ADDR, | 389 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
395 | .pr_input = carp6_proto_input, | 390 | .pr_input = carp6_proto_input, | |
396 | .pr_output = rip6_output, | |||
397 | .pr_ctloutput = rip6_ctloutput, | 391 | .pr_ctloutput = rip6_ctloutput, | |
398 | .pr_usrreqs = &rip6_usrreqs, | 392 | .pr_usrreqs = &rip6_usrreqs, | |
399 | }, | 393 | }, | |
400 | #endif /* NCARP */ | 394 | #endif /* NCARP */ | |
401 | { .pr_type = SOCK_RAW, | 395 | { .pr_type = SOCK_RAW, | |
402 | .pr_domain = &inet6domain, | 396 | .pr_domain = &inet6domain, | |
403 | .pr_protocol = IPPROTO_PIM, | 397 | .pr_protocol = IPPROTO_PIM, | |
404 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 398 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
405 | .pr_input = pim6_input, | 399 | .pr_input = pim6_input, | |
406 | .pr_output = rip6_output, | |||
407 | .pr_ctloutput = rip6_ctloutput, | 400 | .pr_ctloutput = rip6_ctloutput, | |
408 | .pr_usrreqs = &rip6_usrreqs, | 401 | .pr_usrreqs = &rip6_usrreqs, | |
409 | .pr_init = pim6_init, | 402 | .pr_init = pim6_init, | |
410 | }, | 403 | }, | |
411 | /* raw wildcard */ | 404 | /* raw wildcard */ | |
412 | { .pr_type = SOCK_RAW, | 405 | { .pr_type = SOCK_RAW, | |
413 | .pr_domain = &inet6domain, | 406 | .pr_domain = &inet6domain, | |
414 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 407 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
415 | .pr_input = rip6_input, | 408 | .pr_input = rip6_input, | |
416 | .pr_output = rip6_output, | |||
417 | .pr_ctloutput = rip6_ctloutput, | 409 | .pr_ctloutput = rip6_ctloutput, | |
418 | .pr_usrreqs = &rip6_usrreqs, | 410 | .pr_usrreqs = &rip6_usrreqs, | |
419 | .pr_init = rip6_init, | 411 | .pr_init = rip6_init, | |
420 | }, | 412 | }, | |
421 | }; | 413 | }; | |
422 | 414 | |||
423 | static const struct sockaddr_in6 in6_any = { | 415 | static const struct sockaddr_in6 in6_any = { | |
424 | .sin6_len = sizeof(in6_any) | 416 | .sin6_len = sizeof(in6_any) | |
425 | , .sin6_family = AF_INET6 | 417 | , .sin6_family = AF_INET6 | |
426 | , .sin6_port = 0 | 418 | , .sin6_port = 0 | |
427 | , .sin6_flowinfo = 0 | 419 | , .sin6_flowinfo = 0 | |
428 | , .sin6_addr = IN6ADDR_ANY_INIT | 420 | , .sin6_addr = IN6ADDR_ANY_INIT | |
429 | , .sin6_scope_id = 0 | 421 | , .sin6_scope_id = 0 |
--- src/sys/netinet6/ip6protosw.h 2014/05/18 14:46:16 1.22
+++ src/sys/netinet6/ip6protosw.h 2016/01/20 21:44:00 1.23
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip6protosw.h,v 1.22 2014/05/18 14:46:16 rmind Exp $ */ | 1 | /* $NetBSD: ip6protosw.h,v 1.23 2016/01/20 21:44:00 riastradh Exp $ */ | |
2 | /* $KAME: ip6protosw.h,v 1.22 2001/02/08 18:02:08 itojun Exp $ */ | 2 | /* $KAME: ip6protosw.h,v 1.22 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 | |
@@ -110,29 +110,26 @@ struct ip6ctlparam { | @@ -110,29 +110,26 @@ struct ip6ctlparam { | |||
110 | void *ip6c_cmdarg; /* control command dependent data */ | 110 | void *ip6c_cmdarg; /* control command dependent data */ | |
111 | u_int8_t ip6c_nxt; /* final next header field */ | 111 | u_int8_t ip6c_nxt; /* final next header field */ | |
112 | }; | 112 | }; | |
113 | 113 | |||
114 | struct ip6protosw { | 114 | struct ip6protosw { | |
115 | int pr_type; /* socket type used for */ | 115 | int pr_type; /* socket type used for */ | |
116 | struct domain *pr_domain; /* domain protocol a member of */ | 116 | struct domain *pr_domain; /* domain protocol a member of */ | |
117 | short pr_protocol; /* protocol number */ | 117 | short pr_protocol; /* protocol number */ | |
118 | short pr_flags; /* see below */ | 118 | short pr_flags; /* see below */ | |
119 | 119 | |||
120 | /* protocol-protocol hooks */ | 120 | /* protocol-protocol hooks */ | |
121 | int (*pr_input) /* input to protocol (from below) */ | 121 | int (*pr_input) /* input to protocol (from below) */ | |
122 | (struct mbuf **, int *, int); | 122 | (struct mbuf **, int *, int); | |
123 | int (*pr_output) /* output to protocol (from above) */ | |||
124 | (struct mbuf *, struct socket *, struct sockaddr_in6 *, | |||
125 | struct mbuf *); | |||
126 | void *(*pr_ctlinput) /* control input (from below) */ | 123 | void *(*pr_ctlinput) /* control input (from below) */ | |
127 | (int, const struct sockaddr *, void *); | 124 | (int, const struct sockaddr *, void *); | |
128 | int (*pr_ctloutput) /* control output (from above) */ | 125 | int (*pr_ctloutput) /* control output (from above) */ | |
129 | (int, struct socket *, struct sockopt *); | 126 | (int, struct socket *, struct sockopt *); | |
130 | 127 | |||
131 | /* user-protocol hook */ | 128 | /* user-protocol hook */ | |
132 | const struct pr_usrreqs *pr_usrreqs; | 129 | const struct pr_usrreqs *pr_usrreqs; | |
133 | 130 | |||
134 | /* utility hooks */ | 131 | /* utility hooks */ | |
135 | void (*pr_init) /* initialization hook */ | 132 | void (*pr_init) /* initialization hook */ | |
136 | (void); | 133 | (void); | |
137 | 134 | |||
138 | void (*pr_fasttimo) /* fast timeout (200ms) */ | 135 | void (*pr_fasttimo) /* fast timeout (200ms) */ |
--- src/sys/netipsec/keysock.c 2015/05/02 17:18:04 1.48
+++ src/sys/netipsec/keysock.c 2016/01/20 21:44:00 1.49
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: keysock.c,v 1.48 2015/05/02 17:18:04 rtr Exp $ */ | 1 | /* $NetBSD: keysock.c,v 1.49 2016/01/20 21:44:00 riastradh Exp $ */ | |
2 | /* $FreeBSD: src/sys/netipsec/keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ | 2 | /* $FreeBSD: src/sys/netipsec/keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ | |
3 | /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ | 3 | /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ | |
4 | 4 | |||
5 | /* | 5 | /* | |
6 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 6 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
7 | * All rights reserved. | 7 | * All rights reserved. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -22,27 +22,27 @@ | @@ -22,27 +22,27 @@ | |||
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 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 | 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 | 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 | 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
31 | * SUCH DAMAGE. | 31 | * SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | #include <sys/cdefs.h> | 34 | #include <sys/cdefs.h> | |
35 | __KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.48 2015/05/02 17:18:04 rtr Exp $"); | 35 | __KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.49 2016/01/20 21:44:00 riastradh Exp $"); | |
36 | 36 | |||
37 | /* This code has derived from sys/net/rtsock.c on FreeBSD2.2.5 */ | 37 | /* This code has derived from sys/net/rtsock.c on FreeBSD2.2.5 */ | |
38 | 38 | |||
39 | #include <sys/types.h> | 39 | #include <sys/types.h> | |
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/domain.h> | 41 | #include <sys/domain.h> | |
42 | #include <sys/errno.h> | 42 | #include <sys/errno.h> | |
43 | #include <sys/kernel.h> | 43 | #include <sys/kernel.h> | |
44 | #include <sys/kmem.h> | 44 | #include <sys/kmem.h> | |
45 | #include <sys/mbuf.h> | 45 | #include <sys/mbuf.h> | |
46 | #include <sys/protosw.h> | 46 | #include <sys/protosw.h> | |
47 | #include <sys/signalvar.h> | 47 | #include <sys/signalvar.h> | |
48 | #include <sys/socket.h> | 48 | #include <sys/socket.h> | |
@@ -51,63 +51,56 @@ __KERNEL_RCSID(0, "$NetBSD: keysock.c,v | @@ -51,63 +51,56 @@ __KERNEL_RCSID(0, "$NetBSD: keysock.c,v | |||
51 | #include <sys/systm.h> | 51 | #include <sys/systm.h> | |
52 | 52 | |||
53 | #include <net/raw_cb.h> | 53 | #include <net/raw_cb.h> | |
54 | #include <net/route.h> | 54 | #include <net/route.h> | |
55 | 55 | |||
56 | #include <net/pfkeyv2.h> | 56 | #include <net/pfkeyv2.h> | |
57 | #include <netipsec/key.h> | 57 | #include <netipsec/key.h> | |
58 | #include <netipsec/keysock.h> | 58 | #include <netipsec/keysock.h> | |
59 | #include <netipsec/key_debug.h> | 59 | #include <netipsec/key_debug.h> | |
60 | 60 | |||
61 | #include <netipsec/ipsec_osdep.h> | 61 | #include <netipsec/ipsec_osdep.h> | |
62 | #include <netipsec/ipsec_private.h> | 62 | #include <netipsec/ipsec_private.h> | |
63 | 63 | |||
64 | typedef int pr_output_t (struct mbuf *, struct socket *); | |||
65 | ||||
66 | struct key_cb { | 64 | struct key_cb { | |
67 | int key_count; | 65 | int key_count; | |
68 | int any_count; | 66 | int any_count; | |
69 | }; | 67 | }; | |
70 | static struct key_cb key_cb; | 68 | static struct key_cb key_cb; | |
71 | 69 | |||
72 | static struct sockaddr key_dst = { | 70 | static struct sockaddr key_dst = { | |
73 | .sa_len = 2, | 71 | .sa_len = 2, | |
74 | .sa_family = PF_KEY, | 72 | .sa_family = PF_KEY, | |
75 | }; | 73 | }; | |
76 | static struct sockaddr key_src = { | 74 | static struct sockaddr key_src = { | |
77 | .sa_len = 2, | 75 | .sa_len = 2, | |
78 | .sa_family = PF_KEY, | 76 | .sa_family = PF_KEY, | |
79 | }; | 77 | }; | |
80 | 78 | |||
79 | static const struct protosw keysw[]; | |||
81 | 80 | |||
82 | static int key_sendup0(struct rawcb *, struct mbuf *, int, int); | 81 | static int key_sendup0(struct rawcb *, struct mbuf *, int, int); | |
83 | 82 | |||
84 | int key_registered_sb_max = (2048 * MHLEN); /* XXX arbitrary */ | 83 | int key_registered_sb_max = (2048 * MHLEN); /* XXX arbitrary */ | |
85 | 84 | |||
86 | /* | 85 | /* | |
87 | * key_output() | 86 | * key_output() | |
88 | */ | 87 | */ | |
89 | int | 88 | static int | |
90 | key_output(struct mbuf *m, ...) | 89 | key_output(struct mbuf *m, struct socket *so) | |
91 | { | 90 | { | |
92 | struct sadb_msg *msg; | 91 | struct sadb_msg *msg; | |
93 | int len, error = 0; | 92 | int len, error = 0; | |
94 | int s; | 93 | int s; | |
95 | struct socket *so; | |||
96 | va_list ap; | |||
97 | ||||
98 | va_start(ap, m); | |||
99 | so = va_arg(ap, struct socket *); | |||
100 | va_end(ap); | |||
101 | 94 | |||
102 | if (m == 0) | 95 | if (m == 0) | |
103 | panic("key_output: NULL pointer was passed"); | 96 | panic("key_output: NULL pointer was passed"); | |
104 | 97 | |||
105 | { | 98 | { | |
106 | uint64_t *ps = PFKEY_STAT_GETREF(); | 99 | uint64_t *ps = PFKEY_STAT_GETREF(); | |
107 | ps[PFKEY_STAT_OUT_TOTAL]++; | 100 | ps[PFKEY_STAT_OUT_TOTAL]++; | |
108 | ps[PFKEY_STAT_OUT_BYTES] += m->m_pkthdr.len; | 101 | ps[PFKEY_STAT_OUT_BYTES] += m->m_pkthdr.len; | |
109 | PFKEY_STAT_PUTREF(); | 102 | PFKEY_STAT_PUTREF(); | |
110 | } | 103 | } | |
111 | 104 | |||
112 | len = m->m_pkthdr.len; | 105 | len = m->m_pkthdr.len; | |
113 | if (len < sizeof(struct sadb_msg)) { | 106 | if (len < sizeof(struct sadb_msg)) { | |
@@ -628,29 +621,30 @@ key_recvoob(struct socket *so, struct mb | @@ -628,29 +621,30 @@ key_recvoob(struct socket *so, struct mb | |||
628 | KASSERT(solocked(so)); | 621 | KASSERT(solocked(so)); | |
629 | 622 | |||
630 | return EOPNOTSUPP; | 623 | return EOPNOTSUPP; | |
631 | } | 624 | } | |
632 | 625 | |||
633 | static int | 626 | static int | |
634 | key_send(struct socket *so, struct mbuf *m, struct sockaddr *nam, | 627 | key_send(struct socket *so, struct mbuf *m, struct sockaddr *nam, | |
635 | struct mbuf *control, struct lwp *l) | 628 | struct mbuf *control, struct lwp *l) | |
636 | { | 629 | { | |
637 | int error = 0; | 630 | int error = 0; | |
638 | int s; | 631 | int s; | |
639 | 632 | |||
640 | KASSERT(solocked(so)); | 633 | KASSERT(solocked(so)); | |
634 | KASSERT(so->so_proto == &keysw[0]); | |||
641 | 635 | |||
642 | s = splsoftnet(); | 636 | s = splsoftnet(); | |
643 | error = raw_send(so, m, nam, control, l); | 637 | error = raw_send(so, m, nam, control, l, &key_output); | |
644 | splx(s); | 638 | splx(s); | |
645 | 639 | |||
646 | return error; | 640 | return error; | |
647 | } | 641 | } | |
648 | 642 | |||
649 | static int | 643 | static int | |
650 | key_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) | 644 | key_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) | |
651 | { | 645 | { | |
652 | KASSERT(solocked(so)); | 646 | KASSERT(solocked(so)); | |
653 | 647 | |||
654 | m_freem(m); | 648 | m_freem(m); | |
655 | m_freem(control); | 649 | m_freem(control); | |
656 | 650 | |||
@@ -683,55 +677,54 @@ PR_WRAP_USRREQS(key) | @@ -683,55 +677,54 @@ PR_WRAP_USRREQS(key) | |||
683 | #define key_disconnect key_disconnect_wrapper | 677 | #define key_disconnect key_disconnect_wrapper | |
684 | #define key_shutdown key_shutdown_wrapper | 678 | #define key_shutdown key_shutdown_wrapper | |
685 | #define key_abort key_abort_wrapper | 679 | #define key_abort key_abort_wrapper | |
686 | #define key_ioctl key_ioctl_wrapper | 680 | #define key_ioctl key_ioctl_wrapper | |
687 | #define key_stat key_stat_wrapper | 681 | #define key_stat key_stat_wrapper | |
688 | #define key_peeraddr key_peeraddr_wrapper | 682 | #define key_peeraddr key_peeraddr_wrapper | |
689 | #define key_sockaddr key_sockaddr_wrapper | 683 | #define key_sockaddr key_sockaddr_wrapper | |
690 | #define key_rcvd key_rcvd_wrapper | 684 | #define key_rcvd key_rcvd_wrapper | |
691 | #define key_recvoob key_recvoob_wrapper | 685 | #define key_recvoob key_recvoob_wrapper | |
692 | #define key_send key_send_wrapper | 686 | #define key_send key_send_wrapper | |
693 | #define key_sendoob key_sendoob_wrapper | 687 | #define key_sendoob key_sendoob_wrapper | |
694 | #define key_purgeif key_purgeif_wrapper | 688 | #define key_purgeif key_purgeif_wrapper | |
695 | 689 | |||
696 | const struct pr_usrreqs key_usrreqs = { | 690 | static const struct pr_usrreqs key_usrreqs = { | |
697 | .pr_attach = key_attach, | 691 | .pr_attach = key_attach, | |
698 | .pr_detach = key_detach, | 692 | .pr_detach = key_detach, | |
699 | .pr_accept = key_accept, | 693 | .pr_accept = key_accept, | |
700 | .pr_bind = key_bind, | 694 | .pr_bind = key_bind, | |
701 | .pr_listen = key_listen, | 695 | .pr_listen = key_listen, | |
702 | .pr_connect = key_connect, | 696 | .pr_connect = key_connect, | |
703 | .pr_connect2 = key_connect2, | 697 | .pr_connect2 = key_connect2, | |
704 | .pr_disconnect = key_disconnect, | 698 | .pr_disconnect = key_disconnect, | |
705 | .pr_shutdown = key_shutdown, | 699 | .pr_shutdown = key_shutdown, | |
706 | .pr_abort = key_abort, | 700 | .pr_abort = key_abort, | |
707 | .pr_ioctl = key_ioctl, | 701 | .pr_ioctl = key_ioctl, | |
708 | .pr_stat = key_stat, | 702 | .pr_stat = key_stat, | |
709 | .pr_peeraddr = key_peeraddr, | 703 | .pr_peeraddr = key_peeraddr, | |
710 | .pr_sockaddr = key_sockaddr, | 704 | .pr_sockaddr = key_sockaddr, | |
711 | .pr_rcvd = key_rcvd, | 705 | .pr_rcvd = key_rcvd, | |
712 | .pr_recvoob = key_recvoob, | 706 | .pr_recvoob = key_recvoob, | |
713 | .pr_send = key_send, | 707 | .pr_send = key_send, | |
714 | .pr_sendoob = key_sendoob, | 708 | .pr_sendoob = key_sendoob, | |
715 | .pr_purgeif = key_purgeif, | 709 | .pr_purgeif = key_purgeif, | |
716 | }; | 710 | }; | |
717 | 711 | |||
718 | const struct protosw keysw[] = { | 712 | static const struct protosw keysw[] = { | |
719 | { | 713 | { | |
720 | .pr_type = SOCK_RAW, | 714 | .pr_type = SOCK_RAW, | |
721 | .pr_domain = &keydomain, | 715 | .pr_domain = &keydomain, | |
722 | .pr_protocol = PF_KEY_V2, | 716 | .pr_protocol = PF_KEY_V2, | |
723 | .pr_flags = PR_ATOMIC|PR_ADDR, | 717 | .pr_flags = PR_ATOMIC|PR_ADDR, | |
724 | .pr_output = key_output, | |||
725 | .pr_ctlinput = raw_ctlinput, | 718 | .pr_ctlinput = raw_ctlinput, | |
726 | .pr_usrreqs = &key_usrreqs, | 719 | .pr_usrreqs = &key_usrreqs, | |
727 | .pr_init = raw_init, | 720 | .pr_init = raw_init, | |
728 | } | 721 | } | |
729 | }; | 722 | }; | |
730 | 723 | |||
731 | struct domain keydomain = { | 724 | struct domain keydomain = { | |
732 | .dom_family = PF_KEY, | 725 | .dom_family = PF_KEY, | |
733 | .dom_name = "key", | 726 | .dom_name = "key", | |
734 | .dom_init = key_init, | 727 | .dom_init = key_init, | |
735 | .dom_protosw = keysw, | 728 | .dom_protosw = keysw, | |
736 | .dom_protoswNPROTOSW = &keysw[__arraycount(keysw)], | 729 | .dom_protoswNPROTOSW = &keysw[__arraycount(keysw)], | |
737 | }; | 730 | }; |
--- src/sys/netipsec/keysock.h 2014/05/18 14:46:16 1.7
+++ src/sys/netipsec/keysock.h 2016/01/20 21:44:00 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: keysock.h,v 1.7 2014/05/18 14:46:16 rmind Exp $ */ | 1 | /* $NetBSD: keysock.h,v 1.8 2016/01/20 21:44:00 riastradh Exp $ */ | |
2 | /* $FreeBSD: src/sys/netipsec/keysock.h,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */ | 2 | /* $FreeBSD: src/sys/netipsec/keysock.h,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */ | |
3 | /* $KAME: keysock.h,v 1.8 2000/03/27 05:11:06 sumikawa Exp $ */ | 3 | /* $KAME: keysock.h,v 1.8 2000/03/27 05:11:06 sumikawa Exp $ */ | |
4 | 4 | |||
5 | /* | 5 | /* | |
6 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 6 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
7 | * All rights reserved. | 7 | * All rights reserved. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -60,19 +60,18 @@ | @@ -60,19 +60,18 @@ | |||
60 | #define PFKEY_NSTATS 530 | 60 | #define PFKEY_NSTATS 530 | |
61 | 61 | |||
62 | #define KEY_SENDUP_ONE 0 | 62 | #define KEY_SENDUP_ONE 0 | |
63 | #define KEY_SENDUP_ALL 1 | 63 | #define KEY_SENDUP_ALL 1 | |
64 | #define KEY_SENDUP_REGISTERED 2 | 64 | #define KEY_SENDUP_REGISTERED 2 | |
65 | 65 | |||
66 | #ifdef _KERNEL | 66 | #ifdef _KERNEL | |
67 | struct keycb { | 67 | struct keycb { | |
68 | struct rawcb kp_raw; /* rawcb */ | 68 | struct rawcb kp_raw; /* rawcb */ | |
69 | int kp_promisc; /* promiscuous mode */ | 69 | int kp_promisc; /* promiscuous mode */ | |
70 | int kp_registered; /* registered socket */ | 70 | int kp_registered; /* registered socket */ | |
71 | }; | 71 | }; | |
72 | 72 | |||
73 | int key_output (struct mbuf *, ...); | |||
74 | int key_sendup (struct socket *, struct sadb_msg *, u_int, int); | 73 | int key_sendup (struct socket *, struct sadb_msg *, u_int, int); | |
75 | int key_sendup_mbuf (struct socket *, struct mbuf *, int); | 74 | int key_sendup_mbuf (struct socket *, struct mbuf *, int); | |
76 | #endif /* _KERNEL */ | 75 | #endif /* _KERNEL */ | |
77 | 76 | |||
78 | #endif /* !_NETIPSEC_KEYSOCK_H_ */ | 77 | #endif /* !_NETIPSEC_KEYSOCK_H_ */ |
--- src/sys/netipsec/xform_ipip.c 2015/03/27 07:47:10 1.32
+++ src/sys/netipsec/xform_ipip.c 2016/01/20 21:44:00 1.33
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: xform_ipip.c,v 1.32 2015/03/27 07:47:10 ozaki-r Exp $ */ | 1 | /* $NetBSD: xform_ipip.c,v 1.33 2016/01/20 21:44:00 riastradh Exp $ */ | |
2 | /* $FreeBSD: src/sys/netipsec/xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ | 2 | /* $FreeBSD: src/sys/netipsec/xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ | |
3 | /* $OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */ | 3 | /* $OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */ | |
4 | 4 | |||
5 | /* | 5 | /* | |
6 | * The authors of this code are John Ioannidis (ji@tla.org), | 6 | * The authors of this code are John Ioannidis (ji@tla.org), | |
7 | * Angelos D. Keromytis (kermit@csd.uch.gr) and | 7 | * Angelos D. Keromytis (kermit@csd.uch.gr) and | |
8 | * Niels Provos (provos@physnet.uni-hamburg.de). | 8 | * Niels Provos (provos@physnet.uni-hamburg.de). | |
9 | * | 9 | * | |
10 | * The original version of this code was written by John Ioannidis | 10 | * The original version of this code was written by John Ioannidis | |
11 | * for BSD/OS in Athens, Greece, in November 1995. | 11 | * for BSD/OS in Athens, Greece, in November 1995. | |
12 | * | 12 | * | |
13 | * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996, | 13 | * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996, | |
14 | * by Angelos D. Keromytis. | 14 | * by Angelos D. Keromytis. | |
@@ -29,27 +29,27 @@ | @@ -29,27 +29,27 @@ | |||
29 | * You may use this code under the GNU public license if you so wish. Please | 29 | * You may use this code under the GNU public license if you so wish. Please | |
30 | * contribute changes back to the authors under this freer than GPL license | 30 | * contribute changes back to the authors under this freer than GPL license | |
31 | * so that we may further the use of strong encryption without limitations to | 31 | * so that we may further the use of strong encryption without limitations to | |
32 | * all. | 32 | * all. | |
33 | * | 33 | * | |
34 | * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR | 34 | * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR | |
35 | * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY | 35 | * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY | |
36 | * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE | 36 | * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE | |
37 | * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR | 37 | * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR | |
38 | * PURPOSE. | 38 | * PURPOSE. | |
39 | */ | 39 | */ | |
40 | 40 | |||
41 | #include <sys/cdefs.h> | 41 | #include <sys/cdefs.h> | |
42 | __KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.32 2015/03/27 07:47:10 ozaki-r Exp $"); | 42 | __KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.33 2016/01/20 21:44:00 riastradh Exp $"); | |
43 | 43 | |||
44 | /* | 44 | /* | |
45 | * IP-inside-IP processing | 45 | * IP-inside-IP processing | |
46 | */ | 46 | */ | |
47 | #include "opt_inet.h" | 47 | #include "opt_inet.h" | |
48 | #ifdef __FreeBSD__ | 48 | #ifdef __FreeBSD__ | |
49 | #include "opt_inet6.h" | 49 | #include "opt_inet6.h" | |
50 | #include "opt_random_ip_id.h" | 50 | #include "opt_random_ip_id.h" | |
51 | #endif /* __FreeBSD__ */ | 51 | #endif /* __FreeBSD__ */ | |
52 | 52 | |||
53 | 53 | |||
54 | #include <sys/param.h> | 54 | #include <sys/param.h> | |
55 | #include <sys/systm.h> | 55 | #include <sys/systm.h> | |
@@ -682,48 +682,46 @@ static struct xformsw ipe4_xformsw = { | @@ -682,48 +682,46 @@ static struct xformsw ipe4_xformsw = { | |||
682 | }; | 682 | }; | |
683 | 683 | |||
684 | #ifdef INET | 684 | #ifdef INET | |
685 | PR_WRAP_CTLOUTPUT(rip_ctloutput) | 685 | PR_WRAP_CTLOUTPUT(rip_ctloutput) | |
686 | #define rip_ctloutput rip_ctloutput_wrapper | 686 | #define rip_ctloutput rip_ctloutput_wrapper | |
687 | 687 | |||
688 | extern struct domain inetdomain; | 688 | extern struct domain inetdomain; | |
689 | static struct ipprotosw ipe4_protosw = { | 689 | static struct ipprotosw ipe4_protosw = { | |
690 | .pr_type = SOCK_RAW, | 690 | .pr_type = SOCK_RAW, | |
691 | .pr_domain = &inetdomain, | 691 | .pr_domain = &inetdomain, | |
692 | .pr_protocol = IPPROTO_IPV4, | 692 | .pr_protocol = IPPROTO_IPV4, | |
693 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 693 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
694 | .pr_input = ip4_input, | 694 | .pr_input = ip4_input, | |
695 | .pr_output = 0, | |||
696 | .pr_ctlinput = 0, | 695 | .pr_ctlinput = 0, | |
697 | .pr_ctloutput = rip_ctloutput, | 696 | .pr_ctloutput = rip_ctloutput, | |
698 | .pr_usrreqs = &rip_usrreqs, | 697 | .pr_usrreqs = &rip_usrreqs, | |
699 | .pr_init = 0, | 698 | .pr_init = 0, | |
700 | .pr_fasttimo = 0, | 699 | .pr_fasttimo = 0, | |
701 | .pr_slowtimo = 0, | 700 | .pr_slowtimo = 0, | |
702 | .pr_drain = 0, | 701 | .pr_drain = 0, | |
703 | }; | 702 | }; | |
704 | #endif | 703 | #endif | |
705 | #ifdef INET6 | 704 | #ifdef INET6 | |
706 | PR_WRAP_CTLOUTPUT(rip6_ctloutput) | 705 | PR_WRAP_CTLOUTPUT(rip6_ctloutput) | |
707 | #define rip6_ctloutput rip6_ctloutput_wrapper | 706 | #define rip6_ctloutput rip6_ctloutput_wrapper | |
708 | 707 | |||
709 | extern struct domain inet6domain; | 708 | extern struct domain inet6domain; | |
710 | static struct ip6protosw ipe4_protosw6 = { | 709 | static struct ip6protosw ipe4_protosw6 = { | |
711 | .pr_type = SOCK_RAW, | 710 | .pr_type = SOCK_RAW, | |
712 | .pr_domain = &inet6domain, | 711 | .pr_domain = &inet6domain, | |
713 | .pr_protocol = IPPROTO_IPV6, | 712 | .pr_protocol = IPPROTO_IPV6, | |
714 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | 713 | .pr_flags = PR_ATOMIC|PR_ADDR|PR_LASTHDR, | |
715 | .pr_input = ip4_input6, | 714 | .pr_input = ip4_input6, | |
716 | .pr_output = 0, | |||
717 | .pr_ctlinput = 0, | 715 | .pr_ctlinput = 0, | |
718 | .pr_ctloutput = rip6_ctloutput, | 716 | .pr_ctloutput = rip6_ctloutput, | |
719 | .pr_usrreqs = &rip6_usrreqs, | 717 | .pr_usrreqs = &rip6_usrreqs, | |
720 | .pr_init = 0, | 718 | .pr_init = 0, | |
721 | .pr_fasttimo = 0, | 719 | .pr_fasttimo = 0, | |
722 | .pr_slowtimo = 0, | 720 | .pr_slowtimo = 0, | |
723 | .pr_drain = 0, | 721 | .pr_drain = 0, | |
724 | }; | 722 | }; | |
725 | #endif | 723 | #endif | |
726 | 724 | |||
727 | /* | 725 | /* | |
728 | * Check the encapsulated packet to see if we want it | 726 | * Check the encapsulated packet to see if we want it | |
729 | */ | 727 | */ |
--- src/sys/netnatm/Attic/natm_proto.c 2014/05/18 14:46:16 1.15
+++ src/sys/netnatm/Attic/natm_proto.c 2016/01/20 21:44:00 1.16
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: natm_proto.c,v 1.15 2014/05/18 14:46:16 rmind Exp $ */ | 1 | /* $NetBSD: natm_proto.c,v 1.16 2016/01/20 21:44:00 riastradh Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996 Charles D. Cranor and Washington University. | 4 | * Copyright (c) 1996 Charles D. Cranor and Washington University. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 | */ | 26 | */ | |
27 | 27 | |||
28 | /* | 28 | /* | |
29 | * protocol layer for access to native mode ATM | 29 | * protocol layer for access to native mode ATM | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: natm_proto.c,v 1.15 2014/05/18 14:46:16 rmind Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: natm_proto.c,v 1.16 2016/01/20 21:44:00 riastradh Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/systm.h> | 36 | #include <sys/systm.h> | |
37 | #include <sys/kernel.h> | 37 | #include <sys/kernel.h> | |
38 | #include <sys/queue.h> | 38 | #include <sys/queue.h> | |
39 | #include <sys/socket.h> | 39 | #include <sys/socket.h> | |
40 | #include <sys/protosw.h> | 40 | #include <sys/protosw.h> | |
41 | #include <sys/domain.h> | 41 | #include <sys/domain.h> | |
42 | #include <sys/mbuf.h> | 42 | #include <sys/mbuf.h> | |
43 | 43 | |||
44 | #include <net/if.h> | 44 | #include <net/if.h> | |
45 | #include <net/route.h> | 45 | #include <net/route.h> | |
46 | 46 | |||
@@ -52,55 +52,52 @@ DOMAIN_DEFINE(natmdomain); | @@ -52,55 +52,52 @@ DOMAIN_DEFINE(natmdomain); | |||
52 | 52 | |||
53 | static void natm_init(void); | 53 | static void natm_init(void); | |
54 | 54 | |||
55 | struct npcblist natm_pcbs = LIST_HEAD_INITIALIZER(natm_pcbs); | 55 | struct npcblist natm_pcbs = LIST_HEAD_INITIALIZER(natm_pcbs); | |
56 | struct ifqueue natmintrq; /* natm packet input queue */ | 56 | struct ifqueue natmintrq; /* natm packet input queue */ | |
57 | int natmqmaxlen = IFQ_MAXLEN; /* max # of packets on queue */ | 57 | int natmqmaxlen = IFQ_MAXLEN; /* max # of packets on queue */ | |
58 | 58 | |||
59 | const struct protosw natmsw[] = { | 59 | const struct protosw natmsw[] = { | |
60 | { .pr_type = SOCK_STREAM, | 60 | { .pr_type = SOCK_STREAM, | |
61 | .pr_domain = &natmdomain, | 61 | .pr_domain = &natmdomain, | |
62 | .pr_protocol = PROTO_NATMAAL5, | 62 | .pr_protocol = PROTO_NATMAAL5, | |
63 | .pr_flags = PR_CONNREQUIRED, | 63 | .pr_flags = PR_CONNREQUIRED, | |
64 | .pr_input = 0, | 64 | .pr_input = 0, | |
65 | .pr_output = 0, | |||
66 | .pr_ctlinput = 0, | 65 | .pr_ctlinput = 0, | |
67 | .pr_ctloutput = 0, | 66 | .pr_ctloutput = 0, | |
68 | .pr_usrreqs = &natm_usrreq, | 67 | .pr_usrreqs = &natm_usrreq, | |
69 | .pr_init = 0, | 68 | .pr_init = 0, | |
70 | .pr_fasttimo = 0, | 69 | .pr_fasttimo = 0, | |
71 | .pr_slowtimo = 0, | 70 | .pr_slowtimo = 0, | |
72 | .pr_drain = 0 | 71 | .pr_drain = 0 | |
73 | }, | 72 | }, | |
74 | { .pr_type = SOCK_DGRAM, | 73 | { .pr_type = SOCK_DGRAM, | |
75 | .pr_domain = &natmdomain, | 74 | .pr_domain = &natmdomain, | |
76 | .pr_protocol = PROTO_NATMAAL5, | 75 | .pr_protocol = PROTO_NATMAAL5, | |
77 | .pr_flags = PR_CONNREQUIRED | PR_ATOMIC, | 76 | .pr_flags = PR_CONNREQUIRED | PR_ATOMIC, | |
78 | .pr_input = 0, | 77 | .pr_input = 0, | |
79 | .pr_output = 0, | |||
80 | .pr_ctlinput = 0, | 78 | .pr_ctlinput = 0, | |
81 | .pr_ctloutput = 0, | 79 | .pr_ctloutput = 0, | |
82 | .pr_usrreqs = &natm_usrreq, | 80 | .pr_usrreqs = &natm_usrreq, | |
83 | .pr_init = 0, | 81 | .pr_init = 0, | |
84 | .pr_fasttimo = 0, | 82 | .pr_fasttimo = 0, | |
85 | .pr_slowtimo = 0, | 83 | .pr_slowtimo = 0, | |
86 | .pr_drain = 0 | 84 | .pr_drain = 0 | |
87 | }, | 85 | }, | |
88 | { .pr_type = SOCK_STREAM, | 86 | { .pr_type = SOCK_STREAM, | |
89 | .pr_domain = &natmdomain, | 87 | .pr_domain = &natmdomain, | |
90 | .pr_protocol = PROTO_NATMAAL0, | 88 | .pr_protocol = PROTO_NATMAAL0, | |
91 | .pr_flags = PR_CONNREQUIRED, | 89 | .pr_flags = PR_CONNREQUIRED, | |
92 | .pr_input = 0, | 90 | .pr_input = 0, | |
93 | .pr_output = 0, | |||
94 | .pr_ctlinput = 0, | 91 | .pr_ctlinput = 0, | |
95 | .pr_ctloutput = 0, | 92 | .pr_ctloutput = 0, | |
96 | .pr_usrreqs = &natm_usrreqs, | 93 | .pr_usrreqs = &natm_usrreqs, | |
97 | .pr_init = 0, | 94 | .pr_init = 0, | |
98 | .pr_fasttimo = 0, | 95 | .pr_fasttimo = 0, | |
99 | .pr_slowtimo = 0, | 96 | .pr_slowtimo = 0, | |
100 | .pr_drain = 0 | 97 | .pr_drain = 0 | |
101 | }, | 98 | }, | |
102 | }; | 99 | }; | |
103 | 100 | |||
104 | struct domain natmdomain = { | 101 | struct domain natmdomain = { | |
105 | .dom_family = PF_NATM, | 102 | .dom_family = PF_NATM, | |
106 | .dom_name = "natm", | 103 | .dom_name = "natm", |
--- src/sys/sys/protosw.h 2015/10/13 21:28:34 1.65
+++ src/sys/sys/protosw.h 2016/01/20 21:43:59 1.66
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: protosw.h,v 1.65 2015/10/13 21:28:34 rjs Exp $ */ | 1 | /* $NetBSD: protosw.h,v 1.66 2016/01/20 21:43:59 riastradh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1982, 1986, 1993 | 4 | * Copyright (c) 1982, 1986, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -67,28 +67,26 @@ struct domain; | @@ -67,28 +67,26 @@ struct domain; | |||
67 | struct proc; | 67 | struct proc; | |
68 | struct lwp; | 68 | struct lwp; | |
69 | struct pr_usrreqs; | 69 | struct pr_usrreqs; | |
70 | 70 | |||
71 | struct protosw { | 71 | struct protosw { | |
72 | int pr_type; /* socket type used for */ | 72 | int pr_type; /* socket type used for */ | |
73 | struct domain *pr_domain; /* domain protocol a member of */ | 73 | struct domain *pr_domain; /* domain protocol a member of */ | |
74 | short pr_protocol; /* protocol number */ | 74 | short pr_protocol; /* protocol number */ | |
75 | short pr_flags; /* see below */ | 75 | short pr_flags; /* see below */ | |
76 | 76 | |||
77 | /* protocol-protocol hooks */ | 77 | /* protocol-protocol hooks */ | |
78 | void (*pr_input) /* input to protocol (from below) */ | 78 | void (*pr_input) /* input to protocol (from below) */ | |
79 | (struct mbuf *, ...); | 79 | (struct mbuf *, ...); | |
80 | int (*pr_output) /* output to protocol (from above) */ | |||
81 | (struct mbuf *, ...); | |||
82 | void *(*pr_ctlinput) /* control input (from below) */ | 80 | void *(*pr_ctlinput) /* control input (from below) */ | |
83 | (int, const struct sockaddr *, void *); | 81 | (int, const struct sockaddr *, void *); | |
84 | int (*pr_ctloutput) /* control output (from above) */ | 82 | int (*pr_ctloutput) /* control output (from above) */ | |
85 | (int, struct socket *, struct sockopt *); | 83 | (int, struct socket *, struct sockopt *); | |
86 | 84 | |||
87 | /* user-protocol hooks */ | 85 | /* user-protocol hooks */ | |
88 | const struct pr_usrreqs *pr_usrreqs; | 86 | const struct pr_usrreqs *pr_usrreqs; | |
89 | 87 | |||
90 | /* utility hooks */ | 88 | /* utility hooks */ | |
91 | void (*pr_init) /* initialization hook */ | 89 | void (*pr_init) /* initialization hook */ | |
92 | (void); | 90 | (void); | |
93 | 91 | |||
94 | void (*pr_fasttimo) /* fast timeout (200ms) */ | 92 | void (*pr_fasttimo) /* fast timeout (200ms) */ |