git: 2caaf8c1c717 - stable/15 - route: Fix `flush` w/o specified address family

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 09 Jun 2026 13:02:38 UTC
The branch stable/15 has been updated by emaste:

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

commit 2caaf8c1c717bcebf14832b4bea5766e393ad683
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2026-05-29 16:44:09 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-06-09 13:02:22 +0000

    route: Fix `flush` w/o specified address family
    
    PR:             291867
    Reported by:    gavin
    Reviewed by:    pouria, melifaro
    Sponsored by:   The FreeBSD Foundation
    Fixes: c597432e2297 ("route(8): convert to netlink")
    Differential Revision: https://reviews.freebsd.org/D57336
    
    (cherry picked from commit 32a7ba251acbfb442665eed40fb4f48c8f2bd710)
---
 sbin/route/route_netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sbin/route/route_netlink.c b/sbin/route/route_netlink.c
index 5dde7501d6b4..74ebb99a9486 100644
--- a/sbin/route/route_netlink.c
+++ b/sbin/route/route_netlink.c
@@ -888,7 +888,8 @@ flushroutes_fib_nl(int fib, int af)
 			struct snl_msg_info attrs = {};
 			print_nlmsg(&h, hdr, &attrs);
 		}
-		if (r.rta_table != (uint32_t)fib || r.rtm_family != af)
+		if (r.rta_table != (uint32_t)fib ||
+		    (af != AF_UNSPEC && r.rtm_family != af))
 			continue;
 		if ((r.rta_rtflags & RTF_GATEWAY) == 0)
 			continue;