Sun May 24 15:43:45 2015 UTC ()
remove transitional functions in{,6}_pcbconnect_m() that were used in
converting protocol user requests to accept sockaddr instead of mbufs.

remove tcp_input copy in to mbuf from sockaddr and just copy to sockaddr
to make it possible for the transitional functions to go away.

no version bump since these functions only existed for a short time and
were commented as adapters (they appeared in 7.99.15).


(rtr)
diff -r1.160 -r1.161 src/sys/netinet/in_pcb.c
diff -r1.58 -r1.59 src/sys/netinet/in_pcb.h
diff -r1.340 -r1.341 src/sys/netinet/tcp_input.c
diff -r1.141 -r1.142 src/sys/netinet6/in6_pcb.c
diff -r1.45 -r1.46 src/sys/netinet6/in6_pcb.h

cvs diff -r1.160 -r1.161 src/sys/netinet/in_pcb.c (expand / switch to unified diff)

--- src/sys/netinet/in_pcb.c 2015/05/02 17:18:03 1.160
+++ src/sys/netinet/in_pcb.c 2015/05/24 15:43:45 1.161
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in_pcb.c,v 1.160 2015/05/02 17:18:03 rtr Exp $ */ 1/* $NetBSD: in_pcb.c,v 1.161 2015/05/24 15:43:45 rtr 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.
@@ -83,27 +83,27 @@ @@ -83,27 +83,27 @@
83 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 83 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
84 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 84 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
85 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 85 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
86 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 86 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
87 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 87 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
88 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 88 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
89 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 89 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
90 * SUCH DAMAGE. 90 * SUCH DAMAGE.
91 * 91 *
92 * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95 92 * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95
93 */ 93 */
94 94
95#include <sys/cdefs.h> 95#include <sys/cdefs.h>
96__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.160 2015/05/02 17:18:03 rtr Exp $"); 96__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.161 2015/05/24 15:43:45 rtr Exp $");
97 97
98#include "opt_inet.h" 98#include "opt_inet.h"
99#include "opt_ipsec.h" 99#include "opt_ipsec.h"
100 100
101#include <sys/param.h> 101#include <sys/param.h>
102#include <sys/systm.h> 102#include <sys/systm.h>
103#include <sys/mbuf.h> 103#include <sys/mbuf.h>
104#include <sys/protosw.h> 104#include <sys/protosw.h>
105#include <sys/socket.h> 105#include <sys/socket.h>
106#include <sys/socketvar.h> 106#include <sys/socketvar.h>
107#include <sys/ioctl.h> 107#include <sys/ioctl.h>
108#include <sys/errno.h> 108#include <sys/errno.h>
109#include <sys/time.h> 109#include <sys/time.h>
@@ -433,41 +433,26 @@ in_pcbbind(void *v, struct sockaddr_in * @@ -433,41 +433,26 @@ in_pcbbind(void *v, struct sockaddr_in *
433 433
434 /* Bind port. */ 434 /* Bind port. */
435 error = in_pcbbind_port(inp, sin, l->l_cred); 435 error = in_pcbbind_port(inp, sin, l->l_cred);
436 if (error) { 436 if (error) {
437 inp->inp_laddr.s_addr = INADDR_ANY; 437 inp->inp_laddr.s_addr = INADDR_ANY;
438 438
439 return (error); 439 return (error);
440 } 440 }
441 441
442 return (0); 442 return (0);
443} 443}
444 444
445/* 445/*
446 * adapter function that accepts nam as mbuf for in_pcbconnect() 
447 */ 
448int 
449in_pcbconnect_m(void *v, struct mbuf *nam, struct lwp *l) 
450{ 
451 struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *); 
452 
453 if (sizeof (*sin) != nam->m_len) { 
454 return EINVAL; 
455 } 
456 
457 return in_pcbconnect(v, sin, l); 
458} 
459 
460/* 
461 * Connect from a socket to a specified address. 446 * Connect from a socket to a specified address.
462 * Both address and port must be specified in argument sin. 447 * Both address and port must be specified in argument sin.
463 * If don't have a local address for this socket yet, 448 * If don't have a local address for this socket yet,
464 * then pick one. 449 * then pick one.
465 */ 450 */
466int 451int
467in_pcbconnect(void *v, struct sockaddr_in *sin, struct lwp *l) 452in_pcbconnect(void *v, struct sockaddr_in *sin, struct lwp *l)
468{ 453{
469 struct inpcb *inp = v; 454 struct inpcb *inp = v;
470 struct in_ifaddr *ia = NULL; 455 struct in_ifaddr *ia = NULL;
471 struct sockaddr_in *ifaddr = NULL; 456 struct sockaddr_in *ifaddr = NULL;
472 vestigial_inpcb_t vestige; 457 vestigial_inpcb_t vestige;
473 int error; 458 int error;

cvs diff -r1.58 -r1.59 src/sys/netinet/in_pcb.h (expand / switch to unified diff)

--- src/sys/netinet/in_pcb.h 2015/05/02 17:18:03 1.58
+++ src/sys/netinet/in_pcb.h 2015/05/24 15:43:45 1.59
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in_pcb.h,v 1.58 2015/05/02 17:18:03 rtr Exp $ */ 1/* $NetBSD: in_pcb.h,v 1.59 2015/05/24 15:43:45 rtr 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.
@@ -123,27 +123,26 @@ struct inpcb { @@ -123,27 +123,26 @@ struct inpcb {
123#define INP_PKTINFO 0x1000 /* receive dst packet info */ 123#define INP_PKTINFO 0x1000 /* receive dst packet info */
124#define INP_RECVPKTINFO 0x2000 /* receive dst packet info */ 124#define INP_RECVPKTINFO 0x2000 /* receive dst packet info */
125#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ 125#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\
126 INP_RECVIF|INP_RECVTTL|INP_RECVPKTINFO|\ 126 INP_RECVIF|INP_RECVTTL|INP_RECVPKTINFO|\
127 INP_PKTINFO) 127 INP_PKTINFO)
128 128
129#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) 129#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
130 130
131#ifdef _KERNEL 131#ifdef _KERNEL
132void in_losing(struct inpcb *); 132void in_losing(struct inpcb *);
133int in_pcballoc(struct socket *, void *); 133int in_pcballoc(struct socket *, void *);
134int in_pcbbind(void *, struct sockaddr_in *, struct lwp *); 134int in_pcbbind(void *, struct sockaddr_in *, struct lwp *);
135int in_pcbconnect(void *, struct sockaddr_in *, struct lwp *); 135int in_pcbconnect(void *, struct sockaddr_in *, struct lwp *);
136int in_pcbconnect_m(void *, struct mbuf *, struct lwp *); 
137void in_pcbdetach(void *); 136void in_pcbdetach(void *);
138void in_pcbdisconnect(void *); 137void in_pcbdisconnect(void *);
139void in_pcbinit(struct inpcbtable *, int, int); 138void in_pcbinit(struct inpcbtable *, int, int);
140struct inpcb * 139struct inpcb *
141 in_pcblookup_port(struct inpcbtable *, 140 in_pcblookup_port(struct inpcbtable *,
142 struct in_addr, u_int, int, struct vestigial_inpcb *); 141 struct in_addr, u_int, int, struct vestigial_inpcb *);
143struct inpcb * 142struct inpcb *
144 in_pcblookup_bind(struct inpcbtable *, 143 in_pcblookup_bind(struct inpcbtable *,
145 struct in_addr, u_int); 144 struct in_addr, u_int);
146struct inpcb * 145struct inpcb *
147 in_pcblookup_connect(struct inpcbtable *, 146 in_pcblookup_connect(struct inpcbtable *,
148 struct in_addr, u_int, struct in_addr, u_int, 147 struct in_addr, u_int, struct in_addr, u_int,
149 struct vestigial_inpcb *); 148 struct vestigial_inpcb *);

