]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Protocol side nhg_hash_entry afi fix
authorStephen Worley <sworley@cumulusnetworks.com>
Mon, 1 Apr 2019 16:24:16 +0000 (12:24 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:39 +0000 (11:13 -0400)
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 <sworley@cumulusnetworks.com>
zebra/zebra_rib.c

index d33b8494b020f68a810a9597cc036dc5fecea52d..3155570df5e3d2f937833629b99d712456ac82d6 100644 (file)
@@ -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