mirror of
https://github.com/amnezia-vpn/amneziawg-linux-kernel-module.git
synced 2026-10-13 21:34:34 +00:00
[PR #165] fix: detect AWG 1.0 vs 2.0 peers for header generation #214
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#214
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?
📋 Pull Request Information
Original PR: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/pull/165
Author: @otternetwork
Created: 4/5/2026
Status: 🔄 Open
Base:
master← Head:fix/detect-awg1-vs-awg2-peers📝 Commits (2)
27c4269fix: restore per-peer legacy WireGuard client support7eb04a3fix: detect AWG 1.0 vs 2.0 peers for header generation📊 Changes
9 files changed (+155 additions, -46 deletions)
View changed files
📝
src/magic_header.h(+9 -0)📝
src/netlink.c(+24 -2)📝
src/netlink.h(+2 -1)📝
src/noise.c(+6 -1)📝
src/peer.c(+4 -0)📝
src/peer.h(+1 -0)📝
src/receive.c(+27 -6)📝
src/send.c(+78 -36)📝
src/uapi/wireguard.h(+4 -0)📄 Description
Summary
When an AWG 2.0 server has ranged H1-H4 values, it generates random headers from those ranges for all AWG peers via
mh_genheader(). This breaks AWG 1.0 clients that expect exact fixed values (the range starts).This PR adds per-peer detection of fixed vs ranged header support:
ranged_headersfield tostruct wg_peermh_peerheader()helper: returns range start for fixed (AWG 1.0) peers, random value for ranged (AWG 2.0) peersnoise.cduring handshake consumption: if the peer's init header differs from the range start, it must support ranged headersranged_headersfor netlink-configured peers based on whether the device's header ranges are actual rangesDetection heuristic and its limitations
The detection works by comparing the incoming H1 value against the configured range start:
This heuristic is conservative and safe in the "wrong" direction:
UAPI extension
Expose the new flag to userspace via
WGPEER_A_RANGED_HEADERSnetlink attribute (backward compatible — old userspace ignores unknown attributes). This allows userspace apps to distinguish three peer states:advanced_securityranged_headersDepends on #164 — must be merged first.
Test plan
WGPEER_A_RANGED_HEADERSattribute for connected peersCloses #163
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.