[PR #3379] fix: honor WG and AWG site split tunneling #3268

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

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/3379
Author: @makkoar
Created: 11/2/2026
Status: 🔄 Open

Base: dev ← Head: fix/wg-awg-site-allowedips


📝 Commits (2)

  • 15c9164 fix: honor WG and AWG site split tunneling
  • 0f284d4 docs: restore upstream split tunneling comments

📊 Changes

4 files changed (+247 additions, -77 deletions)

View changed files

📝 client/mozilla/localsocketcontroller.cpp (+20 -53)
📝 client/tests/CMakeLists.txt (+9 -0)
➕ client/tests/testLocalSocketController.cpp (+169 -0)
📝 client/vpnConnection.cpp (+49 -24)

📄 Description

Summary

Fix WG/AWG site split tunneling when AllowedIPs are IPv4-only, reordered, duplicated or formatted differently. This is the profile-eligibility/route-serialization part extracted from #3030.

Fixes #3375.
Tracking issue: #3378.

Problem

I found two decisions that could silently defeat the selected site-routing mode:

  • VpnConnection required both IPv4 and IPv6 default routes, disabling site splitting for valid IPv4-only profiles.
  • LocalSocketController compared AllowedIPs against one exact two-element array. In sites-only mode, an IPv4-only or reordered default list could therefore bypass the site allowlist and produce a full tunnel.

The custom-route branch also marked IPv6 prefixes as IPv4.

Changes

  • Normalize AllowedIPs from JSON arrays, strings and native configuration text, independent of comma spacing.
  • Allow the currently IPv4-based site list when the profile contains 0.0.0.0/0.
  • Honor the site allowlist independently of default-route order, duplicates or IPv6 presence.
  • Preserve restricted native AllowedIPs and the original address-family coverage in all-sites/exclusion modes.
  • Use IPAddress for canonical prefix/address-family serialization and deduplicate generated ranges.
  • Add isolated LocalSocketController regression tests and register them in the Windows CMake test suite.

Application-exclusion settings are passed through unchanged. This does not implement Windows application allowlist support. The existing frontend fallback from an empty selected site list to all-sites mode is unchanged.

Verification

On Windows x64 with Qt 6.10.1 and MSVC 19.53, I compiled the actual controller and regression tests from this standalone branch on dev 3f6ecacf:

  • Before: 36 passed, 26 failed.
  • After: 62 passed, 0 failed (60 data cases plus setup/cleanup).
  • 42 route-generation cases: both protocols, all three site modes, empty/IPv4-only/ordered/reordered/duplicated defaults, restricted routes and default-plus-specific routes.
  • 18 application-passthrough cases: both protocols and all site modes, with application splitting disabled, enabled-empty or enabled-populated.

The tests capture activation JSON through an isolated local socket; they do not contact the real service or change routes. These results validate serialization, not end-to-end VPN traffic. I have not switched my live connection to sites-only mode. The subsequent combined installer build is recorded below.

git diff --check passes. Combining the three split branches reproduces the previous complete patch, apart from relocating the unchanged parsing helper so the independent branches merge cleanly.

5.1.0.6 refresh

  • Rebased onto release 5.1.0.6 (ac175c8a); git range-diff confirms that the patch commits are unchanged.
  • A clean Windows x64 configuration and combined Release client/service/installer build include #3030, #3379, #3380 and #3383, using Qt 6.10.1 and MSVC 19.53.
  • Five isolated suites passed: local-socket route serialization, domain routing with the actual bundled core, engine ownership, mocked Windows route monitoring and offscreen settings QML.
  • The domain suite had an unexplained initial CTest failure, followed by passing diagnostic and full-suite reruns; details are recorded in #3383.
  • These are combined-build results, not separate full builds of each PR. The installed VPN was not stopped or replaced. Real TUN/WG/AWG activation, WFP/kill-switch behavior, network transitions and disconnect cleanup still require on-device acceptance.
  • #3011 overlaps both IPv4-only eligibility and the sites-only controller branch. This PR provides an alternative covering reordered/duplicate defaults, prefix/family serialization and the regression matrix as well.
  • #3097 overlaps the earlier frontend eligibility check.
  • #2907 and #3314 report related macOS symptoms; their complete root causes and platform behavior are not established by these Windows-hosted tests.

I am not requesting automatic closure of another contributor's PR.

The other parts have separate reports: #3376 / #3380 (hostname/CIDR and DNS lifecycle) and #3377 / #3030 (Windows route application). All branches target dev directly; there is no required merge order.


🔄 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/3379 **Author:** [@makkoar](https://github.com/makkoar) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/wg-awg-site-allowedips` --- ### 📝 Commits (2) - [`15c9164`](https://github.com/amnezia-vpn/amnezia-client/commit/15c91644ac52788c886cf78cfb4a84ed444c60d7) fix: honor WG and AWG site split tunneling - [`0f284d4`](https://github.com/amnezia-vpn/amnezia-client/commit/0f284d44c83e6327342ed26499c7a46572b8f1d1) docs: restore upstream split tunneling comments ### 📊 Changes **4 files changed** (+247 additions, -77 deletions) <details> <summary>View changed files</summary> 📝 `client/mozilla/localsocketcontroller.cpp` (+20 -53) 📝 `client/tests/CMakeLists.txt` (+9 -0) ➕ `client/tests/testLocalSocketController.cpp` (+169 -0) 📝 `client/vpnConnection.cpp` (+49 -24) </details> ### 📄 Description ## Summary Fix WG/AWG site split tunneling when AllowedIPs are IPv4-only, reordered, duplicated or formatted differently. This is the profile-eligibility/route-serialization part extracted from #3030. Fixes #3375. Tracking issue: #3378. ## Problem I found two decisions that could silently defeat the selected site-routing mode: - `VpnConnection` required both IPv4 and IPv6 default routes, disabling site splitting for valid IPv4-only profiles. - `LocalSocketController` compared AllowedIPs against one exact two-element array. In sites-only mode, an IPv4-only or reordered default list could therefore bypass the site allowlist and produce a full tunnel. The custom-route branch also marked IPv6 prefixes as IPv4. ## Changes - Normalize AllowedIPs from JSON arrays, strings and native configuration text, independent of comma spacing. - Allow the currently IPv4-based site list when the profile contains `0.0.0.0/0`. - Honor the site allowlist independently of default-route order, duplicates or IPv6 presence. - Preserve restricted native AllowedIPs and the original address-family coverage in all-sites/exclusion modes. - Use `IPAddress` for canonical prefix/address-family serialization and deduplicate generated ranges. - Add isolated LocalSocketController regression tests and register them in the Windows CMake test suite. Application-exclusion settings are passed through unchanged. This does not implement Windows application allowlist support. The existing frontend fallback from an empty selected site list to all-sites mode is unchanged. ## Verification On Windows x64 with Qt 6.10.1 and MSVC 19.53, I compiled the actual controller and regression tests from this standalone branch on dev `3f6ecacf`: - Before: **36 passed, 26 failed**. - After: **62 passed, 0 failed** (60 data cases plus setup/cleanup). - 42 route-generation cases: both protocols, all three site modes, empty/IPv4-only/ordered/reordered/duplicated defaults, restricted routes and default-plus-specific routes. - 18 application-passthrough cases: both protocols and all site modes, with application splitting disabled, enabled-empty or enabled-populated. The tests capture activation JSON through an isolated local socket; they do not contact the real service or change routes. These results validate serialization, not end-to-end VPN traffic. I have not switched my live connection to sites-only mode. The subsequent combined installer build is recorded below. `git diff --check` passes. Combining the three split branches reproduces the previous complete patch, apart from relocating the unchanged parsing helper so the independent branches merge cleanly. ### 5.1.0.6 refresh - Rebased onto release `5.1.0.6` (`ac175c8a`); `git range-diff` confirms that the patch commits are unchanged. - A clean Windows x64 configuration and combined Release client/service/installer build include #3030, #3379, #3380 and #3383, using Qt 6.10.1 and MSVC 19.53. - Five isolated suites passed: local-socket route serialization, domain routing with the actual bundled core, engine ownership, mocked Windows route monitoring and offscreen settings QML. - The domain suite had an unexplained initial CTest failure, followed by passing diagnostic and full-suite reruns; details are recorded in #3383. - These are combined-build results, not separate full builds of each PR. The installed VPN was not stopped or replaced. Real TUN/WG/AWG activation, WFP/kill-switch behavior, network transitions and disconnect cleanup still require on-device acceptance. ## Related issues and overlapping PRs - #3011 overlaps both IPv4-only eligibility and the sites-only controller branch. This PR provides an alternative covering reordered/duplicate defaults, prefix/family serialization and the regression matrix as well. - #3097 overlaps the earlier frontend eligibility check. - #2907 and #3314 report related macOS symptoms; their complete root causes and platform behavior are not established by these Windows-hosted tests. I am not requesting automatic closure of another contributor's PR. The other parts have separate reports: #3376 / #3380 (hostname/CIDR and DNS lifecycle) and #3377 / #3030 (Windows route application). All branches target dev directly; there is no required merge order. --- <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#3268
No description provided.