svn commit: r307726 - in head/sys: netinet netinet6
Michael Tuexen
tuexen at FreeBSD.org
Fri Oct 21 10:32:59 UTC 2016
Author: tuexen
Date: Fri Oct 21 10:32:57 2016
New Revision: 307726
URL: https://svnweb.freebsd.org/changeset/base/307726
Log:
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.
Reviewed by: gallatin, rrs
MFC after: 1 month
Sponsored by: Netflix
Differential Revision: 7904
Modified:
head/sys/netinet/ip_icmp.c
head/sys/netinet/tcp_subr.c
head/sys/netinet6/icmp6.c
head/sys/netinet6/ip6_input.c
Modified: head/sys/netinet/ip_icmp.c
==============================================================================
--- head/sys/netinet/ip_icmp.c Fri Oct 21 09:15:34 2016 (r307725)
+++ head/sys/netinet/ip_icmp.c Fri Oct 21 10:32:57 2016 (r307726)
@@ -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: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c Fri Oct 21 09:15:34 2016 (r307725)
+++ head/sys/netinet/tcp_subr.c Fri Oct 21 10:32:57 2016 (r307726)
@@ -1968,7 +1968,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;
/*
@@ -2100,8 +2101,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: head/sys/netinet6/icmp6.c
==============================================================================
--- head/sys/netinet6/icmp6.c Fri Oct 21 09:15:34 2016 (r307725)
+++ head/sys/netinet6/icmp6.c Fri Oct 21 10:32:57 2016 (r307726)
@@ -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: head/sys/netinet6/ip6_input.c
==============================================================================
--- head/sys/netinet6/ip6_input.c Fri Oct 21 09:15:34 2016 (r307725)
+++ head/sys/netinet6/ip6_input.c Fri Oct 21 10:32:57 2016 (r307726)
@@ -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