svn commit: r358568 - head/sys/netinet6
Bjoern A. Zeeb
bz at FreeBSD.org
Tue Mar 3 09:45:17 UTC 2020
Author: bz
Date: Tue Mar 3 09:45:16 2020
New Revision: 358568
URL: https://svnweb.freebsd.org/changeset/base/358568
Log:
fib6_rte_to_nh_*: return a link-local gw address with scope embedded
In fib6_rte_to_nh_* when returning a link-local gateway address
currently we do clear the scope. That could be recovered using
the ifp returned as well, but the code in general seems to
expect a link-local address with scope embeedded as otherwise
the "dst" (gw) passed to the output routines will not include
scope and not send the packet out (the right interface).
Do not clear the scope when returning a link-local address and
allow packets to go out (the right interface).
Remove the (now) extra scope recovery in the IPv6 fast-fwd code.
Sponsored by: Netflix
Reviewed by: melifaro, ae
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23872
Modified:
head/sys/netinet6/in6_fib.c
head/sys/netinet6/ip6_fastfwd.c
Modified: head/sys/netinet6/in6_fib.c
==============================================================================
--- head/sys/netinet6/in6_fib.c Tue Mar 3 08:28:16 2020 (r358567)
+++ head/sys/netinet6/in6_fib.c Tue Mar 3 09:45:16 2020 (r358568)
@@ -115,9 +115,9 @@ fib6_rte_to_nh_basic(struct rtentry *rte, const struct
pnh6->nh_mtu = min(rte->rt_mtu, IN6_LINKMTU(rte->rt_ifp));
if (rte->rt_flags & RTF_GATEWAY) {
+ /* Return address with embedded scope. */
gw = (struct sockaddr_in6 *)rte->rt_gateway;
pnh6->nh_addr = gw->sin6_addr;
- in6_clearscope(&pnh6->nh_addr);
} else
pnh6->nh_addr = *dst;
/* Set flags */
@@ -143,9 +143,9 @@ fib6_rte_to_nh_extended(struct rtentry *rte, const str
pnh6->nh_mtu = min(rte->rt_mtu, IN6_LINKMTU(rte->rt_ifp));
if (rte->rt_flags & RTF_GATEWAY) {
+ /* Return address with embedded scope. */
gw = (struct sockaddr_in6 *)rte->rt_gateway;
pnh6->nh_addr = gw->sin6_addr;
- in6_clearscope(&pnh6->nh_addr);
} else
pnh6->nh_addr = *dst;
/* Set flags */
Modified: head/sys/netinet6/ip6_fastfwd.c
==============================================================================
--- head/sys/netinet6/ip6_fastfwd.c Tue Mar 3 08:28:16 2020 (r358567)
+++ head/sys/netinet6/ip6_fastfwd.c Tue Mar 3 09:45:16 2020 (r358568)
@@ -274,14 +274,7 @@ passout:
m_clrprotoflags(m); /* Avoid confusing lower layers. */
IP_PROBE(send, NULL, NULL, ip6, nh.nh_ifp, NULL, ip6);
- /*
- * XXX: we need to use destination address with embedded scope
- * zone id, because LLTABLE uses such form of addresses for lookup.
- */
dst.sin6_addr = nh.nh_addr;
- if (IN6_IS_SCOPE_LINKLOCAL(&dst.sin6_addr))
- dst.sin6_addr.s6_addr16[1] = htons(nh.nh_ifp->if_index & 0xffff);
-
error = (*nh.nh_ifp->if_output)(nh.nh_ifp, m,
(struct sockaddr *)&dst, NULL);
if (error != 0) {
More information about the svn-src-head
mailing list