Repository navigation
fix: enable WiFi forwarding and respect NAT setting - #57
Open
sembrestels wants to merge 1 commit into
Open
sembrestels wants to merge 1 commit into
sembrestels wants to merge 1 commit into
Conversation
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.
Context
The WiFi entrypoint checks whether the forwarding sysctl output is nonempty, so both
0and1are reported as enabled. It also always adds a MASQUERADE rule, even when the exposedNATsetting isfalse.This can start a hotspot without working IPv4 forwarding and prevents users from selecting routed mode.
Approach
ip_dynaddrandip_forwardexplicitly with1, enable them when necessary, and stop startup if required network configuration fails.NAT=true|false, retaining the existing default. Reject invalid values before moving the wireless device.Test instructions
Run the regression and configuration checks:
Build and test real sysctls/iptables in a disposable private network namespace. Do not use host networking for this test:
docker build -t wifi-forwarding-nat-test src docker run --rm --privileged --network none --entrypoint bash \ --mount type=bind,src="$PWD/tests/network-namespace.sh",dst=/network-test.sh,readonly \ wifi-forwarding-nat-test /network-test.shFor a physical-device smoke test, install the package on a staging Dappnode with
NAT=true. Connect a phone/laptop to its hotspot with mobile data and VPN disabled, check that it receives a WiFi-subnet address, openhttp://my.dappnode, and browse an HTTPS website. Disconnect/reconnect and repeat.A physical
NAT=falsetest additionally needs return routes to the WiFi subnet before changing the setting. Confirm forwarding remains enabled and the matching MASQUERADE rule is absent; restoreNAT=trueafterward.Validation
1, and exactly one expected NAT rule exists. The operator confirmed the hotspot and browsing/reconnection tests work.NAT=false, its HTTP request reached a host test endpoint with the original10.20.12.xsource address. The WiFi MASQUERADE rule was absent and forwarding remained enabled. Normal NAT was restored and the temporary return route and test endpoint were removed afterward.NAT=falseenvironment, and ARM64 image builds remain untested. The physical test changed the running rules without restarting the radio; the saved package environment remainedNAT=true.