svn commit: r329053 - head/sys/netinet6
Eric van Gyzen
vangyzen at FreeBSD.org
Fri Feb 9 00:13:06 UTC 2018
Author: vangyzen
Date: Fri Feb 9 00:13:05 2018
New Revision: 329053
URL: https://svnweb.freebsd.org/changeset/base/329053
Log:
Fix ICMPv6 redirects
icmp6_redirect_input() validates that a redirect packet came from the
current gateway for the respective destination. To do this, it compares
the source address, which has an embedded scope zone id, to the next-hop
address, which does not. If the address is link-local, which should be
the case, the comparison fails and the redirect is ignored.
Insert the scope zone id into the next-hop address so the comparison
is accurate.
Unsurprisingly, this fixes 35 UNH IPv6 conformance test cases.
Submitted by: Farrell Woods <Farrell_Woods at Dell.com> (initial revision)
Reviewed by: ae melifaro dab
MFC after: 1 week
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14254
Modified:
head/sys/netinet6/icmp6.c
Modified: head/sys/netinet6/icmp6.c
==============================================================================
--- head/sys/netinet6/icmp6.c Thu Feb 8 23:14:24 2018 (r329052)
+++ head/sys/netinet6/icmp6.c Fri Feb 9 00:13:05 2018 (r329053)
@@ -2305,6 +2305,14 @@ icmp6_redirect_input(struct mbuf *m, int off)
goto bad;
}
+ /*
+ * Embed scope zone id into next hop address, since
+ * fib6_lookup_nh_basic() returns address without embedded
+ * scope zone id.
+ */
+ if (in6_setscope(&nh6.nh_addr, m->m_pkthdr.rcvif, NULL))
+ goto freeit;
+
if (IN6_ARE_ADDR_EQUAL(&src6, &nh6.nh_addr) == 0) {
nd6log((LOG_ERR,
"ICMP6 redirect rejected; "
More information about the svn-src-all
mailing list