Skip to content

Commit a4e60f3

Browse files
authored
Merge pull request #15815 from donaldsharp/blackhole_reinstall
lib, zebra: Check for not being a blackhole route
2 parents 166a82c + 29c1ff4 commit a4e60f3

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

lib/nexthop.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,11 +1150,7 @@ static ssize_t printfrr_nh(struct fbuf *buf, struct printfrr_eargs *ea,
11501150
return -1;
11511151
}
11521152

1153-
bool nexthop_is_ifindex_type(const struct nexthop *nh)
1153+
bool nexthop_is_blackhole(const struct nexthop *nh)
11541154
{
1155-
if (nh->type == NEXTHOP_TYPE_IFINDEX ||
1156-
nh->type == NEXTHOP_TYPE_IPV4_IFINDEX ||
1157-
nh->type == NEXTHOP_TYPE_IPV6_IFINDEX)
1158-
return true;
1159-
return false;
1155+
return nh->type == NEXTHOP_TYPE_BLACKHOLE;
11601156
}

lib/nexthop.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ extern struct nexthop *nexthop_dup(const struct nexthop *nexthop,
240240
extern struct nexthop *nexthop_dup_no_recurse(const struct nexthop *nexthop,
241241
struct nexthop *rparent);
242242

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

246246
/*
247247
* Parse one or more backup index values, as comma-separated numbers,

zebra/zebra_nhg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3664,8 +3664,9 @@ void zebra_interface_nhg_reinstall(struct interface *ifp)
36643664
"%s: Setting the valid flag for nhe %pNG, interface: %s",
36653665
__func__, rb_node_dep->nhe, ifp->name);
36663666
}
3667+
36673668
/* Check for singleton NHG associated to interface */
3668-
if (nexthop_is_ifindex_type(nh) &&
3669+
if (!nexthop_is_blackhole(nh) &&
36693670
zebra_nhg_depends_is_empty(rb_node_dep->nhe)) {
36703671
struct nhg_connected *rb_node_dependent;
36713672

0 commit comments

Comments
 (0)