[PR #3364] fix(daemon): bracket IPv6 server endpoint in UAPI config #3264

Open
opened 2026-11-07 17:58:48 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/3364
Author: @svartoS
Created: 10/31/2026
Status: 🔄 Open

Base: dev ← Head: fix/ipv6-endpoint


📝 Commits (3)

  • f2f3a4d fix(daemon): bracket IPv6 server endpoint before wireguard-go IPC
  • 1f58418 fix(macos): bracket IPv6 server endpoint
  • b8e8f1f fix(windows): bracket IPv6 server endpoint

📊 Changes

3 files changed (+18 additions, -3 deletions)

View changed files

📝 client/platforms/linux/daemon/wireguardutilslinux.cpp (+6 -1)
📝 client/platforms/macos/daemon/wireguardutilsmacos.cpp (+6 -1)
📝 client/platforms/windows/daemon/wireguardutilswindows.cpp (+6 -1)

📄 Description

Fixes #2607

Problem

When a WireGuard/AmneziaWG config uses an IPv6 endpoint (e.g. Endpoint = [2001:db8::2]:51820), the daemon fails to bring the tunnel up: the UAPI set returns -22 (EINVAL) and the connection drops right after connecting.

In updatePeer() the server address ends up in m_serverIpv4AddrIn even when it is an IPv6 literal, so it is written to the IPC stream without brackets:

endpoint=2001:db8::2:51820

The userspace WireGuard implementation cannot parse that as host:port.

Fix

If the address in m_serverIpv4AddrIn contains : and is not already bracketed, wrap it in [...] before appending the port. IPv4 addresses and hostnames are unchanged. The existing m_serverIpv6AddrIn branch already brackets correctly and is left as is.

The same pattern exists in all three desktop daemons, so the fix is applied to:

  • client/platforms/linux/daemon/wireguardutilslinux.cpp
  • client/platforms/macos/daemon/wireguardutilsmacos.cpp
  • client/platforms/windows/daemon/wireguardutilswindows.cpp

Testing

The bug was reproduced on Linux Mint 22.3 with AmneziaVPN 5.0.3.0 (IPv6 endpoint fails with IPC error -22; the same server over IPv4 works). I have not built the client with this patch yet. The macOS and Windows changes are the same code change and have not been tested on those platforms.


🔄 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/amnezia-client/pull/3364 **Author:** [@svartoS](https://github.com/svartoS) **Created:** 10/31/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/ipv6-endpoint` --- ### 📝 Commits (3) - [`f2f3a4d`](https://github.com/amnezia-vpn/amnezia-client/commit/f2f3a4db909488f50035cdaa87c97ea99d4a963f) fix(daemon): bracket IPv6 server endpoint before wireguard-go IPC - [`1f58418`](https://github.com/amnezia-vpn/amnezia-client/commit/1f58418e5fd0b024eb0a91ba7bd713c2d17b3dca) fix(macos): bracket IPv6 server endpoint - [`b8e8f1f`](https://github.com/amnezia-vpn/amnezia-client/commit/b8e8f1fa0eca8055cebd5a2bd9cb21ea92697072) fix(windows): bracket IPv6 server endpoint ### 📊 Changes **3 files changed** (+18 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `client/platforms/linux/daemon/wireguardutilslinux.cpp` (+6 -1) 📝 `client/platforms/macos/daemon/wireguardutilsmacos.cpp` (+6 -1) 📝 `client/platforms/windows/daemon/wireguardutilswindows.cpp` (+6 -1) </details> ### 📄 Description Fixes #2607 ## Problem When a WireGuard/AmneziaWG config uses an IPv6 endpoint (e.g. `Endpoint = [2001:db8::2]:51820`), the daemon fails to bring the tunnel up: the UAPI `set` returns `-22` (EINVAL) and the connection drops right after connecting. In `updatePeer()` the server address ends up in `m_serverIpv4AddrIn` even when it is an IPv6 literal, so it is written to the IPC stream without brackets: ``` endpoint=2001:db8::2:51820 ``` The userspace WireGuard implementation cannot parse that as `host:port`. ## Fix If the address in `m_serverIpv4AddrIn` contains `:` and is not already bracketed, wrap it in `[...]` before appending the port. IPv4 addresses and hostnames are unchanged. The existing `m_serverIpv6AddrIn` branch already brackets correctly and is left as is. The same pattern exists in all three desktop daemons, so the fix is applied to: - `client/platforms/linux/daemon/wireguardutilslinux.cpp` - `client/platforms/macos/daemon/wireguardutilsmacos.cpp` - `client/platforms/windows/daemon/wireguardutilswindows.cpp` ## Testing The bug was reproduced on Linux Mint 22.3 with AmneziaVPN 5.0.3.0 (IPv6 endpoint fails with IPC error -22; the same server over IPv4 works). I have not built the client with this patch yet. The macOS and Windows changes are the same code change and have not been tested on those platforms. --- <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/amnezia-client#3264
No description provided.