[PR #153] conn: fall back to per-packet send/recv when sendmmsg/recvmmsg are ENOSYS #171

Open
opened 2026-10-13 21:04:14 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amneziawg-go/pull/153
Author: @william-aqn
Created: 7/12/2026
Status: 🔄 Open

Base: master ← Head: sendmmsg-enosys-fallback


📝 Commits (1)

  • ccb824d conn: fall back to per-packet send/recv when sendmmsg/recvmmsg are ENOSYS

📊 Changes

1 file changed (+42 additions, -18 deletions)

View changed files

📝 conn/bind_std.go (+42 -18)

📄 Description

wireguard-go/amneziawg-go's StdNetBind uses ipv{4,6}.PacketConn WriteBatch/ ReadBatch (sendmmsg/recvmmsg) on Linux for batched UDP I/O. Those syscalls were added in Linux 3.0; on older kernels still shipped by some routers (e.g. Broadcom BCM470x / RT-AC68U on 2.6.36) they return ENOSYS, so the tunnel could form handshakes but not send or receive a single packet — it came up and never handshaked, on any config.

Detect ENOSYS from the first WriteBatch/ReadBatch, set a sticky per-bind flag, and fall back to the per-packet WriteMsgUDP/ReadMsgUDP path the non-Linux branch already uses. No effect on kernels >= 3.0 (the flag never trips). Builds on linux/windows/darwin; conn tests pass.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amneziawg-go/pull/153 **Author:** [@william-aqn](https://github.com/william-aqn) **Created:** 7/12/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `sendmmsg-enosys-fallback` --- ### 📝 Commits (1) - [`ccb824d`](https://github.com/amnezia-vpn/amneziawg-go/commit/ccb824dac18d2c178865e5bd97647a53e5fc3446) conn: fall back to per-packet send/recv when sendmmsg/recvmmsg are ENOSYS ### 📊 Changes **1 file changed** (+42 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `conn/bind_std.go` (+42 -18) </details> ### 📄 Description wireguard-go/amneziawg-go's StdNetBind uses ipv{4,6}.PacketConn WriteBatch/ ReadBatch (sendmmsg/recvmmsg) on Linux for batched UDP I/O. Those syscalls were added in Linux 3.0; on older kernels still shipped by some routers (e.g. Broadcom BCM470x / RT-AC68U on 2.6.36) they return ENOSYS, so the tunnel could form handshakes but not send or receive a single packet — it came up and never handshaked, on any config. Detect ENOSYS from the first WriteBatch/ReadBatch, set a sticky per-bind flag, and fall back to the per-packet WriteMsgUDP/ReadMsgUDP path the non-Linux branch already uses. No effect on kernels >= 3.0 (the flag never trips). Builds on linux/windows/darwin; conn tests pass. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-go#171
No description provided.