Skip to content

Commit cac8230

Browse files
committed
bridge, spoof check: remove drop rule index
Rules are appendend by default, thus using an index is redundant. Using an index also requires the full NFT cache, which causes a CNI ADD to be extremely slow. Signed-off-by: Miguel Duarte Barroso <[email protected]>
1 parent 63235a2 commit cac8230

File tree

2 files changed

+0
-3
lines changed

2 files changed

+0
-3
lines changed

pkg/link/spoofcheck.go

-2
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,10 @@ func (sc *SpoofChecker) matchMacRule(chain string) *schema.Rule {
195195
}
196196

197197
func (sc *SpoofChecker) dropRule(chain string) *schema.Rule {
198-
macRulesIndex := nft.NewRuleIndex()
199198
return &schema.Rule{
200199
Family: schema.FamilyBridge,
201200
Table: natTableName,
202201
Chain: chain,
203-
Index: macRulesIndex.Next(),
204202
Expr: []schema.Statement{
205203
{Verdict: schema.Verdict{SimpleVerdict: schema.SimpleVerdict{Drop: true}}},
206204
},

pkg/link/spoofcheck_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ func assertExpectedRulesInSetupConfig(c configurerStub) {
254254
"comment":"macspoofchk-container99-net1"}},
255255
{"rule":{"family":"bridge","table":"nat","chain":"cni-br-iface-container99-net1-mac",
256256
"expr":[{"drop":null}],
257-
"index":0,
258257
"comment":"macspoofchk-container99-net1"}}
259258
]}`
260259
ExpectWithOffset(1, string(jsonConfig)).To(MatchJSON(expectedConfig))

0 commit comments

Comments
 (0)