Merge pull request #17814 from donaldsharp/nhg_removal_in_some_situations

This commit is contained in:
Donatas Abraitis 2025-01-17 17:31:19 +02:00 committed by GitHub
commit 76ed8f61d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1762,7 +1762,8 @@ void zebra_nhg_decrement_ref(struct nhg_hash_entry *nhe)
nhe->refcnt--; nhe->refcnt--;
if (!zebra_router_in_shutdown() && nhe->refcnt <= 0 && 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)) { !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_KEEP_AROUND)) {
nhe->refcnt = 1; nhe->refcnt = 1;
SET_FLAG(nhe->flags, NEXTHOP_GROUP_KEEP_AROUND); SET_FLAG(nhe->flags, NEXTHOP_GROUP_KEEP_AROUND);
@ -3382,7 +3383,17 @@ void zebra_nhg_install_kernel(struct nhg_hash_entry *nhe, uint8_t type)
void zebra_nhg_uninstall_kernel(struct nhg_hash_entry *nhe) 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); int ret = dplane_nexthop_delete(nhe);
switch (ret) { switch (ret) {