mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2026-10-14 05:41:54 +00:00
[GH-ISSUE #201] device: header_protection_key makes the whole config unusable unless all four paddings are >= 12 (error also names a non-existent S0) #95
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-go#95
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 @Capricornus007 on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-go/issues/201
Affected upstream source
https://github.com/amnezia-vpn/amneziawg-gomaster@b5928efv3.1.20260828device/uapi.go:852-858Summary
When a
header_protection_keyis supplied, the UAPI setter requires all four paddings(
s1..s4) to be at leastHeaderCipherNonceSize(12). Any padding left at its UAPI default of0aborts the entiredev_settransaction, so the device/peer is never configured at all.Two separate problems in those 7 lines:
some of
s1..s4— which the UAPI itself permits, since each key is optional and defaults to0— cannot enable header protection at all. The caller getsIPC error -22and the wholeconfig is rejected, not just the header-protection part.
iis0-based while the UAPI keys are
s1..s4, so a failure ons1reportsS0, and a failure ons3reportsS2— pointing the reader at the wrong parameter.Reproduction
Applied to a device via the normal UAPI set path (
ipcSetDevice):(
s3/s4intentionally omitted, i.e. left at the UAPI default0.)Actual: the set fails with
S2 must be more then 12 to use headerProtection(the value thatactually tripped the check is
s3, andS0is reported whens1alone is short). The device endsup unconfigured.
Expected: either the config is accepted and header protection is derived from the paddings that
are set, or the error names the exact offending key (
s3) and documents that all four paddingsmust be configured together.
Why this matters
Real-world AWG provisioning data frequently carries only a subset of the
S*values (serveroperators tune one or two message classes, not all four). With this check the client cannot turn on
header protection for those profiles at all, and the failure surfaces as a generic
EINVALfromdev_set, which is very hard to attribute to the padding combination.Notes on the rework branch
The same logic exists on
experimental-session-init(948c555,device/uapi.go:833-838) after theconcealrefactor: the index is corrected toi+1, but the all-four-paddings requirement is stillunconditional, so the behaviour is unchanged.
Suggested direction
Any of these would fix the reported problem; I am not asking for a specific one and would happily
test a patch:
0as "not configured"), ors3, notS2) and document thecoupling in the UAPI key list, or
Happy to send a PR with tests if you tell me which of the three you would rather have.