Skip to content

Commit

Permalink
zebra: fix ifp pointer for groups/recursives
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sworleys committed Jul 15, 2021
1 parent 5f179a1 commit bf157b9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions zebra/zebra_nhg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bf157b9

Please sign in to comment.