Skip to content

Commit 23b5d45

Browse files
authored
[client] Fix port range squashing (#4007)
1 parent 0e5dc9d commit 23b5d45

File tree

2 files changed

+434
-2
lines changed

2 files changed

+434
-2
lines changed

client/internal/acl/manager.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,15 @@ func (d *DefaultManager) squashAcceptRules(
398398
//
399399
// We zeroed this to notify squash function that this protocol can't be squashed.
400400
addRuleToCalculationMap := func(i int, r *mgmProto.FirewallRule, protocols map[mgmProto.RuleProtocol]*protoMatch) {
401-
drop := r.Action == mgmProto.RuleAction_DROP || r.Port != ""
402-
if drop {
401+
hasPortRestrictions := r.Action == mgmProto.RuleAction_DROP ||
402+
r.Port != "" || !portInfoEmpty(r.PortInfo)
403+
404+
if hasPortRestrictions {
405+
// Don't squash rules with port restrictions
403406
protocols[r.Protocol] = &protoMatch{ips: map[string]int{}}
404407
return
405408
}
409+
406410
if _, ok := protocols[r.Protocol]; !ok {
407411
protocols[r.Protocol] = &protoMatch{
408412
ips: map[string]int{},

0 commit comments

Comments
 (0)