mirror of
https://github.com/amnezia-vpn/amneziawg-linux-kernel-module.git
synced 2026-10-13 21:34:34 +00:00
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amnezia-vpn/amneziawg-linux-kernel-module#99
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @otternetwork on GitHub (Apr 5, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/162
Commit
e939553f72("feat: implement H1-H4 ranged headers", part of PR #88 / AWG 2.0) removed the per-peer advanced_security conditional logic that was introduced in commit8eb278b208("Support for legacy clients", PR #16). As a result, an AmneziaWG server with custom obfuscation parameters (H1-H4, S1-S2) can no longer communicate with standard WireGuard clients on the same interface.PR #16 (Sep 2024) added the ability for AmneziaWG to operate in a mixed mode: standard WireGuard peers received standard message headers (MESSAGE_HANDSHAKE_INITIATION=1, MESSAGE_HANDSHAKE_RESPONSE=2, etc.), while AmneziaWG peers received obfuscated headers. This was implemented via:
peer->advanced_security booleanon each peersend.c:peer->advanced_security ? custom_header : standard_headernoise.c: settingpeer->advanced_securitybased on whether the incoming handshake used a custom magic headerWhat broke
The ranged headers refactoring replaced all conditional per-peer logic with unconditional
mh_genheader()calls:src/send.c— handshake initiation (before):After:
The same removal happened for:
wg_packet_send_handshake_response)wg_packet_send_handshake_cookie) — removed the logic that sent standard cookies in response to standard handshake packetswg_packet_encrypt_worker)wg->...advanced_security && peer->advanced_security, now only checks device-level flagAdditionally,
wg_packet_encrypt_workerappears to have a merge artifact/syntax error with a leftover ternary fragment:Dead code
peer->advanced_securitystill exists inpeer.h, is still set innoise.c(viamh_validate), and is still read/written via netlink WGPEER_A_ADVANCED_SECURITY / WGPEER_F_HAS_ADVANCED_SECURITY). However, no code insend.correceive.cconsults it anymore. The entire per-peer flag infrastructure is dead code.Impact
When custom AmneziaWG parameters are configured (H1-H4 ≠ default, S1/S2 > 0):
prepare_awg_message()function couples size matching with junk sizes. Standard WireGuard packets (no junk prefix) fail size checks and are dropped as "Unknown message."Suggested fix
Restore per-peer
advanced_securitychecks in the send and receive paths, adapted for the newmh_genheader/mh_validateAPI. Whenpeer->advanced_securityis false, send standard WireGuard message types and skip junk packet prepending.The receive path should continue accepting both standard and custom headers (as
8eb278bintended).