From f68ac0a3ef630643bcaec6620b611e94c15d7f90 Mon Sep 17 00:00:00 2001 From: zhangzujian Date: Wed, 4 Sep 2024 06:01:32 +0000 Subject: [PATCH] remove incorrect error logging Signed-off-by: zhangzujian --- pkg/util/net.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/util/net.go b/pkg/util/net.go index 23bf0e4a8f5..2a96bd0c9e6 100644 --- a/pkg/util/net.go +++ b/pkg/util/net.go @@ -121,7 +121,6 @@ func CIDRContainIP(cidrStr, ipStr string) bool { if len(cidrs) == 1 { for _, ip := range ips { if CheckProtocol(cidrStr) != CheckProtocol(ip) { - klog.Errorf("ip %s and cidr %s should be the same protocol", ip, cidrStr) return false } } @@ -140,12 +139,10 @@ func CIDRContainIP(cidrStr, ipStr string) bool { } ipAddr := net.ParseIP(ip) if ipAddr == nil { - klog.Errorf("invalid ip %s", ip) + klog.Errorf("invalid ip %q", ip) return false } - if !cidrNet.Contains(ipAddr) { - klog.Errorf("ip %s is not in cidr %s", ip, cidr) return false } } @@ -165,7 +162,7 @@ func CheckProtocol(address string) string { if IP2.To4() != nil && IP1.To4() == nil && IP1.To16() != nil { return kubeovnv1.ProtocolDual } - err := fmt.Errorf("invalid address %s", address) + err := fmt.Errorf("invalid address %q", address) klog.Error(err) return "" } @@ -179,7 +176,7 @@ func CheckProtocol(address string) string { } // cidr format error - err := fmt.Errorf("invalid address %s", address) + err := fmt.Errorf("invalid address %q", address) klog.Error(err) return "" }