aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_syncache.c
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2018-03-16 15:26:07 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2018-03-16 15:26:07 +0000
commit1574b1e41e4d736907acf305fce0f5ad35020983 (patch)
treeea0799b5e393a45652790e9b46911c4730a3cc90 /sys/netinet/tcp_syncache.c
parent06d481012612be7fbd3e9b4a979cc0513572e471 (diff)
downloadsrc-1574b1e41e4d736907acf305fce0f5ad35020983.tar.gz
src-1574b1e41e4d736907acf305fce0f5ad35020983.zip
Set the inp_vflag consistently for accepted TCP/IPv6 connections when
net.inet6.ip6.v6only=0. Without this patch, the inp_vflag would have INP_IPV4 and the INP_IPV6 flags for accepted TCP/IPv6 connections if the sysctl variable net.inet6.ip6.v6only is 0. This resulted in netstat to report the source and destination addresses as IPv4 addresses, even they are IPv6 addresses. PR: 226421 Reviewed by: bz, hiren, kib MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D13514
Notes
Notes: svn path=/head/; revision=331061
Diffstat (limited to 'sys/netinet/tcp_syncache.c')
-rw-r--r--sys/netinet/tcp_syncache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index a10eaa4ef62e..a91fd1eca220 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -695,6 +695,8 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
inp->inp_inc.inc_flags = sc->sc_inc.inc_flags;
#ifdef INET6
if (sc->sc_inc.inc_flags & INC_ISIPV6) {
+ inp->inp_vflag &= ~INP_IPV4;
+ inp->inp_vflag |= INP_IPV6;
inp->in6p_laddr = sc->sc_inc.inc6_laddr;
} else {
inp->inp_vflag &= ~INP_IPV6;