mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2026-10-13 21:34:25 +00:00
[PR #148] [CLOSED] conn: don't reset the listen port to 0 when IPv6 is unavailable #166
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#166
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/148
Author: @wizier
Created: 6/17/2026
Status: ❌ Closed
Base:
master← Head:fix/bind-listen-port-ipv6-disabled📝 Commits (1)
f24f9feconn: don't reset the listen port to 0 when IPv6 is unavailable📊 Changes
1 file changed (+5 additions, -1 deletions)
View changed files
📝
conn/bind_std.go(+5 -1)📄 Description
Problem
StdNetBind.Openbinds the udp4 and udp6 sockets into the sameportvariable:On a host with IPv6 disabled in the kernel (
ipv6.disable=1on the kernel command line, or theipv6module blacklisted), the udp6ListenPacketreturnsEAFNOSUPPORT. That error is intentionally tolerated, but the assignment has already overwritten the port udp4 successfully bound with0.Openthen returnsactualPort == 0even though the v4 socket is bound and serving traffic.Because the UAPI
gethandler only emitslisten_portwhen it is non-zero, the line disappears entirely, so anything that reads the port back (wgctrl,awg show, a control plane reconciling expected vs. live config) sees0.Fix
Give the udp6 listener its own
portvariable and adopt it only when v6 actually bound. A udp6EAFNOSUPPORTno longer clobbers the live udp4 port.Note
This code is inherited verbatim from upstream wireguard-go (
conn/bind_std.go), so the same bug exists there.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.