svn commit: r338137 - head/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Tue Aug 21 14:07:37 UTC 2018


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);


More information about the svn-src-head mailing list