Page MenuHomeFreeBSD

route(8): Add metric argument
ClosedPublic

Authored by pouria on Apr 9 2026, 10:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 28, 8:51 PM
Unknown Object (File)
Thu, May 28, 5:24 PM
Unknown Object (File)
Thu, May 14, 10:04 AM
Unknown Object (File)
Thu, May 14, 7:45 AM
Unknown Object (File)
Thu, May 14, 1:31 AM
Unknown Object (File)
Wed, May 13, 8:10 PM
Unknown Object (File)
Wed, May 13, 4:37 PM
Unknown Object (File)
Mon, May 11, 4:04 PM
Subscribers

Details

Summary

Add support for metric in route command.

Test Plan
[root@ftsr1] [~] # route -n6 add -net 3fff::/64 -gateway ::2 -weight 3 -metric 3
add net 3fff::/64: gateway ::2 fib 0
[root@ftsr1] [~] # netstat -On6W
Nexthop groups data

Internet6:
GrpIdx  NhIdx     Weight   Slots                                 Gateway     Netif  Refcnt
11        ------- ------- ------- --------------------------------------- ---------       2
9       2      25                                     ::3       lo0
10       3      39                                     ::2       lo0
[root@ftsr1] [~] # route -n6 get 3fff::/64
route to: 3fff::
destination: 3fff::
mask: ffff:ffff:ffff:ffff::
gateway: ::3
fib: 0
interface: lo0
flags: <UP,GATEWAY,DONE,STATIC>
recvpipe  sendpipe  ssthresh  rtt,msec    mtu       metric    weight    expire
0         0         0         0     16384         3         2         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: 2
via gw ::3 iface lo0 metric 3 weight 2 mtu 16384 table inet6.0
via gw ::2 iface lo0 metric 3 weight 3 mtu 16384
[root@ftsr1] [~] # route -n6 add -net 3fff::/64 -gateway ::1 -weight 3 -metric 1
add net 3fff::/64: gateway ::1 fib 0
[root@ftsr1] [~] # route -n6 get 3fff::/64
route to: 3fff::
destination: 3fff::
mask: ffff:ffff:ffff:ffff::
gateway: ::3
fib: 0
interface: lo0
flags: <UP,GATEWAY,DONE,STATIC>
recvpipe  sendpipe  ssthresh  rtt,msec    mtu       metric    weight    expire
0         0         0         0     16384         3         2         0

Diff Detail

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

Event Timeline

pouria edited the test plan for this revision. (Show Details)

Replace err(3) with errx(3) for better error message.

This revision is now accepted and ready to land.Apr 12 2026, 7:51 PM

Remove extra macros based on parent revision.

This revision now requires review to proceed.May 4 2026, 11:36 AM
This revision was not accepted when it landed; it landed in state Needs Review.Wed, May 20, 8:59 PM
This revision was automatically updated to reflect the committed changes.