Skip to content

Commit

Permalink
exclude vip as encap ip (#3859)
Browse files Browse the repository at this point in the history
Signed-off-by: Changlu Yi <[email protected]>
  • Loading branch information
changluyi authored Mar 22, 2024
1 parent 2f48cc7 commit 54c95e4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/daemon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,17 @@ func (config *Configuration) initNicConfig(nicBridgeMappings map[string]string)
return fmt.Errorf("failed to get iface addr. %v", err)
}
for _, addr := range addrs {
_, ipCidr, err := net.ParseCIDR(addr.String())
if err != nil {
klog.Errorf("Failed to parse CIDR address %s: %v", addr.String(), err)
continue
}
// exclude the vip as encap ip
if ones, bits := ipCidr.Mask.Size(); ones == bits {
klog.Infof("Skip address %s", ipCidr.String())
continue
}

ipStr := strings.Split(addr.String(), "/")[0]
if ip := net.ParseIP(ipStr); ip == nil || ip.IsLinkLocalUnicast() {
continue
Expand Down

0 comments on commit 54c95e4

Please sign in to comment.