]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Change wording of duplicate kernel nhg flag
authorStephen Worley <sworley@cumulusnetworks.com>
Wed, 23 Oct 2019 18:50:30 +0000 (14:50 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:44 +0000 (11:13 -0400)
Change the wording of the flag indicating we have received
a nexthop group from the kernel with a different ID but
is fundamentally identical to one we already have.

It was colliding with a flag of similar name in the nexthop struct.

Change it from NEXTHOP_GROUP_DUPLICATE -> NEXTHOP_GROUP_UNHASHABLE
since it is in fact unhashable.

Also change the wording of functions and comments referencing the same
problem.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
zebra/zebra_nhg.c
zebra/zebra_nhg.h
zebra/zebra_vty.c

index 9afecbd909145f9f94f35f65463838ac3535e571..1b9440218b666011c6765b6c7f202180f02ae1ca 100644 (file)
@@ -663,27 +663,28 @@ static struct nhg_ctx *nhg_ctx_init(uint32_t id, struct nexthop *nh,
        return ctx;
 }
 
-static bool zebra_nhg_contains_dup(struct nhg_hash_entry *nhe)
+static bool zebra_nhg_contains_unhashable(struct nhg_hash_entry *nhe)
 {
        struct nhg_connected *rb_node_dep = NULL;
 
        frr_each(nhg_connected_tree, &nhe->nhg_depends, rb_node_dep) {
                if (CHECK_FLAG(rb_node_dep->nhe->flags,
-                              NEXTHOP_GROUP_DUPLICATE))
+                              NEXTHOP_GROUP_UNHASHABLE))
                        return true;
        }
 
        return false;
 }
 
-static void zebra_nhg_set_dup(struct nhg_hash_entry *nhe)
+static void zebra_nhg_set_unhashable(struct nhg_hash_entry *nhe)
 {
-       SET_FLAG(nhe->flags, NEXTHOP_GROUP_DUPLICATE);
+       SET_FLAG(nhe->flags, NEXTHOP_GROUP_UNHASHABLE);
        SET_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED);
 
-       flog_warn(EC_ZEBRA_DUPLICATE_NHG_MESSAGE,
-                 "Nexthop Group with ID (%d) is a duplicate, ignoring",
-                 nhe->id);
+       flog_warn(
+               EC_ZEBRA_DUPLICATE_NHG_MESSAGE,
+               "Nexthop Group with ID (%d) is a duplicate, therefore unhashable, ignoring",
+               nhe->id);
 }
 
 static void zebra_nhg_release(struct nhg_hash_entry *nhe)
@@ -695,10 +696,10 @@ static void zebra_nhg_release(struct nhg_hash_entry *nhe)
                if_nhg_dependents_del(nhe->ifp, nhe);
 
        /*
-        * If its a dup, we didn't store it here and have to be
+        * If its unhashable, we didn't store it here and have to be
         * sure we don't clear one thats actually being used.
         */
-       if (!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_DUPLICATE))
+       if (!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_UNHASHABLE))
                hash_release(zrouter.nhgs, nhe);
 
        hash_release(zrouter.nhgs_id, nhe);
@@ -786,19 +787,20 @@ static int nhg_ctx_process_new(struct nhg_ctx *ctx)
                         * changes.
                         *
                         * We maintain them *ONLY* in the ID hash table to
-                        * track them.
+                        * track them and set the flag to indicated
+                        * their attributes are unhashable.
                         */
 
                        kernel_nhe = zebra_nhg_copy(nhe, id);
                        zebra_nhg_insert_id(kernel_nhe);
-                       zebra_nhg_set_dup(kernel_nhe);
-               } else if (zebra_nhg_contains_dup(nhe)) {
-                       /* The group we got contains a duplciate depend,
-                        * so lets mark this group as a dup as well and release
-                        * it from the non-ID hash.
+                       zebra_nhg_set_unhashable(kernel_nhe);
+               } else if (zebra_nhg_contains_unhashable(nhe)) {
+                       /* The group we got contains an unhashable/duplicated
+                        * depend, so lets mark this group as unhashable as well
+                        * and release it from the non-ID hash.
                         */
                        hash_release(zrouter.nhgs, nhe);
-                       zebra_nhg_set_dup(nhe);
+                       zebra_nhg_set_unhashable(nhe);
                } else {
                        /* It actually created a new nhe */
                        SET_FLAG(nhe->flags, NEXTHOP_GROUP_VALID);
index e5eb51862880adae730730db1ad70863cc138bb5..82f54a3a63f3674a261b810fb277083f36f9abce 100644 (file)
@@ -99,10 +99,13 @@ struct nhg_hash_entry {
  */
 #define NEXTHOP_GROUP_RECURSIVE (1 << 3)
 /*
- * This is a duplicate nexthop we got from the kernel, we are only tracking
- * it in our ID hash table, it is unusable by our routes.
+ * This is a nexthop group we got from the kernel, it is identical to
+ * one we already have. (The kernel allows duplicate nexthops, we don't
+ * since we hash on them). We are only tracking it in our ID table,
+ * it is unusable by our created routes but may be used by routes we get
+ * from the kernel. Therefore, it is unhashable.
  */
-#define NEXTHOP_GROUP_DUPLICATE (1 << 4)
+#define NEXTHOP_GROUP_UNHASHABLE (1 << 4)
 };
 
 /* Was this one we created, either this session or previously? */
index 7f569cdb0eefd6c70eda836fe302c850a300f32b..9d174547305e77c186202ae5cfacf28b34530287 100644 (file)
@@ -1122,7 +1122,7 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe)
        else
                vty_out(vty, "     VRF: UNKNOWN\n");
 
-       if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_DUPLICATE))
+       if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_UNHASHABLE))
                vty_out(vty, "     Duplicate - from kernel not hashable\n");
 
        if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID)) {