From bf7058423f47982d5f893ad2c7a251a9db4dba98 Mon Sep 17 00:00:00 2001 From: kangxiang Date: Fri, 6 Dec 2024 12:58:38 +0800 Subject: [PATCH] feat: agent sync aggregate subnet --- server/controller/genesis/updater.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/controller/genesis/updater.go b/server/controller/genesis/updater.go index cf1698c7e1f..da1a1afa6ce 100644 --- a/server/controller/genesis/updater.go +++ b/server/controller/genesis/updater.go @@ -451,7 +451,13 @@ func (v *GenesisSyncRpcUpdater) ParseHostAsVmPlatformInfo(info VIFRPCMessage, pe break } } - networkName := fmt.Sprintf("Network-%s/%v", firstIP.Address, firstIP.MaskLen) + networkIP, err := netaddr.ParseIP(firstIP.Address) + if err != nil { + log.Errorf("parse first ip (%s) err: (%s)", firstIP.Address, err.Error()) + continue + } + networkPrefix := netaddr.IPPrefixFrom(networkIP, uint8(firstIP.MaskLen)) + networkName := fmt.Sprintf("Network-%s", networkPrefix.Masked().String()) network, ok := nameToNetwork[networkName] vType := common.VIF_TYPE_LAN netType := common.NETWORK_TYPE_LAN