Skip to content

fix(net-filter): use rule id as map key in update_rule - #138

Open
JoeSergen wants to merge 1 commit into
DKapture:mainfrom
JoeSergen:fix/netfilter-update-rule-key
Open

fix(net-filter): use rule id as map key in update_rule#138
JoeSergen wants to merge 1 commit into
DKapture:mainfrom
JoeSergen:fix/netfilter-update-rule-key

Conversation

@JoeSergen

Copy link
Copy Markdown

Fixes #135

NetFilter::update_rule()ignored the caller-providedrule_idand wrote to&key_cntinstead, so updating a rule silently modified the wrong map entry (or failed withBPF_EXISTwhen that slot did not exist). Use&key` so the operation targets the requested rule id.

update_rule() was writing to &key_cnt instead of the caller-provided
rule id, so updating a rule silently modified the wrong map entry (or
failed with BPF_EXIST when that slot did not exist). Use &key so the
operation targets the rule id given by the caller.
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.

Bug: NetFilter::update_rule() 忽略 rule_id,更新规则写入错误的 map key

1 participant