Skip to content

Commit

Permalink
fix: err log
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <[email protected]>
  • Loading branch information
bobz965 committed Sep 11, 2024
1 parent 486cde8 commit 806ca9c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/util/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,15 @@ func ExpandExcludeIPs(excludeIPs []string, cidr string) []string {
}
} else {
for _, cidrBlock := range strings.Split(cidr, ",") {
if CIDRContainIP(cidrBlock, excludeIP) && excludeIP != SubnetNumber(cidrBlock) && excludeIP != SubnetBroadcast(cidrBlock) {
rv = append(rv, excludeIP)
break
// exclude ip should be the same protocol with cidr
if CheckProtocol(cidrBlock) == CheckProtocol(excludeIP) {
// exclude ip should be in the range of cidr and not cidr addr and broadcast addr
if CIDRContainIP(cidrBlock, excludeIP) && excludeIP != SubnetNumber(cidrBlock) && excludeIP != SubnetBroadcast(cidrBlock) {
rv = append(rv, excludeIP)
break
}
klog.Errorf("CIDR %s not contains the exclude ip %s", cidrBlock, excludeIP)
}
klog.Errorf("CIDR %s not contains the exclude ip %s", cidrBlock, excludeIP)
}
}
}
Expand Down

0 comments on commit 806ca9c

Please sign in to comment.