Skip to content

wg-quick: android: prefer kernel module over userspace for AWG configs - #64

Open
erophey7 wants to merge 1 commit into
amnezia-vpn:masterfrom
erophey7:fix/android-kernel-first
Open

wg-quick: android: prefer kernel module over userspace for AWG configs#64
erophey7 wants to merge 1 commit into
amnezia-vpn:masterfrom
erophey7:fix/android-kernel-first

Conversation

@erophey7

@erophey7 erophey7 commented Aug 8, 2026

Copy link
Copy Markdown

What

Make wg-quick's Android integration prefer the amneziawg kernel module over the userspace amneziawg-go binary for configurations that use AWG obfuscation parameters.

Why

add_if() previously routed any config containing AmneziaWG parameters (Jc, Jmin, Jmax, S1-S4, H1-H4, I1-I5) to the userspace amneziawg-go binary, even when the kernel module is present. Since amneziawg-go is not shipped with the Android app, kernel-mode tunnels with AWG obfuscation failed with amneziawg-go: inaccessible or not found (exit 127).

The kernel module supports all these parameters via awg setconf, so the selection is now kernel-first:

  • use ip link add ... type amneziawg whenever /sys/module/amneziawg is available;
  • keep amneziawg-go only as a fallback for devices without the kernel module.

Drops the now-unused is_awg_on flag and the parser branches that only existed to set it.

Testing performed

  • Built wg-quick for Android target.
  • Pushed to device (Xiaomi 11 Lite 5 NE, kernel 5.4.302 QGKI with amneziawg kernel module 3.0.20260805), kernel-mode tunnel with obfuscation (Jc/Jmin) connects successfully and gets a handshake.
  • wg-quick up / wg-quick down cycle verified in both kernel-module and userspace-fallback modes.

Files changed

  • src/wg-quick/android.c (+10, −40)

add_if() previously routed any config containing AmneziaWG parameters
(Jc, Jmin, Jmax, S1-S4, H1-H4, I1-I5) to the userspace amneziawg-go
binary, even when the amneziawg kernel module is present. Since the
kernel module supports all these parameters via awg setconf, and
amneziawg-go is not shipped with the Android app, kernel-mode tunnels
with AWG obfuscation failed with 'amneziawg-go: inaccessible or not
found' (exit 127).

Switch the selection to kernel-first: use ip link add ... type
amneziawg whenever /sys/module/amneziawg is available, and keep
amneziawg-go only as a fallback for devices without the kernel module.

Drop the now-unused is_awg_on flag and the parser branches that only
existed to set it.
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