Skip to content

Commit

Permalink
exclude vip as encap ip (#3855)
Browse files Browse the repository at this point in the history
Signed-off-by: Changlu Yi <clyi@alauda.io>
  • Loading branch information
changluyi committed Mar 22, 2024
1 parent 3cd21ed commit 350eabb
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 @@ -234,6 +234,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 350eabb

Please sign in to comment.