[PATCH v2 2/2] Netlink: Propagate ECMP nexthop weight to kernel for inet6 routes

Daniel Gröber dxld at darkboxed.org
Thu May 26 14: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 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index eca681f9..cf1e18d2 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -74,7 +74,6 @@
 #endif
 
 #define krt_ipv4(p) ((p)->af == AF_INET)
-#define krt_ecmp6(p) ((p)->af == AF_INET6)
 
 const int rt_default_ecmp = 16;
 
@@ -1403,7 +1402,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