From 616100d7e08466979ba0ea0823d90037ad6bc7a3 Mon Sep 17 00:00:00 2001 From: bzsuni Date: Thu, 16 Nov 2023 20:06:54 +0800 Subject: [PATCH] Fix IP repetition when testing IPv6 allocation Signed-off-by: bzsuni --- pkg/egressgateway/egress_gateway.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/egressgateway/egress_gateway.go b/pkg/egressgateway/egress_gateway.go index 001a44ff8..cac75d00b 100644 --- a/pkg/egressgateway/egress_gateway.go +++ b/pkg/egressgateway/egress_gateway.go @@ -1070,7 +1070,7 @@ func setEipStatus(ipv4, ipv6 string, nodeName string, policy egress.Policy, node newEipStatus := egress.EgressIPStatus{} for _, eip := range eipStatus.Eips { - if ipv4 == eip.IPv4 { + if (len(ipv4) != 0 && ipv4 == eip.IPv4) || (len(ipv6) != 0 && ipv6 == eip.IPv6) { eip.Policies = append(eip.Policies, policy) isExist = true