diff options
| -rw-r--r-- | zebra/zebra_nhg.c | 34 | ||||
| -rw-r--r-- | zebra/zebra_nhg.h | 9 | ||||
| -rw-r--r-- | zebra/zebra_vty.c | 2 |
3 files changed, 25 insertions, 20 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 9afecbd909..1b9440218b 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -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); diff --git a/zebra/zebra_nhg.h b/zebra/zebra_nhg.h index e5eb518628..82f54a3a63 100644 --- a/zebra/zebra_nhg.h +++ b/zebra/zebra_nhg.h @@ -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? */ diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 7f569cdb0e..9d17454730 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -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)) { |
