From 5169ef5fb544471610c575dfaa35410ec85ffd0f Mon Sep 17 00:00:00 2001 From: Andrew Sy Kim Date: Thu, 2 Apr 2020 16:06:51 -0400 Subject: [PATCH] proxy: remove redundant length check on local address set Signed-off-by: Andrew Sy Kim --- pkg/proxy/iptables/proxier.go | 2 +- pkg/proxy/ipvs/proxier.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/proxy/iptables/proxier.go b/pkg/proxy/iptables/proxier.go index 75b69122860..5aa8f14b0d5 100644 --- a/pkg/proxy/iptables/proxier.go +++ b/pkg/proxy/iptables/proxier.go @@ -1033,7 +1033,7 @@ func (proxier *Proxier) syncProxyRules() { // If the "external" IP happens to be an IP that is local to this // machine, hold the local port open so no other process can open it // (because the socket might open but it would never work). - if localAddrSet.Len() > 0 && (svcInfo.Protocol() != v1.ProtocolSCTP) && localAddrSet.Has(net.ParseIP(externalIP)) { + if (svcInfo.Protocol() != v1.ProtocolSCTP) && localAddrSet.Has(net.ParseIP(externalIP)) { lp := utilproxy.LocalPort{ Description: "externalIP for " + svcNameString, IP: externalIP, diff --git a/pkg/proxy/ipvs/proxier.go b/pkg/proxy/ipvs/proxier.go index c14edea726f..216be94e940 100644 --- a/pkg/proxy/ipvs/proxier.go +++ b/pkg/proxy/ipvs/proxier.go @@ -1216,7 +1216,7 @@ func (proxier *Proxier) syncProxyRules() { // If the "external" IP happens to be an IP that is local to this // machine, hold the local port open so no other process can open it // (because the socket might open but it would never work). - if localAddrSet.Len() > 0 && (svcInfo.Protocol() != v1.ProtocolSCTP) && localAddrSet.Has(net.ParseIP(externalIP)) { + if (svcInfo.Protocol() != v1.ProtocolSCTP) && localAddrSet.Has(net.ParseIP(externalIP)) { // We do not start listening on SCTP ports, according to our agreement in the SCTP support KEP lp := utilproxy.LocalPort{ Description: "externalIP for " + svcNameString,