mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2026-10-13 21:34:25 +00:00
[PR #169] device: rebase transport padding after TUN read #181
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#181
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-go/pull/169
Author: @coremraz
Created: 8/1/2026
Status: 🔄 Open
Base:
master← Head:fix/s4-startup-race📝 Commits (1)
60b7f38device: rebase transport padding after TUN read📊 Changes
3 files changed (+164 additions, -4 deletions)
View changed files
➕
device/s4_startup_race_test.go(+135 -0)📝
device/send.go(+22 -3)📝
device/uapi.go(+7 -1)📄 Description
Fixes #168.
Problem
RoutineReadFromTUNcaptured the transport padding (S4) before a blockingTUN read. If a UAPI update changed S4 while that read was blocked, the
outbound element retained the old offset while the receiving device classified
the datagram using the new offset. The first transport packet could then be
discarded as an unknown type after a successful handshake.
Change
Readreturns. If it changed, move the TUN payload to thecurrent offset before IP classification and rebuild the outbound packet
slice, preserving the in-place AEAD
Seallayout.device state.
first TUN read is blocked, plus padding boundary and rejection-atomicity
coverage.
Validation
All commands ran in
golang:1.25.12on Linux withCAP_NET_ADMINand/dev/net/tun:cf9d2ddwithout this change.-race.go test ./device -run '^TestAWGDevicePing$' -count=10 -race=falsepasses.go test ./device -run '^TestAWGDevicePing$' -count=10 -racepasses.go build ./...passes.go vet ./...still reports a pre-existing copylocks warning indevice/pools_test.go:67, outside this change.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.