Skip to content

Don't leak sysctl.d drop-ins for internal networks - #1498

Open
hcebke wants to merge 3 commits into
containers:mainfrom
hcebke:main
Open

Don't leak sysctl.d drop-ins for internal networks#1498
hcebke wants to merge 3 commits into
containers:mainfrom
hcebke:main

Conversation

@hcebke

@hcebke hcebke commented Aug 9, 2026

Copy link
Copy Markdown

Fixes: #1497

These changed were generated by Claude Opus and then reviewed, edited, and tested by me.

@Luap99 Luap99 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mixing way to many things at once, this needs to be split in proper commits with proper reasons why they are needed. Staring with the bug at hand of the wrong internal condition.

I am also not convinced we need the "atomic" write behavior, our writes are small enough. And enabling forwarding on that one bridge should not be needed as we already enable the default forwarding.

Comment thread test/250-bridge-nftables.bats
hcebke added a commit to hcebke/netavark that referenced this pull request Aug 12, 2026
We cannot skip writing the sysctl.d drop-ins if they exist already,
anymore, because issue containers#1498 left stale ones with bad settings around.
This patch ensures netavark recovers from this bogus state without
rebooting the host.

Since systemd-sysctl operates concurrently, we also have to assume that
it is currently reading the file we're attempting to write. Thus, the
write needs to be atomic.

Signed-off-by: Hans-Christian Ebke <christian.ebke@rwth-aachen.de>
@hcebke

hcebke commented Aug 12, 2026

Copy link
Copy Markdown
Author

Fair point! I've split it up into multiple commits. I still think the atomic write is necessary (see my reasoning in the commit message). I removed emitting the forwarding = 1 setting for non-internal networks altogether, since it shouldn't be necessary as long as everything else operates as it should. (It would be kind of nice from a symmetry perspective, though, so maybe consider it. ;-))

Unit tests are green, Hoping the github tests will be too once they have finished running. 🤞

@hcebke

hcebke commented Aug 12, 2026

Copy link
Copy Markdown
Author

I did fat-finger the issue # in one commit message, though. :-(
Will force-push a revised commit message.

Comment thread src/network/bridge.rs

@Luap99 Luap99 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a rebase, logic wise seem fine now for me

@hcebke

hcebke commented Aug 18, 2026

Copy link
Copy Markdown
Author

Rebased. Checks currently in progress.

@mheon

mheon commented Aug 18, 2026

Copy link
Copy Markdown
Member

LGTM

hcebke added 3 commits August 22, 2026 11:51
Fixes: containers#1497

Signed-off-by: Hans-Christian Ebke <christian.ebke@rwth-aachen.de>
We cannot skip writing the sysctl.d drop-ins if they exist already,
anymore, because issue containers#1497 left stale ones with bad settings around.
This patch ensures netavark recovers from this bogus state without
rebooting the host.

Since systemd-sysctl operates concurrently, we also have to assume that
it is currently reading the file we're attempting to write. Thus, the
write needs to be atomic.

Signed-off-by: Hans-Christian Ebke <christian.ebke@rwth-aachen.de>
Relates to change from previous commit

Signed-off-by: Hans-Christian Ebke <christian.ebke@rwth-aachen.de>
@hcebke

hcebke commented Aug 23, 2026

Copy link
Copy Markdown
Author

I rebased once more. If you don't have any more change requests, would you mind merging this?

@mheon

mheon commented Aug 26, 2026

Copy link
Copy Markdown
Member

@Luap99 PTAL

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.

per-bridge sysctl.d drop-ins leaked for internal networks, disabling forwarding on unrelated external networks

3 participants