Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Aug 2018 14:07:36 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338137 - head/sys/netinet
Message-ID:  <201808211407.w7LE7a5v052541@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Tue Aug 21 14:07:36 2018
New Revision: 338137
URL: https://svnweb.freebsd.org/changeset/base/338137

Log:
  Fix the inheritance of IPv6 level socket options on TCP sockets.
  
  This was broken for IPv6 listening socket, which are not IPV6_ONLY,
  and the accepted TCP connection was using IPv4.
  
  Reviewed by:		bz@, rrs@
  MFC after:		1 month
  Sponsored by:		Netflix, Inc.
  Differential Revision:	https://reviews.freebsd.org/D16792

Modified:
  head/sys/netinet/tcp_syncache.c

Modified: head/sys/netinet/tcp_syncache.c
==============================================================================
--- head/sys/netinet/tcp_syncache.c	Tue Aug 21 14:04:30 2018	(r338136)
+++ head/sys/netinet/tcp_syncache.c	Tue Aug 21 14:07:36 2018	(r338137)
@@ -770,10 +770,9 @@ syncache_socket(struct syncache *sc, struct socket *ls
 		goto abort;
 	}
 #ifdef INET6
-	if (sc->sc_inc.inc_flags & INC_ISIPV6) {
+	if (inp->inp_vflag & INP_IPV6PROTO) {
 		struct inpcb *oinp = sotoinpcb(lso);
-		struct in6_addr laddr6;
-		struct sockaddr_in6 sin6;
+
 		/*
 		 * Inherit socket options from the listening socket.
 		 * Note that in6p_inputopts are not (and should not be)
@@ -787,6 +786,11 @@ syncache_socket(struct syncache *sc, struct socket *ls
 		if (oinp->in6p_outputopts)
 			inp->in6p_outputopts =
 			    ip6_copypktopts(oinp->in6p_outputopts, M_NOWAIT);
+	}
+
+	if (sc->sc_inc.inc_flags & INC_ISIPV6) {
+		struct in6_addr laddr6;
+		struct sockaddr_in6 sin6;
 
 		sin6.sin6_family = AF_INET6;
 		sin6.sin6_len = sizeof(sin6);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808211407.w7LE7a5v052541>