tcp_usrreq.c (75733) | tcp_usrreq.c (78064) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 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 31 * SUCH DAMAGE. 32 * 33 * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94 | 1/* 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 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 31 * SUCH DAMAGE. 32 * 33 * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94 |
34 * $FreeBSD: head/sys/netinet/tcp_usrreq.c 75733 2001-04-20 11:58:56Z jesper $ | 34 * $FreeBSD: head/sys/netinet/tcp_usrreq.c 78064 2001-06-11 12:39:29Z ume $ |
35 */ 36 37#include "opt_ipsec.h" 38#include "opt_inet6.h" 39#include "opt_tcpdebug.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> --- 192 unchanged lines hidden (view full) --- 235 sin6p = (struct sockaddr_in6 *)nam; 236 if (sin6p->sin6_family == AF_INET6 && 237 IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) { 238 error = EAFNOSUPPORT; 239 goto out; 240 } 241 inp->inp_vflag &= ~INP_IPV4; 242 inp->inp_vflag |= INP_IPV6; | 35 */ 36 37#include "opt_ipsec.h" 38#include "opt_inet6.h" 39#include "opt_tcpdebug.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> --- 192 unchanged lines hidden (view full) --- 235 sin6p = (struct sockaddr_in6 *)nam; 236 if (sin6p->sin6_family == AF_INET6 && 237 IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) { 238 error = EAFNOSUPPORT; 239 goto out; 240 } 241 inp->inp_vflag &= ~INP_IPV4; 242 inp->inp_vflag |= INP_IPV6; |
243 if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0) { 244 | 243 if (ip6_mapped_addr_on && (inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { |
245 if (IN6_IS_ADDR_UNSPECIFIED(&sin6p->sin6_addr)) 246 inp->inp_vflag |= INP_IPV4; 247 else if (IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) { 248 struct sockaddr_in sin; 249 250 in6_sin6_2_sin(&sin, sin6p); 251 inp->inp_vflag |= INP_IPV4; 252 inp->inp_vflag &= ~INP_IPV6; --- 34 unchanged lines hidden (view full) --- 287 int s = splnet(); 288 int error = 0; 289 struct inpcb *inp = sotoinpcb(so); 290 struct tcpcb *tp; 291 292 COMMON_START(); 293 if (inp->inp_lport == 0) { 294 inp->inp_vflag &= ~INP_IPV4; | 244 if (IN6_IS_ADDR_UNSPECIFIED(&sin6p->sin6_addr)) 245 inp->inp_vflag |= INP_IPV4; 246 else if (IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) { 247 struct sockaddr_in sin; 248 249 in6_sin6_2_sin(&sin, sin6p); 250 inp->inp_vflag |= INP_IPV4; 251 inp->inp_vflag &= ~INP_IPV6; --- 34 unchanged lines hidden (view full) --- 286 int s = splnet(); 287 int error = 0; 288 struct inpcb *inp = sotoinpcb(so); 289 struct tcpcb *tp; 290 291 COMMON_START(); 292 if (inp->inp_lport == 0) { 293 inp->inp_vflag &= ~INP_IPV4; |
295 if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0) | 294 if (ip6_mapped_addr_on && 295 (inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) |
296 inp->inp_vflag |= INP_IPV4; 297 error = in6_pcbbind(inp, (struct sockaddr *)0, p); 298 } 299 if (error == 0) 300 tp->t_state = TCPS_LISTEN; 301 COMMON_END(PRU_LISTEN); 302} 303#endif /* INET6 */ --- 52 unchanged lines hidden (view full) --- 356 */ 357 sin6p = (struct sockaddr_in6 *)nam; 358 if (sin6p->sin6_family == AF_INET6 359 && IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) { 360 error = EAFNOSUPPORT; 361 goto out; 362 } 363 | 296 inp->inp_vflag |= INP_IPV4; 297 error = in6_pcbbind(inp, (struct sockaddr *)0, p); 298 } 299 if (error == 0) 300 tp->t_state = TCPS_LISTEN; 301 COMMON_END(PRU_LISTEN); 302} 303#endif /* INET6 */ --- 52 unchanged lines hidden (view full) --- 356 */ 357 sin6p = (struct sockaddr_in6 *)nam; 358 if (sin6p->sin6_family == AF_INET6 359 && IN6_IS_ADDR_MULTICAST(&sin6p->sin6_addr)) { 360 error = EAFNOSUPPORT; 361 goto out; 362 } 363 |
364 if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0 && 365 IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) { | 364 if (IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) { |
366 struct sockaddr_in sin; 367 | 365 struct sockaddr_in sin; 366 |
367 if (!ip6_mapped_addr_on || 368 (inp->inp_flags & IN6P_IPV6_V6ONLY)) 369 return(EINVAL); 370 |
|
368 in6_sin6_2_sin(&sin, sin6p); 369 inp->inp_vflag |= INP_IPV4; 370 inp->inp_vflag &= ~INP_IPV6; 371 if ((error = tcp_connect(tp, (struct sockaddr *)&sin, p)) != 0) 372 goto out; 373 error = tcp_output(tp); 374 goto out; 375 } --- 776 unchanged lines hidden --- | 371 in6_sin6_2_sin(&sin, sin6p); 372 inp->inp_vflag |= INP_IPV4; 373 inp->inp_vflag &= ~INP_IPV6; 374 if ((error = tcp_connect(tp, (struct sockaddr *)&sin, p)) != 0) 375 goto out; 376 error = tcp_output(tp); 377 goto out; 378 } --- 776 unchanged lines hidden --- |