svn commit: r310208 - in stable/11/sys: netinet netinet6

Michael Tuexen tuexen at FreeBSD.org
Sun Dec 18 12:12:51 UTC 2016


Author: tuexen
Date: Sun Dec 18 12:12:49 2016
New Revision: 310208
URL: https://svnweb.freebsd.org/changeset/base/310208

Log:
  MFC r307726:
  
  Make ICMPv6 hard error handling for TCP consistent with the ICMPv4
  handling. Ensure that:
  * Protocol unreachable errors are handled by indicating ECONNREFUSED
    to the TCP user for both IPv4 and IPv6. These were ignored for IPv6.
  * Communication prohibited errors are handled by indicating ECONNREFUSED
    to the TCP user for both IPv4 and IPv6. These were ignored for IPv6.
  * Hop Limited exceeded errors are handled by indicating EHOSTUNREACH
    to the TCP user for both IPv4 and IPv6.
    For IPv6 the TCP connected was dropped but errno wasn't set.
  
  Sponsored by:	Netflix, Inc.

Modified:
  stable/11/sys/netinet/ip_icmp.c
  stable/11/sys/netinet/tcp_subr.c
  stable/11/sys/netinet6/icmp6.c
  stable/11/sys/netinet6/ip6_input.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/ip_icmp.c
==============================================================================
--- stable/11/sys/netinet/ip_icmp.c	Sun Dec 18 11:54:10 2016	(r310207)
+++ stable/11/sys/netinet/ip_icmp.c	Sun Dec 18 12:12:49 2016	(r310208)
@@ -457,6 +457,8 @@ icmp_input(struct mbuf **mp, int *offp, 
 			 * Treat subcodes 2,3 as immediate RST
 			 */
 			case ICMP_UNREACH_PROTOCOL:
+				code = PRC_UNREACH_PROTOCOL;
+				break;
 			case ICMP_UNREACH_PORT:
 				code = PRC_UNREACH_PORT;
 				break;

Modified: stable/11/sys/netinet/tcp_subr.c
==============================================================================
--- stable/11/sys/netinet/tcp_subr.c	Sun Dec 18 11:54:10 2016	(r310207)
+++ stable/11/sys/netinet/tcp_subr.c	Sun Dec 18 12:12:49 2016	(r310208)
@@ -1949,7 +1949,8 @@ tcp_ctlinput(int cmd, struct sockaddr *s
 	if (cmd == PRC_MSGSIZE)
 		notify = tcp_mtudisc_notify;
 	else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB ||
-		cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) && ip)
+		cmd == PRC_UNREACH_PORT || cmd == PRC_UNREACH_PROTOCOL || 
+		cmd == PRC_TIMXCEED_INTRANS) && ip)
 		notify = tcp_drop_syn_sent;
 
 	/*
@@ -2081,8 +2082,8 @@ tcp6_ctlinput(int cmd, struct sockaddr *
 	if (cmd == PRC_MSGSIZE)
 		notify = tcp_mtudisc_notify;
 	else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB ||
-		cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) &&
-		ip6 != NULL)
+		cmd == PRC_UNREACH_PORT || cmd == PRC_UNREACH_PROTOCOL || 
+		cmd == PRC_TIMXCEED_INTRANS) && ip6 != NULL)
 		notify = tcp_drop_syn_sent;
 
 	/*

Modified: stable/11/sys/netinet6/icmp6.c
==============================================================================
--- stable/11/sys/netinet6/icmp6.c	Sun Dec 18 11:54:10 2016	(r310207)
+++ stable/11/sys/netinet6/icmp6.c	Sun Dec 18 12:12:49 2016	(r310208)
@@ -490,7 +490,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 			break;
 		case ICMP6_DST_UNREACH_ADMIN:
 			icmp6_ifstat_inc(ifp, ifs6_in_adminprohib);
-			code = PRC_UNREACH_PROTOCOL; /* is this a good code? */
+			code = PRC_UNREACH_ADMIN_PROHIB;
 			break;
 		case ICMP6_DST_UNREACH_BEYONDSCOPE:
 			/* I mean "source address was incorrect." */

Modified: stable/11/sys/netinet6/ip6_input.c
==============================================================================
--- stable/11/sys/netinet6/ip6_input.c	Sun Dec 18 11:54:10 2016	(r310207)
+++ stable/11/sys/netinet6/ip6_input.c	Sun Dec 18 12:12:49 2016	(r310208)
@@ -1772,6 +1772,6 @@ u_char	inet6ctlerrmap[PRC_NCMDS] = {
 	0,		EMSGSIZE,	EHOSTDOWN,	EHOSTUNREACH,
 	EHOSTUNREACH,	EHOSTUNREACH,	ECONNREFUSED,	ECONNREFUSED,
 	EMSGSIZE,	EHOSTUNREACH,	0,		0,
-	0,		0,		0,		0,
-	ENOPROTOOPT
+	0,		0,		EHOSTUNREACH,	0,
+	ENOPROTOOPT,	ECONNREFUSED
 };


More information about the svn-src-all mailing list