diff --git a/pkg/proxy/ipvs/netlink_linux.go b/pkg/proxy/ipvs/netlink_linux.go index bb8e267712c..c917c9429c0 100644 --- a/pkg/proxy/ipvs/netlink_linux.go +++ b/pkg/proxy/ipvs/netlink_linux.go @@ -30,12 +30,12 @@ import ( type netlinkHandle struct { netlink.Handle - ipv6 bool + isIPv6 bool } // NewNetLinkHandle will crate a new NetLinkHandle -func NewNetLinkHandle(ipv6 bool) NetLinkHandle { - return &netlinkHandle{netlink.Handle{}, ipv6} +func NewNetLinkHandle(isIPv6 bool) NetLinkHandle { + return &netlinkHandle{netlink.Handle{}, isIPv6} } // EnsureAddressBind checks if address is bound to the interface and, if not, binds it. If the address is already bound, return true. @@ -182,8 +182,8 @@ func (h *netlinkHandle) GetLocalAddresses(dev, filterDev string) (sets.String, e if route.LinkIndex == filterLinkIndex { continue } - if h.ipv6 { - if route.Dst.IP.To4() == nil && ! route.Dst.IP.IsLinkLocalUnicast() { + if h.isIPv6 { + if route.Dst.IP.To4() == nil && !route.Dst.IP.IsLinkLocalUnicast() { res.Insert(route.Dst.IP.String()) } } else if route.Src != nil { diff --git a/pkg/proxy/ipvs/proxier.go b/pkg/proxy/ipvs/proxier.go index 28c745cbbe5..75e9a2c30da 100644 --- a/pkg/proxy/ipvs/proxier.go +++ b/pkg/proxy/ipvs/proxier.go @@ -382,14 +382,14 @@ func NewProxier(ipt utiliptables.Interface, healthzServer: healthzServer, ipvs: ipvs, ipvsScheduler: scheduler, - ipGetter: &realIPGetter{nl: NewNetLinkHandle(nodeIP.To4() == nil)}, + ipGetter: &realIPGetter{nl: NewNetLinkHandle(isIPv6)}, iptablesData: bytes.NewBuffer(nil), filterChainsData: bytes.NewBuffer(nil), natChains: bytes.NewBuffer(nil), natRules: bytes.NewBuffer(nil), filterChains: bytes.NewBuffer(nil), filterRules: bytes.NewBuffer(nil), - netlinkHandle: NewNetLinkHandle(nodeIP.To4() == nil), + netlinkHandle: NewNetLinkHandle(isIPv6), ipset: ipset, nodePortAddresses: nodePortAddresses, networkInterfacer: utilproxy.RealNetwork{},