]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib, zebra: Check for not being a blackhole route
authorDonald Sharp <sharpd@nvidia.com>
Fri, 19 Apr 2024 16:13:32 +0000 (12:13 -0400)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 23 Apr 2024 12:12:21 +0000 (12:12 +0000)
In zebra_interface_nhg_reinstall zebra is checking that the
nhg is a singleton and not a blackhole nhg.  This was originally
done with checking that the nexthop is a NEXTHOP_TYPE_IFINDEX,
NEXTHOP_TYPE_IPV4_IFINDEX and NEXTHOP_TYPE_IPV6_IFINDEX.  This
was excluding NEXTHOP_TYPE_IPV4 and NEXTHOP_TYPE_IPV6.  These
were both possible to be received and maintained from the upper
level protocol for when a route is being recursively resolved.
If we have gotten to this point in zebra_interface_nhg_reinstall
the nexthop group has already been installed at least once
and we *know* that it is actually a valid nexthop.  What the
test is really trying to do is ensure that we are not reinstalling
a blackhole nexthop group( Which is not possible to even be
here by the way, but safety first! ).  So let's change
to test for that instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 29c1ff446e581fc403d155fd1d00b7c944cba56a)

lib/nexthop.c
lib/nexthop.h
zebra/zebra_nhg.c

index b888b9a0a5747fa39640aec9dfddeec36299e69c..3755a96355fa6ffa062cb32e032ef01d48205fd8 100644 (file)
@@ -1093,11 +1093,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;
 }
index 8eb4d210cfd640c38dd9d12824d57f67aae2304f..42ae394fb42ee78f22e7e9b198c8df7ce3c13868 100644 (file)
@@ -255,8 +255,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,
index 5a5daecf5ff8113e2fc4ac2a178b2cf25cc2e49c..6ada3dc8f700bc970bcdbed241d87bf170bcb1d7 100644 (file)
@@ -3638,8 +3638,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;