Bug 291867 - route(8): "route flush" does nothing since netlink changes
Summary: route(8): "route flush" does nothing since netlink changes
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 15.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: Ed Maste
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-12-21 23:42 UTC by Gavin Atkinson
Modified: 2026-06-09 13:03 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Atkinson freebsd_committer freebsd_triage 2025-12-21 23:42:05 UTC
Hi,

"route flush" now does nothing.  "route -4 flush" and "route -6 flush" both work individually, but "route flush" (which according to the man page should still flush all routes) fails silently.

Compare the (sanitised) verbose output from "route -v flush" and "route -6v flush" on the same machine, one deletes the requested routes, and the other does nothing.

# route -v flush
23:25:49.505 PID    0 add/repl route 0.0.0.0/0 gw 192.168.XXX.1 iface em0 mtu 1500 table inet.0
23:25:49.506 PID    0 add/repl route 127.0.0.1/32 iface lo0 mtu 16384 table inet.0
23:25:49.506 PID    0 add/repl route 192.168.XXX.0/24 iface em0 mtu 1500 table inet.0
23:25:49.506 PID    0 add/repl route 192.168.XXX.136/32 iface lo0 mtu 16384 table inet.0
23:25:49.506 PID    0 add/repl route ::/96 prohibit(reject)
23:25:49.506 PID    0 add/repl route ::/0 gw fe80::7642:7fff:fe21:XXXX%em0 iface em0 mtu 1500 table inet6.0
23:25:49.507 PID    0 add/repl route ::1/128 iface lo0 mtu 16384 table inet6.0
23:25:49.507 PID    0 add/repl route ::ffff:0.0.0.0/96 prohibit(reject)
23:25:49.507 PID    0 add/repl route 2a02:XXXX:XXXX::/64 iface em0 mtu 1500 table inet6.0
23:25:49.507 PID    0 add/repl route 2a02:XXXX:XXXX:0:4aea:62ff:feXX:XXXX/128 iface lo0 mtu 16384 table inet6.0
23:25:49.507 PID    0 add/repl route fd34:2889:c9b8::/64 iface em0 mtu 1500 table inet6.0
23:25:49.507 PID    0 add/repl route fd34:2889:c9b8:0:4aea:62ff:feXX:XXXX/128 iface lo0 mtu 16384 table inet6.0
23:25:49.507 PID    0 add/repl route fe80::%lo0/10 prohibit(reject)
23:25:49.507 PID    0 add/repl route fe80::%em0/64 iface em0 mtu 1500 table inet6.0
23:25:49.508 PID    0 add/repl route fe80::4aea:62ff:feXX:XXXX%lo0/128 iface lo0 mtu 16384 table inet6.0
23:25:49.508 PID    0 add/repl route fe80::%lo0/64 iface lo0 mtu 16384 table inet6.0
23:25:49.508 PID    0 add/repl route fe80::1%lo0/128 iface lo0 mtu 16384 table inet6.0
23:25:49.508 PID    0 add/repl route ff02::/16 prohibit(reject)

# route -6v flush
23:25:52.692 PID    0 add/repl route ::/96 prohibit(reject)
23:25:52.693 PID    0 add/repl route ::/0 gw fe80::7642:7fff:fe21:XXXX%em0 iface em0 mtu 1500 table inet6.0
23:25:52.693 PID    0 delete route ::/0 table inet6.0
23:25:52.693 PID    0 add/repl route ::1/128 iface lo0 mtu 16384 table inet6.0
23:25:52.693 PID    0 add/repl route ::ffff:0.0.0.0/96 prohibit(reject)
23:25:52.693 PID    0 add/repl route 2a02:XXXX:XXXX::/64 iface em0 mtu 1500 table inet6.0
23:25:52.693 PID    0 add/repl route 2a02:XXXX:XXXX:0:4aea:62ff:fe38:8940/128 iface lo0 mtu 16384 table inet6.0
23:25:52.693 PID    0 add/repl route fd34:2889:c9b8::/64 iface em0 mtu 1500 table inet6.0
23:25:52.694 PID    0 add/repl route fd34:2889:c9b8:0:4aea:62ff:feXX:XXXX/128 iface lo0 mtu 16384 table inet6.0
23:25:52.694 PID    0 add/repl route fe80::%lo0/10 prohibit(reject)
23:25:52.694 PID    0 add/repl route fe80::%em0/64 iface em0 mtu 1500 table inet6.0
23:25:52.694 PID    0 add/repl route fe80::4aea:62ff:feXX:XXXX%lo0/128 iface lo0 mtu 16384 table inet6.0
23:25:52.694 PID    0 add/repl route fe80::%lo0/64 iface lo0 mtu 16384 table inet6.0
23:25:52.694 PID    0 add/repl route fe80::1%lo0/128 iface lo0 mtu 16384 table inet6.0
23:25:52.694 PID    0 add/repl route ff02::/16 prohibit(reject)

This seems to have been caused by the Netlink changes, presumably flushroutes_fib_nl() needs to iterate over the address families to match the old AF_UNSPEC behaviour.

Thanks,

Gavin
Comment 1 Ed Maste freebsd_committer freebsd_triage 2026-05-29 17:13:36 UTC
Can you give the patch in https://reviews.freebsd.org/D57336 a try?
Comment 2 commit-hook freebsd_committer freebsd_triage 2026-05-29 22:19:14 UTC
A commit in branch main references this bug:

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

commit 32a7ba251acbfb442665eed40fb4f48c8f2bd710
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2026-05-29 16:44:09 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-05-29 22:18:20 +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

 sbin/route/route_netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-06-09 13:03:23 UTC
A commit in branch stable/15 references this bug:

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(-)