From eca3256db8eaea0315d01f48b1037e918be629be Mon Sep 17 00:00:00 2001 From: "kiselev99@gmail.com" Date: Thu, 10 Feb 2022 18:47:20 +0300 Subject: [PATCH] zebra: FPM next hop weights Don't lose next hop weights while exporting via FPM Signed-off-by: Alex Kiselev --- zebra/zebra_fpm_netlink.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index 168e36ac9b..ec22c5dd48 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -116,6 +116,8 @@ struct fpm_nh_encap_info_t { * data structures for convenience. */ struct netlink_nh_info { + /* Weight of the nexthop ( for unequal cost ECMP ) */ + uint8_t weight; uint32_t if_index; union g_addr *gateway; @@ -179,6 +181,7 @@ static int netlink_route_info_add_nh(struct netlink_route_info *ri, nhi.recursive = nexthop->rparent ? 1 : 0; nhi.type = nexthop->type; nhi.if_index = nexthop->ifindex; + nhi.weight = nexthop->weight; if (nexthop->type == NEXTHOP_TYPE_IPV4 || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) { @@ -480,6 +483,8 @@ static int netlink_route_info_encode(struct netlink_route_info *ri, rtnh->rtnh_ifindex = nhi->if_index; } + rtnh->rtnh_hops = nhi->weight; + encap = nhi->encap_info.encap_type; switch (encap) { case FPM_NH_ENCAP_NONE: -- 2.39.5