From 189e6fae97622ce23c55beff85188fc0ee0036ef Mon Sep 17 00:00:00 2001 From: Max Asnaashari Date: Fri, 19 Apr 2024 19:43:47 +0000 Subject: [PATCH] microcloud/cmd/microcloud: Don't use mDNS payload address for local node verification Signed-off-by: Max Asnaashari --- microcloud/cmd/microcloud/main_init.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/microcloud/cmd/microcloud/main_init.go b/microcloud/cmd/microcloud/main_init.go index 9b2139155..99b0d71e7 100644 --- a/microcloud/cmd/microcloud/main_init.go +++ b/microcloud/cmd/microcloud/main_init.go @@ -505,9 +505,15 @@ func validateSystems(s *service.Handler, systems map[string]InitSystem) (err err // Ensure that no system's management address falls within the OVN ranges // to prevent OVN from allocating an IP that's already in use. for systemName, system := range systems { - systemAddr := net.ParseIP(system.ServerInfo.Address) + // If the system is ourselves, we don't have an mDNS payload so grab the address locally. + addr := system.ServerInfo.Address + if systemName == s.Name { + addr = s.Address + } + + systemAddr := net.ParseIP(addr) if systemAddr == nil { - return fmt.Errorf("Invalid address %q for system %q", system.ServerInfo.Address, systemName) + return fmt.Errorf("Invalid address %q for system %q", addr, systemName) } for _, ipRange := range ip4OVNRanges {