[Bug Report] GL-MT3000 (Firmware 4.11.2-op25) strips AmneziaWG 3.1 parameters (HeaderProtectionKey, RandomTrailers, etc.) in wgclient scripts

Hi everybody,

Firmware 4.11.2-op25 on the GL-MT3000 (Beryl AX) already ships with full AmneziaWG 3.1 kernel and userspace support (amneziawg.ko + amneziawg-tools v3.1.20260812), which is cool!

However, connecting to an AmneziaWG 3.1 server that uses 3.1-specific options (such as HeaderProtectionKey and RandomTrailers = on) currently fails with a 30-second handshake timeout (vpn-failover-watcher: reason=startup-connecting-timeout elapsed=30).

Environment

  • Device: GL.iNet GL-MT3000 (Beryl AX / glinet,mt3000-snand)
  • Firmware: 4.11.2-op25 (Kernel 6.12.112, aarch64)
  • Packages:
    • amneziawg-tools (v3.1.20260812)
    • kmod-amneziawg (3.1.20260812)
    • gl-sdk4-wg-client (26.297.23830~aa59d82-r1)

Root Cause

Both /usr/bin/wgclient_set_append (used when importing a .conf file) and /lib/netifd/proto/wgclient.sh (used when bringing up the wgclient* interface) still filter [Interface] parameters using an outdated AmneziaWG 2.0 regex whitelist:

  1. /usr/bin/wgclient_set_append (line 28):
echo "$(grep -iE '^(jc|jmax|jmin|s1|s2|s3|s4|h1|h2|h3|h4|i1|i2|i3|i4|i5)\b' ${origin_append_file} 2>/dev/null)" >> "${APPEND_CONF_DIR}/${group_id}/${peer_name}"
  1. /lib/netifd/proto/wgclient.sh (lines 243–253):
if [ -f "${APPEND_CONF_DIR}/${group_id}/${config}" ]; then
    echo "$(grep -iE '^(jc|jmax|jmin|s1|s2|s3|s4|h1|h2|h3|h4|i1|i2|i3|i4|i5)\b' "${APPEND_CONF_DIR}/${group_id}/${config}" 2>/dev/null)" >> "${wg_cfg}"
else
    # Read AmneziaWG parameters from UCI config
    for param in jc jmax jmin s1 s2 s3 s4 h1 h2 h3 h4 i1 i2 i3 i4 i5; do
...

Because of this whitelist, all new AmneziaWG 3.1 [Interface] parameters supported by /usr/bin/awg are silently dropped during import and interface setup:

  • HeaderProtectionKey
  • ContentPaddingAddition
  • RandomTrailers
  • DisableCookies
  • RekeyAfterTime
  • RekeyTimeout
  • RejectAfterTime
  • KeepaliveTimeout
  • MaxHandshakeAttempts

Since HeaderProtectionKey and RandomTrailers are missing on the client side, the server drops the handshake packets and the connection times out after 30 seconds.

Suggested Fix

Update the parameter whitelist in both /usr/bin/wgclient_set_append and /lib/netifd/proto/wgclient.sh to include all AmneziaWG 3.1 [Interface] parameters supported by amneziawg-tools v3.1:

^(jc|jmax|jmin|s1|s2|s3|s4|h1|h2|h3|h4|i1|i2|i3|i4|i5|headerprotectionkey|contentpaddingaddition|randomtrailers|disablecookies|rekeyaftertime|rekeytimeout|rejectaftertime|keepalivetimeout|maxhandshakeattempts)\b

(Please also double-check if the Web UI / RPC config importer in wg-client.so needs to pass through these keys before invoking wgclient_set_append.)

Verification

After patching those two scripts and adding HeaderProtectionKey + RandomTrailers = on to /etc/wireguard/profile/<group_id>/<peer>, awg setconf applies them cleanly, awg show wgclient2 reports both options as active, and the AmneziaWG 3.1 tunnel connects in < 1 second with 0% packet loss. Existing AmneziaWG 2.0 profiles remain 100% backwards-compatible.

Thanks for looking into this!

Hi,

Thank you for the detailed report and for sharing your findings. AmneziaWG 3.1 support has not yet been fully integrated into firmware v4.11.x-op25.

We'll ask our development team to review this and consider completing the integration in a future release. Please keep an eye on the firmware release notes for updates.