From: kiselev99@gmail.com Date: Thu, 10 Feb 2022 15:47:20 +0000 (+0300) Subject: zebra: FPM next hop weights X-Git-Tag: pim6-testing-20220430~312^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F10557%2Fhead;p=mirror%2Ffrr.git zebra: FPM next hop weights Don't lose next hop weights while exporting via FPM Signed-off-by: Alex Kiselev --- 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: