Browse Source

lib/nat: Don't crash on empty address list (fixes #9503) (#9504)

Jakob Borg 1 year ago
parent
commit
79ae24df76
1 changed files with 2 additions and 3 deletions
  1. 2 3
      lib/nat/service.go

+ 2 - 3
lib/nat/service.go

@@ -233,9 +233,8 @@ func (s *Service) verifyExistingLocked(ctx context.Context, mapping *Mapping, na
 		default:
 		}
 
-		// Delete addresses for NATDevice's that do not exist anymore
-		nat, ok := nats[id]
-		if !ok {
+		if nat, ok := nats[id]; !ok || len(extAddrs) == 0 {
+			// Delete addresses for NATDevice's that do not exist anymore
 			mapping.removeAddressLocked(id)
 			change = true
 			continue