Skip to content

fix: replace dw_filter table on reload instead of appending rules - #1

Merged
autoantohaki merged 1 commit into
mainfrom
fix/nftables-idempotent-reload
Oct 21, 2026
Merged

autoantohaki merged 1 commit into
mainfrom
fix/nftables-idempotent-reload

Conversation

@autoantohaki

Copy link
Copy Markdown
Member

Requested by mau

Before: loading a rendered nftables file a second time added a second copy of every rule to dw_filter, even though the header says the file replaces that table.

After: reloading the file atomically replaces dw_filter and leaves every other table alone.

How: the ruleset now declares the table, deletes it, then defines it again, which is the standard nft idiom for atomic replacement. A test checks that order.

Loading the rendered ruleset twice added a second copy of every rule
because nft -f merges into an existing table. Declare, delete, then
redefine the table so the file atomically replaces only dw_filter.
@autoantohaki
autoantohaki merged commit 5e1a101 into main Oct 21, 2026
8 checks 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.

1 participant