Skip to content

Commit

Permalink
Merge pull request #15821 from FRRouting/mergify/bp/stable/9.1/pr-15815
Browse files Browse the repository at this point in the history
lib, zebra: Check for not being a blackhole route (backport #15815)
  • Loading branch information
donaldsharp committed Apr 23, 2024
2 parents 81f999f + ab1c9a3 commit 123b134
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 2 additions & 6 deletions lib/nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,11 +1150,7 @@ static ssize_t printfrr_nh(struct fbuf *buf, struct printfrr_eargs *ea,
return -1;
}

bool nexthop_is_ifindex_type(const struct nexthop *nh)
bool nexthop_is_blackhole(const struct nexthop *nh)
{
if (nh->type == NEXTHOP_TYPE_IFINDEX ||
nh->type == NEXTHOP_TYPE_IPV4_IFINDEX ||
nh->type == NEXTHOP_TYPE_IPV6_IFINDEX)
return true;
return false;
return nh->type == NEXTHOP_TYPE_BLACKHOLE;
}
4 changes: 2 additions & 2 deletions lib/nexthop.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ extern struct nexthop *nexthop_dup(const struct nexthop *nexthop,
extern struct nexthop *nexthop_dup_no_recurse(const struct nexthop *nexthop,
struct nexthop *rparent);

/* Check nexthop of IFINDEX type */
extern bool nexthop_is_ifindex_type(const struct nexthop *nh);
/* Is this nexthop a blackhole? */
extern bool nexthop_is_blackhole(const struct nexthop *nh);

/*
* Parse one or more backup index values, as comma-separated numbers,
Expand Down
3 changes: 2 additions & 1 deletion zebra/zebra_nhg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3736,8 +3736,9 @@ void zebra_interface_nhg_reinstall(struct interface *ifp)
"%s: Setting the valid flag for nhe %pNG, interface: %s",
__func__, rb_node_dep->nhe, ifp->name);
}

/* Check for singleton NHG associated to interface */
if (nexthop_is_ifindex_type(nh) &&
if (!nexthop_is_blackhole(nh) &&
zebra_nhg_depends_is_empty(rb_node_dep->nhe)) {
struct nhg_connected *rb_node_dependent;

Expand Down

0 comments on commit 123b134

Please sign in to comment.