This review switches route listing in netstat to netlink, with fallback to rtsock.
The outputs are mostly identical, with an exception of not showing kernel nexthop indexes for multipath routes.
Differential D36529
netstat: make netstat -rn use netlink instead of rtsock melifaro on Sep 11 2022, 7:12 PM. Authored by Tags None Referenced Files
Subscribers
Details
This review switches route listing in netstat to netlink, with fallback to rtsock. The outputs are mostly identical, with an exception of not showing kernel nexthop indexes for multipath routes. # netlink: Internet: Destination Gateway Flags Nhop# Mtu Netif Expire default 10.0.0.1 UGS 4 1500 vtnet0 10.0.0.0/24 link#1 U 2 1500 vtnet0 10.0.0.4 link#2 UHS 3 16384 lo0 127.0.0.1 link#2 UH 1 16384 lo0 #rtsock Internet: Destination Gateway Flags Nhop# Mtu Netif Expire default 10.0.0.1 UGS 4 1500 vtnet0 10.0.0.0/24 link#1 U 2 1500 vtnet0 10.0.0.4 link#1 UHS 3 16384 lo0 127.0.0.1 link#2 UH 1 16384 lo0 #netlink Internet6: Destination Gateway Flags Nhop# Mtu Netif Expire ::/96 ::1 UGRS 7 16384 lo0 default fe80::5054:ff:fe8c:63e9%vtnet0 G 6 1500 vtnet0 ::1 link#2 UHS 1 16384 lo0 ::ffff:0.0.0.0/96 ::1 UGRS 7 16384 lo0 2a01:4f9:3a:fa00::/64 link#1 U 5 1500 vtnet0 2a01:4f9:3a:fa00:5054:ff:fe14:e319 link#2 UHS 4 16384 lo0 fe80::/10 ::1 UGRS 7 16384 lo0 fe80::/64 link#1 U 5 1500 vtnet0 fe80::5054:ff:fe14:e319 link#2 UHS 4 16384 lo0 fe80::/64 link#2 U 3 16384 lo0 fe80::1 link#2 UHS 2 16384 lo0 ff02::/16 ::1 UGRS 7 16384 lo0 #rtsock Internet6: Destination Gateway Flags Nhop# Mtu Netif Expire ::/96 ::1 UGRS 7 16384 lo0 default fe80::5054:ff:fe8c:63e9%vtnet0 UG 6 1500 vtnet0 ::1 link#2 UHS 1 16384 lo0 ::ffff:0.0.0.0/96 ::1 UGRS 7 16384 lo0 2a01:4f9:3a:fa00::/64 link#1 U 5 1500 vtnet0 2a01:4f9:3a:fa00:5054:ff:fe14:e319 link#1 UHS 4 16384 lo0 fe80::/10 ::1 UGRS 7 16384 lo0 fe80::%vtnet0/64 link#1 U 5 1500 vtnet0 fe80::5054:ff:fe14:e319%vtnet0 link#1 UHS 4 16384 lo0 fe80::%lo0/64 link#2 U 3 16384 lo0 fe80::1%lo0 link#2 UHS 2 16384 lo0 ff02::/16 ::1 UGRS 7 16384 lo0
Diff Detail
Event Timeline
Comment Actions @melifaro thanks for the differential. I remember darkly, that there was PR a few month ago, that FreeBSD doesn't support "route print" like most operating systems do. Would it be possible to integrate that feature of that differential and netlink? Comment Actions Generally I'm not opposed to the idea. There are a number of things to be sorted out, though. For example, what should be the column format, should it be machine-readable (as currently /sbin/route does not have any lib depenencies) and so on.
|