summaryrefslogtreecommitdiff
path: root/zebra/zebra_nhg.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_nhg.c')
-rw-r--r--zebra/zebra_nhg.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 712b2534cc..f5141c8f23 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -572,8 +572,7 @@ bool zebra_nhg_hash_equal(const void *arg1, const void *arg2)
/* Nexthops should be in-order, so we simply compare them in-place */
for (nexthop1 = nhe1->nhg.nexthop, nexthop2 = nhe2->nhg.nexthop;
nexthop1 && nexthop2;
- nexthop1 = nexthop1->next, nexthop2 = nexthop2->next) {
-
+ nexthop1 = nexthop_next(nexthop1), nexthop2 = nexthop_next(nexthop2)) {
if (!nhg_compare_nexthops(nexthop1, nexthop2))
return false;
}
@@ -608,8 +607,7 @@ bool zebra_nhg_hash_equal(const void *arg1, const void *arg2)
for (nexthop1 = nhe1->backup_info->nhe->nhg.nexthop,
nexthop2 = nhe2->backup_info->nhe->nhg.nexthop;
nexthop1 && nexthop2;
- nexthop1 = nexthop1->next, nexthop2 = nexthop2->next) {
-
+ nexthop1 = nexthop_next(nexthop1), nexthop2 = nexthop_next(nexthop2)) {
if (!nhg_compare_nexthops(nexthop1, nexthop2))
return false;
}
@@ -1762,7 +1760,8 @@ void zebra_nhg_decrement_ref(struct nhg_hash_entry *nhe)
nhe->refcnt--;
if (!zebra_router_in_shutdown() && nhe->refcnt <= 0 &&
- CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED) &&
+ (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED) ||
+ CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) &&
!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_KEEP_AROUND)) {
nhe->refcnt = 1;
SET_FLAG(nhe->flags, NEXTHOP_GROUP_KEEP_AROUND);
@@ -3382,7 +3381,17 @@ void zebra_nhg_install_kernel(struct nhg_hash_entry *nhe, uint8_t type)
void zebra_nhg_uninstall_kernel(struct nhg_hash_entry *nhe)
{
- if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED)) {
+ /*
+ * Clearly if the nexthop group is installed we should
+ * remove it. Additionally If the nexthop is already
+ * QUEUED for installation, we should also just send
+ * a deletion down as well. We cannot necessarily pluck
+ * the installation out of the queue ( since it may have
+ * already been acted on, but not processed yet in the
+ * main pthread ).
+ */
+ if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED) ||
+ CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) {
int ret = dplane_nexthop_delete(nhe);
switch (ret) {