Page MenuHomeFreeBSD

route(8): convert to netlink
ClosedPublic

Authored by melifaro on Mar 9 2023, 8:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 2:28 PM
Unknown Object (File)
Mar 15 2024, 5:35 PM
Unknown Object (File)
Mar 11 2024, 9:23 PM
Unknown Object (File)
Mar 11 2024, 9:23 PM
Unknown Object (File)
Mar 11 2024, 9:23 PM
Unknown Object (File)
Mar 11 2024, 9:23 PM
Unknown Object (File)
Mar 8 2024, 3:26 AM
Unknown Object (File)
Jan 4 2024, 6:51 PM
Subscribers

Details

Reviewers
None
Group Reviewers
network
Commits
rGc597432e2297: route(8): convert to netlink
Summary

This change intends to convert all kernel rtsock interactions in route(8) to Netlink.

Based on the WITHOUT_NETLINK_SUPPORT src.conf(5) variable, route(8) now fully operates either via Netlink or via rtsock/sysctl.
The default (compile-time) is Netlink.

The output for route delete/add/get/flush is targeted to be exactly the same (apart from some error handling cases).
The output for the route monitor has been changed to improve readability and support netlink models.

The current deficiencies:

  • exact-match (route -n get a.b.c.d/e) does not work
  • route monitor does not show the change originator (unless it's kernel).
Test Plan
18:38 [0] m@devel1 /usr/obj/usr/home/melifaro/free/head/amd64.amd64/sbin/route/route -n monitor

18:38:09.401 add/repl neigh 10.0.0.1 state REACHABLE lladdr 52:54:00:8c:63:e9 iface vtnet0
-> route add -net 12.2.0.0/24 10.0.0.66
18:38:49.914 add/repl route 12.2.0.0/24 gw 10.0.0.66 iface vtnet0 mtu 1500 table inet.0
18:38:55.482 add/repl neigh 10.0.0.1 state REACHABLE lladdr 52:54:00:8c:63:e9 iface vtnet0
-> route add -net 12.2.0.0/24 10.0.0.77
18:38:56.555 add/repl route 12.2.0.0/24 gw 10.0.0.77 iface vtnet0 mtu 1500 table inet.0
                                        gw 10.0.0.66 iface vtnet0 mtu 1500
-> route add -net 12.2.0.0/24 -mtu 1420 10.0.0.88
18:39:14.968 add/repl route 12.2.0.0/24 gw 10.0.0.77 iface vtnet0 mtu 1500 table inet.0
                                        gw 10.0.0.66 iface vtnet0 mtu 1500
                                        gw 10.0.0.88 iface vtnet0 mtu 1420
-> route del -net 12.2.0.0/24 10.0.0.66
18:39:27.943 add/repl route 12.2.0.0/24 gw 10.0.0.77 iface vtnet0 mtu 1500 table inet.0
                                        gw 10.0.0.88 iface vtnet0 mtu 1420
-> route del -net 12.2.0.0/24 10.0.0.77
18:39:30.034 add/repl route 12.2.0.0/24 gw 10.0.0.88 iface vtnet0 mtu 1420 table inet.0
-> route del -net 12.2.0.0/24 10.0.0.88
18:39:34.207 delete route 12.2.0.0/24 gw 10.0.0.88 iface vtnet0 mtu 1420 table inet.0
-> ifconfig tun create
18:39:40.997 add/repl iface iface#3 tun0 admin DOWN oper DOWN mtu 1500
-> ifconfig tun0 up
18:39:46.269 add/repl iface iface#3 tun0 admin UP oper UP mtu 1500
18:39:46.270 add/repl addr fe80::dceb:bbd5:139b:f8e1/64 -> <NULL> iface tun0
-> ifconfig tun0 inet 10.1.0.3/24 10.1.0.8
18:40:01.517 add/repl addr 10.1.0.3/24 -> 10.1.0.8 iface tun0
-> ifconfig tun0 destroy
18:40:09.143 delete addr 10.1.0.3/24 iface if#3
18:40:09.143 add/repl iface iface#3 tun0 admin DOWN oper DOWN mtu 1500
18:40:09.143 delete addr fe80::dceb:bbd5:139b:f8e1/64 iface if#3
18:40:09.143 delete addr 10.1.0.3/24 iface if#3
18:40:09.144 delete iface iface#3 tun0 admin DOWN oper DOWN mtu 1500
18:40:15.660 delete neigh 10.0.0.1 state REACHABLE lladdr 52:54:00:8c:63:e9 iface vtnet0

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

melifaro added a reviewer: network.
melifaro retitled this revision from [WIP] route: convert to netlink to route(8): convert to netlink.Mar 19 2023, 6:47 PM
melifaro edited the summary of this revision. (Show Details)
melifaro edited the test plan for this revision. (Show Details)
melifaro edited the summary of this revision. (Show Details)
melifaro edited the test plan for this revision. (Show Details)

update route monitor code.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 26 2023, 11:08 AM
This revision was automatically updated to reflect the committed changes.