From ab942eb2853310fa76e1bcdad422eed441adeb00 Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Mon, 1 Apr 2019 12:24:16 -0400 Subject: [PATCH] zebra: Protocol side nhg_hash_entry afi fix Default the afi of the nexthop to the route entry using it. If it turns out to be a group, update the afi to AFI_UNSPEC. Signed-off-by: Stephen Worley --- zebra/zebra_rib.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index d33b8494b0..3155570df5 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2639,6 +2639,8 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, struct route_entry *same = NULL; struct nhg_hash_entry *nhe = NULL; struct list *nhg_depends = NULL; + /* Default to route afi */ + afi_t nhg_afi = afi; int ret = 0; if (!re) @@ -2671,13 +2673,18 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, lookup = *nh; /* Clear it, since its a group */ lookup.next = NULL; + /* Use the route afi here, since a single nh */ depend = zebra_nhg_find_nexthop(&lookup, afi); nhg_depend_add(nhg_depends, depend); } + + /* change the afi for group */ + if (listcount(nhg_depends)) + nhg_afi = AFI_UNSPEC; } - nhe = zebra_nhg_find(re->ng, re->vrf_id, afi, re->nhe_id, nhg_depends, - false); + nhe = zebra_nhg_find(re->ng, re->vrf_id, nhg_afi, re->nhe_id, + nhg_depends, false); if (nhe) { // TODO: Add interface pointer