Skip to content

Commit

Permalink
remove incorrect error logging
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Sep 4, 2024
1 parent be408f8 commit f68ac0a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pkg/util/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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
}
}
Expand All @@ -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 ""
}
Expand All @@ -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 ""
}
Expand Down

0 comments on commit f68ac0a

Please sign in to comment.