ateomnet: enable IPv6 forwarding in worker pod netns - #979
Open
SURAJ KUMAR (krsnaSuraj) wants to merge 1 commit into
Open
ateomnet: enable IPv6 forwarding in worker pod netns#979SURAJ KUMAR (krsnaSuraj) wants to merge 1 commit into
SURAJ KUMAR (krsnaSuraj) wants to merge 1 commit into
Conversation
EnableIPv4Forwarding now also writes /proc/sys/net/ipv6/conf/all/forwarding so actor IPv6 traffic (including DNS queries) is routed between the actor veth and pod eth0 instead of being dropped by ip6_forward() on dual-stack / IPv6-only clusters. Factor the sysctl write into writeSysctlIfUnset preserving the original read-only remount/restore behavior, and add unit coverage for its fast paths. Fixes: agent-substrate#945
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.
ateomnet: enable IPv6 forwarding in the worker pod netns
Fixes: #945
Problem
EnableIPv4Forwardingonly wrote/proc/sys/net/ipv4/ip_forward. It had noIPv6 counterpart, so
net.ipv6.conf.all.forwardingstayed at 0 in the workerpod network namespace. On dual-stack / IPv6-only clusters, every IPv6 packet
an actor sends — including its own DNS queries — is dropped by the kernel's
ip6_forward(), because the packet enters on the actor veth and must beforwarded out through
eth0.Reproduced as
TestActorEgressreturning 504 on IPv6-only clusters (4/4 runs).Fix
EnableIPv4Forwardingnow also writes/proc/sys/net/ipv6/conf/all/forwarding.conf.all.forwarding=1sets theforwarding state for all existing interfaces (and is the default for new
ones), so a single write covers both the veth and
eth0.The write is factored into a
writeSysctlIfUnsethelper that preserves theoriginal behavior:
1, return early (no remount, no write);/proc/sys(the worker holdsCAP_SYS_ADMIN and uses no user namespace), write
1\n, and restorero.Test
internal/ateomnet/write_sysctl_test.gocovers the helper's fast paths(already-set is untouched, unset/zero is written) with a temp file, no root
required. The privileged remount path is exercised by the existing netns
integration tests (
withTestNetNS).Compatibility
sysctl is a no-op where IPv6 is disabled or the file is absent — the helper
returns nil on missing path).
InstallActorNftablesRulesIPv4-only TODO remains accurate — this PR onlyrestores the kernel forwarding path so IPv6 packets reach the pod's eth0.
Verification
gofmt -lclean.go build ./internal/ateomnet/passes.go test ./internal/ateomnet/ -run TestWriteSysctlIfUnsetpasses.go test ./internal/ateomnet/passes.