]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Move where zebra marks a nhg as uninstalled in fib
authorDonald Sharp <sharpd@nvidia.com>
Wed, 15 Jun 2022 20:27:07 +0000 (16:27 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 16 Jun 2022 18:47:19 +0000 (14:47 -0400)
Currently the code is marking the nhg as uninstalled but not
causing that to flood up to the dependent nhgs:

nhg 3 is a group of 1/2
   1 -> interface A
   2 -> interface B

Suppose A goes down, old code would mark nhg 1 as !VALID and !INSTALLED.
Suppose B then goes down, old code would mark nhg 2 as !VALID and !INSTALLED
But would not mark nhg 3 as !VALID and !INSTALLED (sort of assuming that
it would just be cleaned up by NHG refcounts ).  I would prefer that
the code is pedantic about nhg 3 actually being removed from the system.

This code moves the setting of !INSTALLED into zebra_nhg.c where it
really belongs.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/interface.c
zebra/zebra_nhg.c

index 96e378444d22da26d61c694d83270f8e3fed7239..93ffeb437c1ada80278940c781df6ebc6bc9920e 100644 (file)
@@ -184,13 +184,6 @@ static int if_zebra_new_hook(struct interface *ifp)
 static void if_nhg_dependents_check_valid(struct nhg_hash_entry *nhe)
 {
        zebra_nhg_check_valid(nhe);
-       if (!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID)) {
-               /* If we're in shutdown, this interface event needs to clean
-                * up installed NHGs, so don't clear that flag directly.
-                */
-               if (!zrouter.in_shutdown)
-                       UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED);
-       }
 }
 
 static void if_down_nhg_dependents(const struct interface *ifp)
index 500f4b0f1bbf0011190bfb169512cdb98338c981..e27078d138328c32ca3a36132a487ee31b063971 100644 (file)
@@ -1055,6 +1055,12 @@ static void zebra_nhg_set_invalid(struct nhg_hash_entry *nhe)
 
        UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_VALID);
 
+       /* If we're in shutdown, this interface event needs to clean
+        * up installed NHGs, so don't clear that flag directly.
+        */
+       if (!zrouter.in_shutdown)
+               UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED);
+
        /* Update validity of nexthops depending on it */
        frr_each(nhg_connected_tree, &nhe->nhg_dependents, rb_node_dep)
                zebra_nhg_check_valid(rb_node_dep->nhe);