summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_pcb.c
diff options
context:
space:
mode:
authorshin <shin@FreeBSD.org>2000-04-01 22:35:47 +0000
committershin <shin@FreeBSD.org>2000-04-01 22:35:47 +0000
commit09037f119d2c35c390f84835c3d3c3cf94edebac (patch)
tree7ddb7387fe3b1afce957dd83bcb7a07caca09946 /sys/netinet/in_pcb.c
parent79ce44e00159f8824aacf50b6227f404788f59ad (diff)
downloadFreeBSD-src-09037f119d2c35c390f84835c3d3c3cf94edebac.zip
FreeBSD-src-09037f119d2c35c390f84835c3d3c3cf94edebac.tar.gz
Support per socket based IPv4 mapped IPv6 addr enable/disable control.
Submitted by: ume
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r--sys/netinet/in_pcb.c9
1 files changed, 7 insertions, 2 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) !=
OpenPOWER on IntegriCloud