feature/conn25: disallow addrs assignment overwriting.
We don't want addr assignments to be lost from the collection before they can be returned to the IP pools, otherwise we will get orphan addresses marked inUse in the pools that will never be returned. Fixes tailscale/corp#39975 Signed-off-by: Fran Bull <fran@tailscale.com>
This commit is contained in:
@@ -51,20 +51,10 @@ func TestAssignmentsExpire(t *testing.T) {
|
||||
if foundAsAfter.isValid() {
|
||||
t.Fatal("expected zero val")
|
||||
}
|
||||
// Now we can reuse the addresses
|
||||
// We should only be able to write old addresses again if they've been removed from the maps (eg with popExpired).
|
||||
err = assignments.insert(as)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
foundAs, ok = assignments.lookupByMagicIP(as.magic)
|
||||
if !ok {
|
||||
t.Fatal("expected to find")
|
||||
}
|
||||
if foundAs.dst != as.dst {
|
||||
t.Fatalf("want %v; got %v", as.dst, foundAs.dst)
|
||||
}
|
||||
if !foundAs.expiresAt.After(clock.Now()) {
|
||||
t.Fatalf("expected foundAs to expire after now")
|
||||
if err == nil {
|
||||
t.Fatal("expected an error but got nil")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user