From dbf83cfd36a2c7d32f26a95d6daa70cb2d6d16e7 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Tue, 18 Jun 2024 12:07:23 +0300 Subject: [PATCH] zebra: Set the weight for non-recursive next-hop If using weighted ECMP, the weight for non-recursive next-hop should be inherited from recursive next-hop. Signed-off-by: Donatas Abraitis --- zebra/zebra_nhg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 1246e4dba2..55920102bb 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1747,6 +1747,12 @@ static struct nexthop *nexthop_set_resolved(afi_t afi, SET_FLAG(resolved_hop->flags, NEXTHOP_FLAG_ACTIVE); resolved_hop->vrf_id = nexthop->vrf_id; + + /* Using weighted ECMP, we should respect the weight and use + * the same value for non-recursive next-hop. + */ + resolved_hop->weight = nexthop->weight; + switch (newhop->type) { case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV4_IFINDEX: -- 2.39.5