wireguard-go-awg2-lx/device
Leadaxe 1e787bb3e0 lx: gate reserved-byte clear on receive so AmneziaWG magic survives
The Cloudflare "reserved" bytes (1-3) were zeroed unconditionally on
every received datagram across all StdNetBind/WinRingBind receive paths.
AmneziaWG reads its magic header as LittleEndian.Uint32(packet[padding:])
where padding is s1/s2/s4; with small padding (0-3) the magic overlaps
bytes 1-3, so clearing them collapses it out of the ranged h1-h4 window
and every packet is dropped (handshake included) — the AWG endpoint
never comes up. Plain WG (types 1-4, bytes 1-3 already zero) and large
padding are unaffected, which is why it went unnoticed.

Gate all five receive clears (bind_std receiveIP, msgx_darwin
receiveSingle + makeReceiveMsgX, bind_windows receiveIPv4/v6) behind a
new hasReserved() so bytes 1-3 are only touched when a WARP reserved
value is actually configured. Send paths already gate on a per-endpoint
loaded/non-zero check, so they are left unchanged. The reserved map is
populated before the receive goroutines start and never mutated after,
so the lock-free read is safe.

Tests: awg_stdnetbind_reserved_lx_test.go brings up two Devices over
StdNetBind with zero padding (magic in bytes 0-3) and asserts delivery
(red before the fix, green after); reserved_gate_lx_test.go pins the
hasReserved() gate.
2026-08-05 16:55:02 +03:00
..
allowedips.go device: refactor container locking for lock-order clarity 2026-08-04 19:18:01 +08:00
awg_stdnetbind_reserved_lx_test.go lx: gate reserved-byte clear on receive so AmneziaWG magic survives 2026-08-05 16:55:02 +03:00
channels.go device: convert runtime.SetFinalizer to AddCleanup (#71) 2026-08-04 19:18:01 +08:00
constants.go Apply Tailscale bind send headroom 2026-05-17 20:36:35 +08:00
cookie.go lx: re-graft AmneziaWG 2.0 obfuscation onto sagernet/wireguard-go v0.0.5 2026-08-05 16:53:12 +03:00
device.go lx: re-graft AmneziaWG 2.0 obfuscation onto sagernet/wireguard-go v0.0.5 2026-08-05 16:53:12 +03:00
devicestate_string.go device: remove deviceStateNew 2021-02-09 15:39:19 +01:00
indextable.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
ip.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
keypair.go Rename module 2026-05-17 20:09:28 +08:00
logger.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
magic-header.go lx: fix transport padding buffer overrun + harden AWG config guards 2026-08-05 16:55:02 +03:00
mobilequirks.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
noise-helpers.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
noise-protocol.go lx: re-graft AmneziaWG 2.0 obfuscation onto sagernet/wireguard-go v0.0.5 2026-08-05 16:53:12 +03:00
noise-types.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
obf.go lx: fix transport padding buffer overrun + harden AWG config guards 2026-08-05 16:55:02 +03:00
obf_bytes.go lx: re-graft AmneziaWG 2.0 obfuscation onto sagernet/wireguard-go v0.0.5 2026-08-05 16:53:12 +03:00
obf_data.go lx: re-graft AmneziaWG 2.0 obfuscation onto sagernet/wireguard-go v0.0.5 2026-08-05 16:53:12 +03:00
obf_datasize.go lx: fix transport padding buffer overrun + harden AWG config guards 2026-08-05 16:55:02 +03:00
obf_datastring.go lx: re-graft AmneziaWG 2.0 obfuscation onto sagernet/wireguard-go v0.0.5 2026-08-05 16:53:12 +03:00
obf_guards_test.go lx: gate reserved-byte clear on receive so AmneziaWG magic survives 2026-08-05 16:55:02 +03:00
obf_rand.go lx: fix transport padding buffer overrun + harden AWG config guards 2026-08-05 16:55:02 +03:00
obf_randchars.go lx: fix transport padding buffer overrun + harden AWG config guards 2026-08-05 16:55:02 +03:00
obf_randdigits.go lx: fix transport padding buffer overrun + harden AWG config guards 2026-08-05 16:55:02 +03:00
obf_timestamp.go lx: re-graft AmneziaWG 2.0 obfuscation onto sagernet/wireguard-go v0.0.5 2026-08-05 16:53:12 +03:00
peer.go device: fix TOCTOU race during session state update (#77) 2026-08-04 19:18:01 +08:00
pools.go device: refactor container locking for lock-order clarity 2026-08-04 19:18:01 +08:00
queueconstants_android.go Rename module 2026-05-17 20:09:28 +08:00
queueconstants_default.go Rename module 2026-05-17 20:09:28 +08:00
queueconstants_ios.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
queueconstants_windows.go global: bump copyright notice 2025-05-05 15:05:35 +02:00
receive.go lx: re-graft AmneziaWG 2.0 obfuscation onto sagernet/wireguard-go v0.0.5 2026-08-05 16:53:12 +03:00
send.go lx: fix transport padding buffer overrun + harden AWG config guards 2026-08-05 16:55:02 +03:00
sticky_default.go Rename module 2026-05-17 20:09:28 +08:00
sticky_linux.go Rename module 2026-05-17 20:09:28 +08:00
timers.go device: fix TOCTOU race during session state update (#77) 2026-08-04 19:18:01 +08:00
transport_padding_test.go lx: gate reserved-byte clear on receive so AmneziaWG magic survives 2026-08-05 16:55:02 +03:00
tun.go Rename module 2026-05-17 20:09:28 +08:00
uapi.go lx: re-graft AmneziaWG 2.0 obfuscation onto sagernet/wireguard-go v0.0.5 2026-08-05 16:53:12 +03:00