[CALL FOR TESTING] Metric support in routing stack (netlink and rtsock)

Pouria Mousavizadeh Tehrani <[email protected]>
Newsgroups gmane.os.freebsd.devel.hackers,gmane.os.freebsd.devel.net
Message-ID <[email protected]>
Hi,

I've implemented metric support for the FreeBSD routing stack, enabling 
per-nexthop metrics for both netlink and rtsock interfaces.
This allows multiple routes with same destination to have different metrics.
The routing system should now use only the lowest-metric nexthops for 
actual forwarding.

The implementation includes:
D56335 route(8): Add metric argument
D56326 route(8): Show metric value in monitor route
D56325 route(8): Show metric value in get route
D56324 rtnetlink.4: Add RTA_PRIORITY
D57007 routing: Allow nhop reuse in nhgrp with different metric
D56323 netlink: Add RTA_PRIORITY support (metric)
D56322 routing: Add support for route metric

Testing:
I'm looking for feedback and testing across different scenarios.
Here are some example use cases:
```
# Adding routes with different metrics:
route -n6 add 3fff:a::/64 -gateway 3fff::1 -metric 2
route -n6 add 3fff:a::/64 -gateway 3fff::2 -metric 3
route -n6 add 3fff:a::/64 -gateway 3fff::1 -metric 1 # 1 is default
# Show all the nexthops with their metrics:
route -on6 get 3fff:a::/64
# Remove route with specific metric
route -n6 del 3fff:a::/64 -gateway 3fff::2 -metric 3

# ECMP routes with metrics:
route -n6 add -net 3fff::/64 -gateway ::2 -weight 3 -metric 3
route -n6 add -net 3fff::/64 -gateway ::1 -weight 3
# Metric 1 gateway preferred for forwarding
route -n6 get 3fff::/64
```

Netlink integration and routing daemons:
Routes created via netlink now properly exchange metrics through 
RTA_PRIORITY, allowing external tools like Bird to work with metric.

Here is an example configuration for bird:
```
protocol kernel kernel61 {
   metric 10;
   ipv6 {
     import all;
     export all;
   };
   learn all;
}

protocol ospf v3 {
   ecmp yes;
   ipv6 {
     export none;
     import all;
   };
   area 0 {
     interface "vtnet1" {};
   };
}
```

Testing help needed:
- Testing with various metric combinations and ECMP scenarios, including 
   performance impact.
- Verify slot/memory handling in the actual forwarding table. (`netstat 
-on6` and `netstat -On6` output helps)
- rtnetlink(4) compatibility testing with routing daemons (Bird, etc.)
- rtsock usability and compatibility.
- Any edge cases or unexpected behavior.
- UX of route(8) and netstat(1) in relation to metric.

The implementation is available on my github in mpath branch and in 
phabricator:
https://github.com/spmzt/freebsd-src/tree/mpath

Please reply with any issues, feedback, or test results.

BR
-- 
Pouria
OpenPGP_signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQSqt7cppfvJ816gj0lUwVnUeMwagAUCagZNGQAKCRBUwVnUeMwa
gO6RAQD1/GDsP5yZN0Ni09ZweYpVSapzj8hT5eP3AgKdS0VHcwEAoTyEl2iuEGYi
RawdMifVFVPJMDQa5C0QpY2qta91yQA=
=a108
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.