Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Apr 2026 22:18:02 +0000
From:      Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: bf41d86df0d9 - main - routing: Make ip[6]_tryforward() FIB-aware for local traffic
Message-ID:  <69debd1a.2221b.394ee779@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by pouria:

URL: https://cgit.FreeBSD.org/src/commit/?id=bf41d86df0d9dc4a1342c579f4e72db3c66b3443

commit bf41d86df0d9dc4a1342c579f4e72db3c66b3443
Author:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-04-11 12:58:28 +0000
Commit:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-04-14 22:11:18 +0000

    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
---
 sys/netinet/ip_fastfwd.c   | 4 ++--
 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


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69debd1a.2221b.394ee779>