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)
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);
* 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);
*/
#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? */