cvs diff -r1.340 -r1.341 src/sys/netinet/tcp_input.c (expand / switch to unified diff)

--- src/sys/netinet/tcp_input.c 2015/05/15 18:03:45 1.340
+++ src/sys/netinet/tcp_input.c 2015/05/24 15:43:45 1.341
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tcp_input.c,v 1.340 2015/05/15 18:03:45 kefren Exp $ */ 1/* $NetBSD: tcp_input.c,v 1.341 2015/05/24 15:43:45 rtr 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.
@@ -138,27 +138,27 @@ @@ -138,27 +138,27 @@
138 */ 138 */
139 139
140/* 140/*
141 * TODO list for SYN cache stuff: 141 * TODO list for SYN cache stuff:
142 * 142 *
143 * Find room for a "state" field, which is needed to keep a 143 * Find room for a "state" field, which is needed to keep a
144 * compressed state for TIME_WAIT TCBs. It's been noted already 144 * compressed state for TIME_WAIT TCBs. It's been noted already
145 * that this is fairly important for very high-volume web and 145 * that this is fairly important for very high-volume web and
146 * mail servers, which use a large number of short-lived 146 * mail servers, which use a large number of short-lived
147 * connections. 147 * connections.
148 */ 148 */
149 149
150#include <sys/cdefs.h> 150#include <sys/cdefs.h>
151__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.340 2015/05/15 18:03:45 kefren Exp $"); 151__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.341 2015/05/24 15:43:45 rtr Exp $");
152 152
153#include "opt_inet.h" 153#include "opt_inet.h"
154#include "opt_ipsec.h" 154#include "opt_ipsec.h"
155#include "opt_inet_csum.h" 155#include "opt_inet_csum.h"
156#include "opt_tcp_debug.h" 156#include "opt_tcp_debug.h"
157 157
158#include <sys/param.h> 158#include <sys/param.h>
159#include <sys/systm.h> 159#include <sys/systm.h>
160#include <sys/malloc.h> 160#include <sys/malloc.h>
161#include <sys/mbuf.h> 161#include <sys/mbuf.h>
162#include <sys/protosw.h> 162#include <sys/protosw.h>
163#include <sys/socket.h> 163#include <sys/socket.h>
164#include <sys/socketvar.h> 164#include <sys/socketvar.h>
@@ -3908,27 +3908,26 @@ syn_cache_lookup(const struct sockaddr * @@ -3908,27 +3908,26 @@ syn_cache_lookup(const struct sockaddr *
3908 */ 3908 */
3909struct socket * 3909struct socket *
3910syn_cache_get(struct sockaddr *src, struct sockaddr *dst, 3910syn_cache_get(struct sockaddr *src, struct sockaddr *dst,
3911 struct tcphdr *th, unsigned int hlen, unsigned int tlen, 3911 struct tcphdr *th, unsigned int hlen, unsigned int tlen,
3912 struct socket *so, struct mbuf *m) 3912 struct socket *so, struct mbuf *m)
3913{ 3913{
3914 struct syn_cache *sc; 3914 struct syn_cache *sc;
3915 struct syn_cache_head *scp; 3915 struct syn_cache_head *scp;
3916 struct inpcb *inp = NULL; 3916 struct inpcb *inp = NULL;
3917#ifdef INET6 3917#ifdef INET6
3918 struct in6pcb *in6p = NULL; 3918 struct in6pcb *in6p = NULL;
3919#endif 3919#endif
3920 struct tcpcb *tp = 0; 3920 struct tcpcb *tp = 0;
3921 struct mbuf *am; 
3922 int s; 3921 int s;
3923 struct socket *oso; 3922 struct socket *oso;
3924 3923
3925 s = splsoftnet(); 3924 s = splsoftnet();
3926 if ((sc = syn_cache_lookup(src, dst, &scp)) == NULL) { 3925 if ((sc = syn_cache_lookup(src, dst, &scp)) == NULL) {
3927 splx(s); 3926 splx(s);
3928 return (NULL); 3927 return (NULL);
3929 } 3928 }
3930 3929
3931 /* 3930 /*
3932 * Verify the sequence and ack numbers. Try getting the correct 3931 * Verify the sequence and ack numbers. Try getting the correct
3933 * response again. 3932 * response again.
3934 */ 3933 */
@@ -4059,65 +4058,56 @@ syn_cache_get(struct sockaddr *src, stru @@ -4059,65 +4058,56 @@ syn_cache_get(struct sockaddr *src, stru
4059 * Give the new socket our cached route reference. 4058 * Give the new socket our cached route reference.
4060 */ 4059 */
4061 if (inp) { 4060 if (inp) {
4062 rtcache_copy(&inp->inp_route, &sc->sc_route); 4061 rtcache_copy(&inp->inp_route, &sc->sc_route);
4063 rtcache_free(&sc->sc_route); 4062 rtcache_free(&sc->sc_route);
4064 } 4063 }
4065#ifdef INET6 4064#ifdef INET6
4066 else { 4065 else {
4067 rtcache_copy(&in6p->in6p_route, &sc->sc_route); 4066 rtcache_copy(&in6p->in6p_route, &sc->sc_route);
4068 rtcache_free(&sc->sc_route); 4067 rtcache_free(&sc->sc_route);
4069 } 4068 }
4070#endif 4069#endif
4071 4070
4072 am = m_get(M_DONTWAIT, MT_SONAME); /* XXX */ 
4073 if (am == NULL) 
4074 goto resetandabort; 
4075 MCLAIM(am, &tcp_mowner); 
4076 am->m_len = src->sa_len; 
4077 bcopy(src, mtod(am, void *), src->sa_len); 
4078 if (inp) { 4071 if (inp) {
4079 if (in_pcbconnect_m(inp, am, &lwp0)) { 4072 struct sockaddr_in sin;
4080 (void) m_free(am); 4073 memcpy(&sin, src, src->sa_len);
 4074 if (in_pcbconnect(inp, &sin, &lwp0)) {
4081 goto resetandabort; 4075 goto resetandabort;
4082 } 4076 }
4083 } 4077 }
4084#ifdef INET6 4078#ifdef INET6
4085 else if (in6p) { 4079 else if (in6p) {
 4080 struct sockaddr_in6 sin6;
 4081 memcpy(&sin6, src, src->sa_len);
4086 if (src->sa_family == AF_INET) { 4082 if (src->sa_family == AF_INET) {
4087 /* IPv4 packet to AF_INET6 socket */ 4083 /* IPv4 packet to AF_INET6 socket */
4088 struct sockaddr_in6 *sin6; 4084 memset(&sin6, 0, sizeof(sin6));
4089 sin6 = mtod(am, struct sockaddr_in6 *); 4085 sin6.sin6_family = AF_INET6;
4090 am->m_len = sizeof(*sin6); 4086 sin6.sin6_len = sizeof(sin6);
4091 memset(sin6, 0, sizeof(*sin6)); 4087 sin6.sin6_port = ((struct sockaddr_in *)src)->sin_port;
4092 sin6->sin6_family = AF_INET6; 4088 sin6.sin6_addr.s6_addr16[5] = htons(0xffff);
4093 sin6->sin6_len = sizeof(*sin6); 
4094 sin6->sin6_port = ((struct sockaddr_in *)src)->sin_port; 
4095 sin6->sin6_addr.s6_addr16[5] = htons(0xffff); 
4096 bcopy(&((struct sockaddr_in *)src)->sin_addr, 4089 bcopy(&((struct sockaddr_in *)src)->sin_addr,
4097 &sin6->sin6_addr.s6_addr32[3], 4090 &sin6.sin6_addr.s6_addr32[3],
4098 sizeof(sin6->sin6_addr.s6_addr32[3])); 4091 sizeof(sin6.sin6_addr.s6_addr32[3]));
4099 } 4092 }
4100 if (in6_pcbconnect_m(in6p, am, NULL)) { 4093 if (in6_pcbconnect(in6p, &sin6, NULL)) {
4101 (void) m_free(am); 
4102 goto resetandabort; 4094 goto resetandabort;
4103 } 4095 }
4104 } 4096 }
4105#endif 4097#endif
4106 else { 4098 else {
4107 (void) m_free(am); 
4108 goto resetandabort; 4099 goto resetandabort;
4109 } 4100 }
4110 (void) m_free(am); 
4111 4101
4112 if (inp) 4102 if (inp)
4113 tp = intotcpcb(inp); 4103 tp = intotcpcb(inp);
4114#ifdef INET6 4104#ifdef INET6
4115 else if (in6p) 4105 else if (in6p)
4116 tp = in6totcpcb(in6p); 4106 tp = in6totcpcb(in6p);
4117#endif 4107#endif
4118 else 4108 else
4119 tp = NULL; 4109 tp = NULL;
4120 tp->t_flags = sototcpcb(oso)->t_flags & TF_NODELAY; 4110 tp->t_flags = sototcpcb(oso)->t_flags & TF_NODELAY;
4121 if (sc->sc_request_r_scale != 15) { 4111 if (sc->sc_request_r_scale != 15) {
4122 tp->requested_s_scale = sc->sc_requested_s_scale; 4112 tp->requested_s_scale = sc->sc_requested_s_scale;
4123 tp->request_r_scale = sc->sc_request_r_scale; 4113 tp->request_r_scale = sc->sc_request_r_scale;

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

--- src/sys/netinet6/in6_pcb.c 2015/05/19 01:14:40 1.141
+++ src/sys/netinet6/in6_pcb.c 2015/05/24 15:43:45 1.142
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in6_pcb.c,v 1.141 2015/05/19 01:14:40 ozaki-r Exp $ */ 1/* $NetBSD: in6_pcb.c,v 1.142 2015/05/24 15:43:45 rtr Exp $ */
2/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */ 2/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -52,27 +52,27 @@ @@ -52,27 +52,27 @@
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE. 59 * SUCH DAMAGE.
60 * 60 *
61 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 61 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.141 2015/05/19 01:14:40 ozaki-r Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.142 2015/05/24 15:43:45 rtr Exp $");
66 66
67#include "opt_inet.h" 67#include "opt_inet.h"
68#include "opt_ipsec.h" 68#include "opt_ipsec.h"
69 69
70#include <sys/param.h> 70#include <sys/param.h>
71#include <sys/systm.h> 71#include <sys/systm.h>
72#include <sys/mbuf.h> 72#include <sys/mbuf.h>
73#include <sys/protosw.h> 73#include <sys/protosw.h>
74#include <sys/socket.h> 74#include <sys/socket.h>
75#include <sys/socketvar.h> 75#include <sys/socketvar.h>
76#include <sys/ioctl.h> 76#include <sys/ioctl.h>
77#include <sys/errno.h> 77#include <sys/errno.h>
78#include <sys/time.h> 78#include <sys/time.h>
@@ -408,41 +408,26 @@ in6_pcbbind(void *v, struct sockaddr_in6 @@ -408,41 +408,26 @@ in6_pcbbind(void *v, struct sockaddr_in6
408 in6p->in6p_laddr = in6addr_any; 408 in6p->in6p_laddr = in6addr_any;
409 409
410 return (error); 410 return (error);
411 } 411 }
412 412
413 413
414#if 0 414#if 0
415 in6p->in6p_flowinfo = 0; /* XXX */ 415 in6p->in6p_flowinfo = 0; /* XXX */
416#endif 416#endif
417 return (0); 417 return (0);
418} 418}
419 419
420/* 420/*
421 * adapter function that accepts nam as mbuf for in6_pcbconnect 
422 */ 
423int 
424in6_pcbconnect_m(void *v, struct mbuf *nam, struct lwp *l) 
425{ 
426 struct sockaddr_in6 *sin6 = mtod(nam, struct sockaddr_in6 *); 
427 
428 if (sizeof (*sin6) != nam->m_len) { 
429 return EINVAL; 
430 } 
431 
432 return in6_pcbconnect(v, sin6, l); 
433} 
434 
435/* 
436 * Connect from a socket to a specified address. 421 * Connect from a socket to a specified address.
437 * Both address and port must be specified in argument sin6. 422 * Both address and port must be specified in argument sin6.
438 * If don't have a local address for this socket yet, 423 * If don't have a local address for this socket yet,
439 * then pick one. 424 * then pick one.
440 */ 425 */
441int 426int
442in6_pcbconnect(void *v, struct sockaddr_in6 *sin6, struct lwp *l) 427in6_pcbconnect(void *v, struct sockaddr_in6 *sin6, struct lwp *l)
443{ 428{
444 struct in6pcb *in6p = v; 429 struct in6pcb *in6p = v;
445 struct in6_addr *in6a = NULL; 430 struct in6_addr *in6a = NULL;
446 struct ifnet *ifp = NULL; /* outgoing interface */ 431 struct ifnet *ifp = NULL; /* outgoing interface */
447 int error = 0; 432 int error = 0;
448 int scope_ambiguous = 0; 433 int scope_ambiguous = 0;

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

--- src/sys/netinet6/in6_pcb.h 2015/05/02 17:18:03 1.45
+++ src/sys/netinet6/in6_pcb.h 2015/05/24 15:43:45 1.46
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: in6_pcb.h,v 1.45 2015/05/02 17:18:03 rtr Exp $ */ 1/* $NetBSD: in6_pcb.h,v 1.46 2015/05/24 15:43:45 rtr Exp $ */
2/* $KAME: in6_pcb.h,v 1.45 2001/02/09 05:59:46 itojun Exp $ */ 2/* $KAME: in6_pcb.h,v 1.45 2001/02/09 05:59:46 itojun Exp $ */
3 3
4/* 4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -148,27 +148,26 @@ struct in6pcb { @@ -148,27 +148,26 @@ struct in6pcb {
148 (((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^ \ 148 (((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^ \
149 (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3] ^ \ 149 (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3] ^ \
150 (laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^ \ 150 (laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^ \
151 (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3]) \ 151 (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3]) \
152 + (fport) + (lport)) 152 + (fport) + (lport))
153 153
154#define sotoin6pcb(so) ((struct in6pcb *)(so)->so_pcb) 154#define sotoin6pcb(so) ((struct in6pcb *)(so)->so_pcb)
155 155
156void in6_losing(struct in6pcb *); 156void in6_losing(struct in6pcb *);
157void in6_pcbinit(struct inpcbtable *, int, int); 157void in6_pcbinit(struct inpcbtable *, int, int);
158int in6_pcballoc(struct socket *, void *); 158int in6_pcballoc(struct socket *, void *);
159int in6_pcbbind(void *, struct sockaddr_in6 *, struct lwp *); 159int in6_pcbbind(void *, struct sockaddr_in6 *, struct lwp *);
160int in6_pcbconnect(void *, struct sockaddr_in6 *, struct lwp *); 160int in6_pcbconnect(void *, struct sockaddr_in6 *, struct lwp *);
161int in6_pcbconnect_m(void *, struct mbuf *, struct lwp *); 
162void in6_pcbdetach(struct in6pcb *); 161void in6_pcbdetach(struct in6pcb *);
163void in6_pcbdisconnect(struct in6pcb *); 162void in6_pcbdisconnect(struct in6pcb *);
164struct in6pcb *in6_pcblookup_port(struct inpcbtable *, struct in6_addr *, 163struct in6pcb *in6_pcblookup_port(struct inpcbtable *, struct in6_addr *,
165 u_int, int, struct vestigial_inpcb *); 164 u_int, int, struct vestigial_inpcb *);
166int in6_pcbnotify(struct inpcbtable *, const struct sockaddr *, 165int in6_pcbnotify(struct inpcbtable *, const struct sockaddr *,
167 u_int, const struct sockaddr *, u_int, int, void *, 166 u_int, const struct sockaddr *, u_int, int, void *,
168 void (*)(struct in6pcb *, int)); 167 void (*)(struct in6pcb *, int));
169void in6_pcbpurgeif0(struct inpcbtable *, struct ifnet *); 168void in6_pcbpurgeif0(struct inpcbtable *, struct ifnet *);
170void in6_pcbpurgeif(struct inpcbtable *, struct ifnet *); 169void in6_pcbpurgeif(struct inpcbtable *, struct ifnet *);
171void in6_pcbstate(struct in6pcb *, int); 170void in6_pcbstate(struct in6pcb *, int);
172void in6_rtchange(struct in6pcb *, int); 171void in6_rtchange(struct in6pcb *, int);
173void in6_setpeeraddr(struct in6pcb *, struct sockaddr_in6 *); 172void in6_setpeeraddr(struct in6pcb *, struct sockaddr_in6 *);
174void in6_setsockaddr(struct in6pcb *, struct sockaddr_in6 *); 173void in6_setsockaddr(struct in6pcb *, struct sockaddr_in6 *);