Also, fix weight overflow of RTA_MULTIPATH, use metric instead
Our weight values are 24-bit. In the original netlink, rtnh_hops is
indeed 8-bit. For backward compatibility, send metric instead of increasing
its size and also send RTA_WEIGHT for multipath routes.
Details
See patches to the route(8) command in the stack revision.
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 72830 Build 69713: arc lint + arc unit
Event Timeline
These changes can be tested in latter route revisions in the revision stack.
| sys/netlink/route/route.h | ||
|---|---|---|
| 336 | It would be awesome to increase rtnh_hops size here. | |
| sys/netlink/route/rt.c | ||
| 219 | This is where I changed the rtnh_nhops from weight to metric. You can verify the invalid values by using route -n6 monitor and adding a weight bigger than 8-bit value. | |
| 226 | To preserve the functionality. I return the weight using another well-known TLV here and I also document it in next revision. | |
| 912–913 | If user filled the metric, add it to weight. Good for backward compatibility. Simple logic. | |
| sys/netlink/route/rt.c | ||
|---|---|---|
| 912–913 |
With new attribute, I removed the dirty hack and the sentence above is no longer true. | |
This review now only contains the RTA_PRIORITY code and it won't touch RTA_WEIGHT anymore.
Safe to use with routing daemons compiled without this patch.
To preserve linux netlink behavior, if metric was not specified per nexthop, use route metric instead.
Tested with bird3.
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" {};
};
}