[PR #3158] fix(windows): normalize full-tunnel interface state #3107

Open
opened 2026-10-15 04:07:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/3158
Author: @HeisLuka
Created: 9/12/2026
Status: 🔄 Open

Base: dev ← Head: fix/issue-3143-full-tunnel-interface-state


📝 Commits (1)

  • bbbae61 fix(windows): normalize full-tunnel interface state

📊 Changes

2 files changed (+164 additions, -23 deletions)

View changed files

📝 client/platforms/windows/daemon/wireguardutilswindows.cpp (+151 -23)
📝 client/platforms/windows/daemon/wireguardutilswindows.h (+13 -0)

📄 Description

Summary

Fix Windows full-tunnel routing when the VPN interface is created with Table = off and the peer is configured later through UAPI.

On affected systems the tunnel can successfully handshake and show as connected, while Windows still prefers the physical interface for Internet traffic.

Fixes #3143.

Root cause

Amnezia starts the WireGuard/AmneziaWG tunnel without the [Peer] section and adds the peer later through UAPI.

Because of that, the Windows backend does not see the default AllowedIPs (0.0.0.0/0 / ::/0) during initial interface configuration and therefore does not apply the normal full-tunnel interface settings.

The manually created default route has route metric 0, but Windows route selection also includes the interface metric.

Additionally, if DisableDefaultRoutes (IgnoreDefaultRoutes) is enabled on the VPN interface, the default route cannot be used as expected.

Changes

When adding a default route on Windows:

  • save the current IP interface routing state separately for IPv4 and IPv6;
  • disable automatic metric;
  • set the VPN interface metric to 0;
  • set DisableDefaultRoutes to FALSE;
  • create the default route;
  • enable default-route capture only after the route was successfully installed.

When the default route is removed, restore the original interface state.

This is important for server switching / full-tunnel → split-tunnel transitions, so full-tunnel settings do not leak into later configurations.

The existing behavior for disabled IPv6 is preserved.

Scope

This change only addresses the Windows full-tunnel interface state/routing issue from #3143.

It does not include the LAN route-capture changes from #2830 or the site split-tunneling changes from #3030.

Validation

The issue reporter's A/B testing showed that both conditions were required for Windows to select the VPN route:

  1. IgnoreDefaultRoutes disabled;
  2. VPN interface metric lowered.

With both applied, Find-NetRoute selected the AmneziaVPN interface and traffic followed the VPN path.


🔄 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/3158 **Author:** [@HeisLuka](https://github.com/HeisLuka) **Created:** 9/12/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/issue-3143-full-tunnel-interface-state` --- ### 📝 Commits (1) - [`bbbae61`](https://github.com/amnezia-vpn/amnezia-client/commit/bbbae61fdddfc6bc9d47d0b44e77fcc662a6cf1c) fix(windows): normalize full-tunnel interface state ### 📊 Changes **2 files changed** (+164 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `client/platforms/windows/daemon/wireguardutilswindows.cpp` (+151 -23) 📝 `client/platforms/windows/daemon/wireguardutilswindows.h` (+13 -0) </details> ### 📄 Description ## Summary Fix Windows full-tunnel routing when the VPN interface is created with `Table = off` and the peer is configured later through UAPI. On affected systems the tunnel can successfully handshake and show as connected, while Windows still prefers the physical interface for Internet traffic. Fixes #3143. ## Root cause Amnezia starts the WireGuard/AmneziaWG tunnel without the `[Peer]` section and adds the peer later through UAPI. Because of that, the Windows backend does not see the default `AllowedIPs` (`0.0.0.0/0` / `::/0`) during initial interface configuration and therefore does not apply the normal full-tunnel interface settings. The manually created default route has route metric `0`, but Windows route selection also includes the interface metric. Additionally, if `DisableDefaultRoutes` (`IgnoreDefaultRoutes`) is enabled on the VPN interface, the default route cannot be used as expected. ## Changes When adding a default route on Windows: - save the current IP interface routing state separately for IPv4 and IPv6; - disable automatic metric; - set the VPN interface metric to `0`; - set `DisableDefaultRoutes` to `FALSE`; - create the default route; - enable default-route capture only after the route was successfully installed. When the default route is removed, restore the original interface state. This is important for server switching / full-tunnel → split-tunnel transitions, so full-tunnel settings do not leak into later configurations. The existing behavior for disabled IPv6 is preserved. ## Scope This change only addresses the Windows full-tunnel interface state/routing issue from #3143. It does not include the LAN route-capture changes from #2830 or the site split-tunneling changes from #3030. ## Validation The issue reporter's A/B testing showed that both conditions were required for Windows to select the VPN route: 1. `IgnoreDefaultRoutes` disabled; 2. VPN interface metric lowered. With both applied, `Find-NetRoute` selected the AmneziaVPN interface and traffic followed the VPN path. --- <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#3107
No description provided.