svn commit: r343431 - stable/11/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Fri Jan 25 15:21:44 UTC 2019


Author: tuexen
Date: Fri Jan 25 15:21:42 2019
New Revision: 343431
URL: https://svnweb.freebsd.org/changeset/base/343431

Log:
  MFC r338137:
  
  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@
  Sponsored by:		Netflix, Inc.
  Differential Revision:	https://reviews.freebsd.org/D16792

Modified:
  stable/11/sys/netinet/tcp_syncache.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_syncache.c
==============================================================================
--- stable/11/sys/netinet/tcp_syncache.c	Fri Jan 25 15:02:18 2019	(r343430)
+++ stable/11/sys/netinet/tcp_syncache.c	Fri Jan 25 15:21:42 2019	(r343431)
@@ -761,10 +761,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)
@@ -778,6 +777,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-all mailing list