Skip to content

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

Merged
xu-lang merged 1 commit into
DKapture:mainfrom
JoeSergen:fix/netfilter-update-rule-key
Sep 11, 2026
Merged

fix(net-filter): use rule id as map key in update_rule#138
xu-lang merged 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.
@xu-lang
xu-lang merged commit 5e4f18f into DKapture:main Sep 11, 2026
1 check passed
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

2 participants