Skip to content

Commit 4ff3cb0

Browse files
authored
Label tier default action when programming dataplane rules (#10023)
* label end of tier in iptables/nftables * change the bpf policy program * Fix UTs
1 parent 0a9273a commit 4ff3cb0

File tree

4 files changed

+96
-307
lines changed

4 files changed

+96
-307
lines changed

felix/bpf/polprog/pol_prog_builder.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ func (p *Builder) writeTiers(tiers []Tier, destLeg matchLeg, allowLabel string)
504504
if action == TierEndUndef {
505505
action = TierEndDeny
506506
}
507-
p.b.AddCommentF("End of tier %s", tier.Name)
507+
p.b.AddCommentF("End of tier %s: %s", tier.Name, tier.EndAction)
508508
log.Debugf("End of tier %d %q: %s", p.tierID, tier.Name, action)
509509
p.writeRule(Rule{
510510
Rule: &proto.Rule{},

felix/dataplane/linux/endpoint_mgr_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ func chainsForIfaces(ipVersion uint8,
363363
{
364364
Match: iptables.Match().MarkClear(16),
365365
Action: iptables.DropAction{},
366-
Comment: []string{"Drop if no policies passed packet"},
366+
Comment: []string{fmt.Sprintf("End of tier %v. Drop if no policies passed packet", tierName)},
367367
},
368368
}...)
369369
}
@@ -473,7 +473,7 @@ func chainsForIfaces(ipVersion uint8,
473473
{
474474
Match: iptables.Match().MarkClear(16),
475475
Action: iptables.DropAction{},
476-
Comment: []string{"Drop if no policies passed packet"},
476+
Comment: []string{fmt.Sprintf("End of tier %v. Drop if no policies passed packet", tierName)},
477477
},
478478
}...)
479479
}

felix/rules/endpoints.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,12 @@ func (r *DefaultRuleRenderer) endpointIptablesChain(
698698
})
699699
}
700700
rules = append(rules, generictables.Rule{
701-
Match: r.NewMatch().MarkClear(r.MarkPass),
702-
Action: r.IptablesFilterDenyAction(),
703-
Comment: []string{fmt.Sprintf("%s if no policies passed packet", r.IptablesFilterDenyAction())},
701+
Match: r.NewMatch().MarkClear(r.MarkPass),
702+
Action: r.IptablesFilterDenyAction(),
703+
Comment: []string{fmt.Sprintf("End of tier %s. %s if no policies passed packet",
704+
tier.Name,
705+
r.IptablesFilterDenyAction()),
706+
},
704707
})
705708
} else if r.FlowLogsEnabled {
706709
// If we do not require an end of tier drop (i.e. because all of the policies in the tier are

0 commit comments

Comments
 (0)