fix: ICMP forwarding on Android: add disable-icmp-forwarding and icmp-timeout options in tun options - #835
Open
sudoup wants to merge 3 commits into
Open
fix: ICMP forwarding on Android: add disable-icmp-forwarding and icmp-timeout options in tun options#835sudoup wants to merge 3 commits into
sudoup wants to merge 3 commits into
Conversation
added 3 commits
September 16, 2026 22:01
Add a "Disable ICMP Forwarding" VpnService option and pass it through to the core tun configuration. When enabled (default), ICMP echo requests are answered locally instead of being forwarded directly, avoiding ICMP leaks and the 'receive ICMP echo reply: i/o timeout' error.
Add an ICMP Timeout VpnService option and pass it through to the core tun configuration, so a custom icmp-timeout is no longer ignored. The default value 0 keeps the core default (10s).
Negative input produced a negative ICMPTimeout, which sets a past read deadline and breaks ICMP forwarding with an immediate 'i/o timeout'. Coerce the parsed value to at least zero and trim whitespace, and label the option with the seconds unit.
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 was broken
On Android, if you set
disable-icmp-forwarding: truein your config, it was silently ignored. ICMP (ping) was still forwarded directly (DIRECT), which caused the log errorreceive ICMP echo reply: i/o timeoutand leaked ICMP outside the tunnel.Why it happened
On Android the tunnel interface is created by the app itself (via
VpnService), not by the core. The app builds the core's tun options by hand, and it never passed the ICMP settings along. So the core never knew about the flag. The core itself was fine — it fully supports the option; the app just didn't tell it.How we fixed it
We added two app settings and passed them all the way through to the core:
0keeps the core default (10s).Path of the setting: settings screen → app storage → VPN service → native bridge (JNI) → Go code → core TUN options.
Now, when the toggle is on, the core answers ping itself (logs show
using fake ping echoinstead ofusing DIRECT).We also fixed a small edge case: entering a negative timeout could break ping (a deadline in the past → instant
i/o timeout), so negative values are now clamped to0.Result
Tested: the build passes, and with "Disable ICMP Forwarding" enabled, ping returns 0 and ICMP is blocked — exactly as intended. No more leaks and no more
i/o timeouterrors.