diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index c6031209a..fc3396132 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -1600,6 +1600,20 @@ func (b *LocalBackend) initPeerAPIListener() { b.mu.Lock() defer b.mu.Unlock() + if len(b.netMap.Addresses) == len(b.peerAPIListeners) { + allSame := true + for i, pln := range b.peerAPIListeners { + if pln.ip != b.netMap.Addresses[i].IP { + allSame = false + break + } + } + if allSame { + // Nothing to do. + return + } + } + b.peerAPIServer = nil for _, pln := range b.peerAPIListeners { pln.Close()