| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: natm.c,v 1.49 2015/05/02 17:18:04 rtr Exp $ */ | | 1 | /* $NetBSD: natm.c,v 1.50 2015/11/06 21:33:07 christos 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 | * natm.c: native mode ATM access (both aal0 and aal5). | | 29 | * natm.c: native mode ATM access (both aal0 and aal5). |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: natm.c,v 1.49 2015/05/02 17:18:04 rtr Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: natm.c,v 1.50 2015/11/06 21:33:07 christos Exp $"); |
34 | | | 34 | |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | #include <sys/kmem.h> | | 36 | #include <sys/kmem.h> |
37 | #include <sys/systm.h> | | 37 | #include <sys/systm.h> |
38 | #include <sys/kernel.h> | | 38 | #include <sys/kernel.h> |
39 | #include <sys/domain.h> | | 39 | #include <sys/domain.h> |
40 | #include <sys/ioctl.h> | | 40 | #include <sys/ioctl.h> |
41 | #include <sys/protosw.h> | | 41 | #include <sys/protosw.h> |
42 | #include <sys/mbuf.h> | | 42 | #include <sys/mbuf.h> |
43 | #include <sys/socket.h> | | 43 | #include <sys/socket.h> |
44 | #include <sys/socketvar.h> | | 44 | #include <sys/socketvar.h> |
45 | | | 45 | |
46 | #include <net/if.h> | | 46 | #include <net/if.h> |
| @@ -115,37 +115,37 @@ natm_bind(struct socket *so, struct sock | | | @@ -115,37 +115,37 @@ natm_bind(struct socket *so, struct sock |
115 | | | 115 | |
116 | static int | | 116 | static int |
117 | natm_listen(struct socket *so, struct lwp *l) | | 117 | natm_listen(struct socket *so, struct lwp *l) |
118 | { | | 118 | { |
119 | KASSERT(solocked(so)); | | 119 | KASSERT(solocked(so)); |
120 | | | 120 | |
121 | return EOPNOTSUPP; | | 121 | return EOPNOTSUPP; |
122 | } | | 122 | } |
123 | | | 123 | |
124 | static int | | 124 | static int |
125 | natm_connect(struct socket *so, struct sockaddr *nam, struct lwp *l) | | 125 | natm_connect(struct socket *so, struct sockaddr *nam, struct lwp *l) |
126 | { | | 126 | { |
127 | int error = 0, s2; | | 127 | int error = 0, s2; |
128 | struct natmpcb *npcb; | | 128 | struct natmpcb *npcb = (struct natmpcb *)so->so_pcb; |
129 | struct sockaddr_natm *snatm = (struct sockaddr_natm *)nam; | | 129 | struct sockaddr_natm *snatm = (struct sockaddr_natm *)nam; |
130 | struct atm_pseudoioctl api; | | 130 | struct atm_pseudoioctl api; |
131 | struct atm_pseudohdr *aph; | | 131 | struct atm_pseudohdr *aph; |
132 | struct ifnet *ifp; | | 132 | struct ifnet *ifp; |
133 | int proto = so->so_proto->pr_protocol; | | 133 | int proto = so->so_proto->pr_protocol; |
134 | | | 134 | |
135 | KASSERT(solocked(so)); | | 135 | KASSERT(solocked(so)); |
136 | | | 136 | |
137 | /* | | 137 | /* |
138 | * validate nam and npcb | | 138 | * validate snatm and npcb |
139 | */ | | 139 | */ |
140 | | | 140 | |
141 | if (snatm->snatm_len != sizeof(*snatm) || | | 141 | if (snatm->snatm_len != sizeof(*snatm) || |
142 | (npcb->npcb_flags & NPCB_FREE) == 0) | | 142 | (npcb->npcb_flags & NPCB_FREE) == 0) |
143 | return EINVAL; | | 143 | return EINVAL; |
144 | if (snatm->snatm_family != AF_NATM) | | 144 | if (snatm->snatm_family != AF_NATM) |
145 | return EAFNOSUPPORT; | | 145 | return EAFNOSUPPORT; |
146 | | | 146 | |
147 | snatm->snatm_if[IFNAMSIZ-1] = '\0'; /* XXX ensure null termination | | 147 | snatm->snatm_if[IFNAMSIZ-1] = '\0'; /* XXX ensure null termination |
148 | since ifunit() uses strcmp */ | | 148 | since ifunit() uses strcmp */ |
149 | | | 149 | |
150 | /* | | 150 | /* |
151 | * convert interface string to ifp, validate. | | 151 | * convert interface string to ifp, validate. |