Skip to content

Commit 5169ef5

Browse files
committed
proxy: remove redundant length check on local address set
Signed-off-by: Andrew Sy Kim <[email protected]>
1 parent 8ae2609 commit 5169ef5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/proxy/iptables/proxier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ func (proxier *Proxier) syncProxyRules() {
10331033
// If the "external" IP happens to be an IP that is local to this
10341034
// machine, hold the local port open so no other process can open it
10351035
// (because the socket might open but it would never work).
1036-
if localAddrSet.Len() > 0 && (svcInfo.Protocol() != v1.ProtocolSCTP) && localAddrSet.Has(net.ParseIP(externalIP)) {
1036+
if (svcInfo.Protocol() != v1.ProtocolSCTP) && localAddrSet.Has(net.ParseIP(externalIP)) {
10371037
lp := utilproxy.LocalPort{
10381038
Description: "externalIP for " + svcNameString,
10391039
IP: externalIP,

pkg/proxy/ipvs/proxier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ func (proxier *Proxier) syncProxyRules() {
12161216
// If the "external" IP happens to be an IP that is local to this
12171217
// machine, hold the local port open so no other process can open it
12181218
// (because the socket might open but it would never work).
1219-
if localAddrSet.Len() > 0 && (svcInfo.Protocol() != v1.ProtocolSCTP) && localAddrSet.Has(net.ParseIP(externalIP)) {
1219+
if (svcInfo.Protocol() != v1.ProtocolSCTP) && localAddrSet.Has(net.ParseIP(externalIP)) {
12201220
// We do not start listening on SCTP ports, according to our agreement in the SCTP support KEP
12211221
lp := utilproxy.LocalPort{
12221222
Description: "externalIP for " + svcNameString,

0 commit comments

Comments
 (0)