git: 3ce003c8b615 - main - netlink: restore the ability to delete PINNED routes

From: Andrey V. Elsukov <ae_at_FreeBSD.org>
Date: Sat, 11 Jan 2025 08:40:02 UTC
The branch main has been updated by ae:

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

commit 3ce003c8b6151f7764b7934de11c789d6b84ee5c
Author:     Andrey V. Elsukov <ae@FreeBSD.org>
AuthorDate: 2025-01-11 08:25:50 +0000
Commit:     Andrey V. Elsukov <ae@FreeBSD.org>
CommitDate: 2025-01-11 08:25:50 +0000

    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
---
 sys/netlink/route/rt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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