Skip to content

Commit 4a63d95

Browse files
authored
Merge pull request kubernetes#89792 from andrewsykim/remove-redundant-len-check
proxy: remove redundant length check on local address sets
2 parents b0ed3cd + 5169ef5 commit 4a63d95

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
@@ -1031,7 +1031,7 @@ func (proxier *Proxier) syncProxyRules() {
10311031
// If the "external" IP happens to be an IP that is local to this
10321032
// machine, hold the local port open so no other process can open it
10331033
// (because the socket might open but it would never work).
1034-
if localAddrSet.Len() > 0 && (svcInfo.Protocol() != v1.ProtocolSCTP) && localAddrSet.Has(net.ParseIP(externalIP)) {
1034+
if (svcInfo.Protocol() != v1.ProtocolSCTP) && localAddrSet.Has(net.ParseIP(externalIP)) {
10351035
lp := utilproxy.LocalPort{
10361036
Description: "externalIP for " + svcNameString,
10371037
IP: externalIP,

pkg/proxy/ipvs/proxier.go

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

0 commit comments

Comments
 (0)