Page MenuHomeFreeBSD

netlink/route: make route deletion behavior match route(4) socket
AcceptedPublic

Authored by glebius on Aug 15 2024, 1:04 AM.
Tags
None
Referenced Files
F96530966: D46301.diff
Wed, Sep 25, 9:14 AM
F96475731: D46301.diff
Wed, Sep 25, 2:58 AM
Unknown Object (File)
Tue, Sep 10, 7:29 AM
Unknown Object (File)
Mon, Sep 9, 3:58 AM
Unknown Object (File)
Sat, Sep 7, 9:00 AM
Unknown Object (File)
Sat, Sep 7, 1:25 AM
Unknown Object (File)
Fri, Sep 6, 11:24 AM
Unknown Object (File)
Mon, Sep 2, 8:14 PM
Subscribers

Details

Reviewers
melifaro
zlei
Group Reviewers
network
Summary

Deleting a route with help of route(8) command in pre-netlink times was a
two step action: first the route(8) would RTM_GET the route from the
kernel and then copy its parameters into the RTM_DEL request. This
allowed deletion of pinned (RTF_PINNED) routes, as the flag was carried
over. The flag enforced call into rt_delete_conditional() with prio=2
parameter.

With netlink(4) enabled route(8), we construct the NL_RTM_DELROUTE request
from scratch and this ends in rt_delete_conditional() being called with
prio=1, which effectively blocks deleting a pinned route.

Make the netlink(4) code provide RTM_F_FORCE flag for rib_del_route_px(),
which would end up with prio=2 for rt_delete_conditional(). The rationale
is here that netlink(4) path isn't something automatic, it is either an
explicit request from an operator with route(8) or some other routing
daemon, and the RTF_PINNED protection shall be bypassed for any call via
netlink(4).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59026
Build 55913: arc lint + arc unit