diff options
author | shin <shin@FreeBSD.org> | 2000-04-01 22:35:47 +0000 |
---|---|---|
committer | shin <shin@FreeBSD.org> | 2000-04-01 22:35:47 +0000 |
commit | 09037f119d2c35c390f84835c3d3c3cf94edebac (patch) | |
tree | 7ddb7387fe3b1afce957dd83bcb7a07caca09946 | |
parent | 79ce44e00159f8824aacf50b6227f404788f59ad (diff) | |
download | FreeBSD-src-09037f119d2c35c390f84835c3d3c3cf94edebac.zip FreeBSD-src-09037f119d2c35c390f84835c3d3c3cf94edebac.tar.gz |
Support per socket based IPv4 mapped IPv6 addr enable/disable control.
Submitted by: ume
-rw-r--r-- | sys/netinet/in_pcb.c | 9 | ||||
-rw-r--r-- | sys/netinet/tcp_input.c | 2 | ||||
-rw-r--r-- | sys/netinet/tcp_reass.c | 2 | ||||
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 7 | ||||
-rw-r--r-- | sys/netinet6/in6_pcb.c | 4 | ||||
-rw-r--r-- | sys/netinet6/udp6_usrreq.c | 6 |
6 files changed, 17 insertions, 13 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 020987e..d042c0b 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -153,6 +153,10 @@ in_pcballoc(so, pcbinfo, p) inp->inp_gencnt = ++pcbinfo->ipi_gencnt; inp->inp_pcbinfo = pcbinfo; inp->inp_socket = so; + if (ip6_mapped_addr_on) + inp->inp_flags &= ~IN6P_BINDV6ONLY; + else + inp->inp_flags |= IN6P_BINDV6ONLY; LIST_INSERT_HEAD(pcbinfo->listhead, inp, inp_list); pcbinfo->ipi_count++; so->so_pcb = (caddr_t)inp; @@ -231,7 +235,8 @@ in_pcbbind(inp, nam, p) (so->so_cred->cr_uid != t->inp_socket->so_cred->cr_uid)) { #if defined(INET6) - if (ip6_mapped_addr_on == 0 || + if ((inp->inp_flags & + IN6P_BINDV6ONLY) != 0 || ntohl(sin->sin_addr.s_addr) != INADDR_ANY || ntohl(t->inp_laddr.s_addr) != @@ -247,7 +252,7 @@ in_pcbbind(inp, nam, p) if (t && (reuseport & t->inp_socket->so_options) == 0) { #if defined(INET6) - if (ip6_mapped_addr_on == 0 || + if ((inp->inp_flags & IN6P_BINDV6ONLY) != 0 || ntohl(sin->sin_addr.s_addr) != INADDR_ANY || ntohl(t->inp_laddr.s_addr) != diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index dc8ba3c..ade6f79 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -740,7 +740,7 @@ findpcb: if (isipv6) inp->in6p_laddr = ip6->ip6_dst; else { - if (ip6_mapped_addr_on) { + if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0) { inp->inp_vflag &= ~INP_IPV6; inp->inp_vflag |= INP_IPV4; } diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index dc8ba3c..ade6f79 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -740,7 +740,7 @@ findpcb: if (isipv6) inp->in6p_laddr = ip6->ip6_dst; else { - if (ip6_mapped_addr_on) { + if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0) { inp->inp_vflag &= ~INP_IPV6; inp->inp_vflag |= INP_IPV4; } diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 7ae34e9..6feb666 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -238,7 +238,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct proc *p) } inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; - if (ip6_mapped_addr_on && (inp->inp_flags & IN6P_BINDV6ONLY) == NULL) { + if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0) { if (IN6_IS_ADDR_UNSPECIFIED(&sin6p->sin6_addr)) inp->inp_vflag |= INP_IPV4; @@ -290,8 +290,7 @@ tcp6_usr_listen(struct socket *so, struct proc *p) COMMON_START(); if (inp->inp_lport == 0) { inp->inp_vflag &= ~INP_IPV4; - if (ip6_mapped_addr_on && - (inp->inp_flags & IN6P_BINDV6ONLY) == NULL) + if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0) inp->inp_vflag |= INP_IPV4; error = in6_pcbbind(inp, (struct sockaddr *)0, p); } @@ -359,7 +358,7 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct proc *p) goto out; } - if (ip6_mapped_addr_on && + if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0 && IN6_IS_ADDR_V4MAPPED(&sin6p->sin6_addr)) { struct sockaddr_in sin; diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 341260a..73c169b 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -224,7 +224,7 @@ in6_pcbbind(inp, nam, p) (so->so_cred->cr_uid != t->inp_socket->so_cred->cr_uid)) return (EADDRINUSE); - if (ip6_mapped_addr_on != 0 && + if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0 && IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { struct sockaddr_in sin; @@ -246,7 +246,7 @@ in6_pcbbind(inp, nam, p) lport, wild); if (t && (reuseport & t->inp_socket->so_options) == 0) return(EADDRINUSE); - if (ip6_mapped_addr_on != 0 && + if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0 && IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { struct sockaddr_in sin; diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 15ba9a2..0ba04ab 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -670,7 +670,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, struct proc *p) inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; - if (ip6_mapped_addr_on && (inp->inp_flags & IN6P_BINDV6ONLY) == 0) { + if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0) { struct sockaddr_in6 *sin6_p; sin6_p = (struct sockaddr_in6 *)nam; @@ -705,7 +705,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct proc *p) inp = sotoinpcb(so); if (inp == 0) return EINVAL; - if (ip6_mapped_addr_on) { + if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0) { struct sockaddr_in6 *sin6_p; sin6_p = (struct sockaddr_in6 *)nam; @@ -794,7 +794,7 @@ udp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, return EINVAL; } - if (ip6_mapped_addr_on) { + if ((inp->inp_flags & IN6P_BINDV6ONLY) == 0) { int hasv4addr; struct sockaddr_in6 *sin6 = 0; |