8000 net: apply traffic_rule entries in config order by matepad007 · Pull Request #419 · google/nsjail · GitHub
[go: up one dir, main page]

Skip to content

net: apply traffic_rule entries in config order - #419

Open
matepad007 wants to merge 1 commit into
google:masterfrom
matepad007:traffic-rule-order
Open

matepad007 wants to merge 1 commit into
google:masterfrom
matepad007:traffic-rule-order

Conversation

@matepad007
Copy link
Copy Markdown
Contributor

traffic_rule entries were added as ip rules without a priority, so the kernel put each new rule ahead of the previous one and later entries were evaluated first. A narrower ALLOW listed before a broader DROP ended up behind it.

Give each rule an explicit ascending priority (1000 + index, below the main table lookup) and document the order in config.proto. Adds tests/traffic_rule_order_test.sh, which fails on master and passes with this change.

rtnl_rule_add() without a priority makes the kernel place each new rule
before the previously added one, so rules listed later in the config
were evaluated first. A broad ALLOW listed after a narrower DROP then
shadowed it. Give each rule an explicit ascending priority.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0