[PATCH] Netlink: Propagate ecmp nexthop weight to kernel for inet6 routes

Daniel Gröber dxld at darkboxed.org
Sun May 22 20:16:35 CEST 2022


Previously nl_send_route would use plain nl_add_nexthop for ecmp ipv6
routes instead of adding RTA_MULTIPATH objects via nl_add_multipath. The
former lacks support for the rtnh_hops field needed for setting the nexthop
weight though.

On the kernel side support for nexthop weights was introduced by commit
398958ae48 ("ipv6: Add support for non-equal-cost multipath") which landed
in 4.16. Before this the weight will simply be ignored. Support for the
ipv6 RTA_MULTIPATH attribute was added in 51ebd31815 ("ipv6: add support of
equal cost multipath (ECMP)") which landed in 3.10. If this version bound
isn't met installing the route will fail.
---
 sysdep/linux/netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index 29b744cb..5e0b036d 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -1446,7 +1446,7 @@ dest:
     {
     case RTD_UNICAST:
       r->r.rtm_type = RTN_UNICAST;
-      if (nh->next && !krt_ecmp6(p))
+      if (nh->next)
 	nl_add_multipath(&r->h, rsize, nh, p->af, eattrs);
       else
       {
-- 
2.30.2



More information about the Bird-users mailing list