fix(nsc): properly check hairpinning rule

Previously, we would iterate over rulesFromNode, but then check it
against the entirety of the rulesNeeded hash. This resulted in the loop
breaking as soon as it found any matching rule from the host rather than
it breaking if it matched the rule that we were currently processing.
This commit is contained in:
Aaron U'Ren 2021-12-02 19:06:43 -06:00
parent 146786ad8a
commit 2ca39f14f8

View File

@ -1423,11 +1423,11 @@ func (nsc *NetworkServicesController) syncHairpinIptablesRules() error {
} }
// Apply the rules we need // Apply the rules we need
for _, ruleArgs := range rulesNeeded { for rule, ruleArgs := range rulesNeeded {
ruleExists := false ruleExists := false
for _, ruleFromNode := range rulesFromNode { for _, ruleFromNode := range rulesFromNode {
_, ruleExists = rulesNeeded[ruleFromNode] if rule == ruleFromNode {
if ruleExists { ruleExists = true
break break
} }
} }