]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: fix ifp pointer for groups/recursives
authorStephen Worley <sworley@nvidia.com>
Mon, 21 Jun 2021 16:53:25 +0000 (12:53 -0400)
committermergify-bot <noreply@mergify.io>
Fri, 23 Jul 2021 09:20:27 +0000 (09:20 +0000)
At some point we broke the ifp pointer for nhe->ifp such
that it was pointing to an interface even in groups/recurisve
instances.

Add checks here to make it again so that we only set the ifp
pointer if it is a fully resolved singleton NHE.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
(cherry picked from commit bf157b9263050b25228e66164c1540bf823b960a)

zebra/zebra_nhg.c

index 6b40eae5b7d4cfb2ff836741cf413420fc25cda0..f45fade6b48f9e4b0a77ae030c36ffe173ae4066 100644 (file)
@@ -453,8 +453,13 @@ static void *zebra_nhg_hash_alloc(void *arg)
        /* Mark duplicate nexthops in a group at creation time. */
        nexthop_group_mark_duplicates(&(nhe->nhg));
 
-       /* Add the ifp now if it's not a group or recursive and has ifindex */
-       if (nhe->nhg.nexthop && nhe->nhg.nexthop->ifindex) {
+       /*
+        * Add the ifp now if it's not a group or recursive and has ifindex.
+        *
+        * A proto-owned ID is always a group.
+        */
+       if (!PROTO_OWNED(nhe) && nhe->nhg.nexthop && !nhe->nhg.nexthop->next
+           && !nhe->nhg.nexthop->resolved && nhe->nhg.nexthop->ifindex) {
                struct interface *ifp = NULL;
 
                ifp = if_lookup_by_index(nhe->nhg.nexthop->ifindex,