Skip to content

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
MetaCubeX:mainfrom
sudoup:main
Open

sudoup wants to merge 3 commits into
MetaCubeX:mainfrom
sudoup:main

Conversation

@sudoup

@sudoup sudoup commented Sep 16, 2026

Copy link
Copy Markdown

What was broken

On Android, if you set disable-icmp-forwarding: true in your config, it was silently ignored. ICMP (ping) was still forwarded directly (DIRECT), which caused the log error receive ICMP echo reply: i/o timeout and 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:

  • Disable ICMP Forwarding (enabled by default) — answer ping locally instead of forwarding it.
  • ICMP Timeout (seconds) — the timeout for that handling; 0 keeps 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 echo instead of using 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 to 0.

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 timeout errors.

sudoup 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.
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.

1 participant