mirror of
https://github.com/juanfont/headscale.git
synced 2026-01-23 10:25:47 +00:00
fix: free ips from usedIps ipset on DeleteNode
This commit is contained in:
parent
6d24afba1c
commit
299cef4e99
2 changed files with 11 additions and 0 deletions
|
|
@ -341,3 +341,12 @@ func (db *HSDatabase) BackfillNodeIPs(i *IPAllocator) ([]string, error) {
|
|||
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func (i *IPAllocator) FreeIPs(ips []netip.Addr) {
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
|
||||
for _, ip := range ips {
|
||||
i.usedIPs.Remove(ip)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -429,6 +429,8 @@ func (s *State) DeleteNode(node types.NodeView) (change.ChangeSet, error) {
|
|||
return change.EmptySet, err
|
||||
}
|
||||
|
||||
s.ipAlloc.FreeIPs(node.IPs())
|
||||
|
||||
c := change.NodeRemoved(node.ID())
|
||||
|
||||
// Check if policy manager needs updating after node deletion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue