1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-11-10 01:20:58 +01:00
This commit is contained in:
Andrey 2025-11-03 16:06:50 +02:00 committed by GitHub
commit fa50e5d538
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -337,3 +337,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)
}
}

View File

@ -423,6 +423,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