diff options
| author | Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> | 2026-04-11 12:58:28 +0000 |
|---|---|---|
| committer | Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> | 2026-04-14 22:11:18 +0000 |
| commit | bf41d86df0d9dc4a1342c579f4e72db3c66b3443 (patch) | |
| tree | bd32fbf466d96e39bc52885b4202dd2e3ee4393d | |
| parent | 956acdce0505ca8028d287d3b44789c623c8f37e (diff) | |
routing: Make ip[6]_tryforward() FIB-aware for local traffic
`ip_tryforward()` and `ip6_tryforward()` checks whether the destination
address is local or not without considering if it belongs to the current FIB.
If the destination is local but not in our FIB, forward it instead
of returning it to ip_input().
PR: 292319
Reviewed by: zlei
MFC after: 1 week
MFC to: stable/15
Differential Revision: https://reviews.freebsd.org/D56353
| -rw-r--r-- | sys/netinet/ip_fastfwd.c | 4 | ||||
| -rw-r--r-- | sys/netinet6/ip6_fastfwd.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/ip_fastfwd.c b/sys/netinet/ip_fastfwd.c index 6001ce781bc8..d95cca490a5d 100644 --- a/sys/netinet/ip_fastfwd.c +++ b/sys/netinet/ip_fastfwd.c @@ -293,7 +293,7 @@ ip_tryforward(struct mbuf *m) /* * Is it for a local address on this host? */ - if (in_localip(ip->ip_dst)) + if (in_localip_fib(ip->ip_dst, M_GETFIB(m))) return m; IPSTAT_INC(ips_total); @@ -328,7 +328,7 @@ ip_tryforward(struct mbuf *m) /* * Is it now for a local address on this host? */ - if (in_localip(dest)) + if (in_localip_fib(dest, M_GETFIB(m))) goto forwardlocal; /* * Go on with new destination address diff --git a/sys/netinet6/ip6_fastfwd.c b/sys/netinet6/ip6_fastfwd.c index 9298b8ea9a49..8a288eb19891 100644 --- a/sys/netinet6/ip6_fastfwd.c +++ b/sys/netinet6/ip6_fastfwd.c @@ -113,7 +113,7 @@ ip6_tryforward(struct mbuf *m) IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src) || IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst) || IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) || - in6_localip(&ip6->ip6_dst)) + in6_localip_fib(&ip6->ip6_dst, M_GETFIB(m))) return (m); /* * Check that the amount of data in the buffers |
