]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: FPM next hop weights 10608/head
authorkiselev99@gmail.com <kiselev99@gmail.com>
Thu, 10 Feb 2022 15:47:20 +0000 (18:47 +0300)
committermergify-bot <noreply@mergify.com>
Thu, 17 Feb 2022 16:06:24 +0000 (16:06 +0000)
Don't lose next hop weights while exporting via FPM

Signed-off-by: Alex Kiselev <alex@bisonrouter.com>
(cherry picked from commit eca3256db8eaea0315d01f48b1037e918be629be)

zebra/zebra_fpm_netlink.c

index 168e36ac9bcb5f9e95c481eb9b991e434d50a14a..ec22c5dd484bf06c0fafef2f43ec6c45dc773091 100644 (file)
@@ -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: