diff options
author | Andrey V. Elsukov <ae@FreeBSD.org> | 2025-01-11 08:25:50 +0000 |
---|---|---|
committer | Andrey V. Elsukov <ae@FreeBSD.org> | 2025-01-11 08:25:50 +0000 |
commit | 3ce003c8b6151f7764b7934de11c789d6b84ee5c (patch) | |
tree | 697d95d2a381953c015f37b83736274cb14d5796 | |
parent | 3999a860d6e899de98b1025317d2d0ef1f83255f (diff) |
netlink: restore the ability to delete PINNED routes
route(8) had such ability before migration to netlink. To be able
to delete PINNED routes we pass RTM_F_FORCE to rib_del_route_px()
when userland uses RTF_PINNED flag with RTM_DELETE command.
This is hackish way for route(8) tool, that third-party software
usually doesn't use.
PR: 279988
Tested by: franco at opnsense org
Discussed with: glebius
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D46301
-rw-r--r-- | sys/netlink/route/rt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index e90debee46da..79ecd066aa72 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -1012,7 +1012,8 @@ rtnl_handle_delroute(struct nlmsghdr *hdr, struct nlpcb *nlp, } error = rib_del_route_px(attrs.rta_table, attrs.rta_dst, - attrs.rtm_dst_len, path_match_func, &attrs, 0, &rc); + attrs.rtm_dst_len, path_match_func, &attrs, + (attrs.rta_rtflags & RTF_PINNED) ? RTM_F_FORCE : 0, &rc); if (error == 0) report_operation(attrs.rta_table, &rc, nlp, hdr); return (error); |