kernel-netlink: Properly clean up pending entry if VIP installation failed

This could prevent the VIP from getting installed later and actually
causes those threads to block indefinitely as they wait for the entry to
either get removed or the VIP marked as installed, which will never
happen.

Fixes: c6b401581a ("Changed how kernel-netlink handles virtual IP addresses")
This commit is contained in:
Tobias Brunner
2026-07-24 08:47:39 +02:00
parent c52fd0c518
commit 4eaaf19217
@@ -2450,6 +2450,17 @@ METHOD(kernel_net_t, add_ip, status_t,
}
this->lock->unlock(this->lock);
}
this->lock->write_lock(this->lock);
entry = this->vips->get_match(this->vips, &lookup,
(void*)addr_map_entry_match);
if (entry)
{ /* clean up the pending entry we inserted */
iface->addrs->remove(iface->addrs, addr, NULL);
addr_map_entry_remove(this->vips, addr, iface);
addr_entry_destroy(addr);
this->condvar->broadcast(this->condvar);
}
this->lock->unlock(this->lock);
DBG1(DBG_KNL, "adding virtual IP %H failed", virtual_ip);
return FAILED;
}