Repository navigation
ICMP redirects off by default (#21) - #55
Merged
Merged
Conversation
A client that follows a redirect bypasses the router: conntrack, the firewall, accounting and flow
offload only see its first packet (static routes to LAN hosts, policy routing, side-router setups).
OpenWrt did the same (openwrt#24873).
- 90-mini-router.conf: net.ipv4.conf.{all,default}.send_redirects=0 — the kernel sends a redirect
when all OR the netdev's value is set; default reaches existing netdevs never set on their own and
every netdev created later.
- CI, real kernel: in a network namespace a netdev created before and one created after loading the
rendered file both end up with send_redirects=0; unit test for the rendered lines.
Closes #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
/etc/sysctl.d/90-mini-router.confnow setsnet.ipv4.conf.all.send_redirects=0andnet.ipv4.conf.default.send_redirects=0.Why
When the router forwards a packet back out of the interface it arrived on (a static route to a LAN host, policy routing, the planned side-router mode), the kernel sends the client an ICMP redirect. Clients that follow it talk to the next hop directly: conntrack sees only the first packet, and access rules, traffic accounting and hardware flow offload stop applying. OpenWrt changed the same default (openwrt#24873).
Both keys are needed: the kernel sends a redirect when
allor the netdev's own value is set. Writingdefaultalso copies the value to every existing netdev whose own value was never written, and netdevs created later (the LAN bridge, PPP links, WiFi) start from it.Verification
send_redirects=1, and no other sysctl file sets the key at boot (Alpine's00-alpine.confdoes not), so the boot run of this file reaches all of them.tools/ci.d/sys.sh): in a network namespace, a dummy netdev created before and one created after loading the rendered file both end up withsend_redirects=0(withallanddefault). The check also documents a kernel detail found on the way: a netdev created after an earlier write todefaultinherits a "set" flag and would miss later changes ofdefault.tools/ci.shpasses (private and public trees).Closes #21
https://claude.ai/code/session_01HWeUjo1dmS7gBkCYHrVjCr