Page MenuHomeFreeBSD

route: Add route get for multipath routes with -o flag
Needs ReviewPublic

Authored by pouria on Tue, Mar 31, 4:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 3, 11:32 AM
Unknown Object (File)
Thu, Apr 2, 11:37 AM
Subscribers

Details

Reviewers
kp
markj
glebius
zlei
melifaro
Group Reviewers
network

Diff Detail

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

Event Timeline

For reviewers, I'll work on other commands like add and replace with -o flag too. but those are for another review.

This is what the output looks like:

[root@ftsr1] [~] # route -n6 add -net 3fff::/64 -gateway 2a01:e140:10:10::1 -weight 1
add net 3fff::/64: gateway 2a01:e140:10:10::1 fib 0
[root@ftsr1] [~] # route -n6 add -net 3fff::/64 -gateway 2a01:e140:10:10::2 -weight 2
add net 3fff::/64: gateway 2a01:e140:10:10::2 fib 0
[root@ftsr1] [~] # route -n6 add -net 3fff::/64 -gateway 2a01:e140:10:10::3 -weight 3 -expire +3
add net 3fff::/64: gateway 2a01:e140:10:10::3 fib 0
[root@ftsr1] [~] # route -on6 get 3fff::/64
   route to: 3fff::
destination: 3fff::
       mask: ffff:ffff:ffff:ffff::
        fib: 0
      flags: <UP,GATEWAY,DONE,STATIC>
      nhops: 3
        via: gw 2a01:e140:10:10::1 iface vtnet0 weight 1 mtu 1500 table inet6.0
        via: gw 2a01:e140:10:10::2 iface vtnet0 weight 2 mtu 1500
        via: gw 2a01:e140:10:10::3 iface vtnet0 weight 3 mtu 1500 expire 1

Do you plan to update the manual page when you got -o support for other modes?

sbin/route/route_netlink.c
409

Please move declaration up.

413

Putting (void) in front of printf(3) is more of a cargo cult today. Very old compilers would complain if you don't put it. I'd suggest not to use it in new code.

The functions that really shall be checked are marked with __result_use_check and for them the compiler will complain about incorrect use.

417

Please declare it at the function prologue.

540–541

This seems to not depend on -o, so can be committed separately.

pouria marked 4 inline comments as done.

Address @glebius comments.
Thank you!

Do you plan to update the manual page when you got -o support for other modes?

Yes, I have. I want to do it after implementing other actions (add, change).

sbin/route/route_netlink.c
413

Thank you for explanation.

540–541

It'll be used by print_nhop_getmsg, but you're right, it also affects the route monitor.
Done: D56202