[PR #3380] fix: preserve site CIDRs and refresh domain routes #3269

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/3380
Author: @makkoar
Created: 11/2/2026
Status: 🔄 Open

Base: dev ← Head: fix/site-domains-dns-refresh


📝 Commits (2)

  • 9cf1c83 fix: preserve site CIDRs and refresh domain routes
  • da5e086 docs: restore upstream split tunneling comments

📊 Changes

6 files changed (+401 additions, -61 deletions)

View changed files

📝 client/core/controllers/ipSplitTunnelingController.cpp (+129 -48)
📝 client/core/controllers/ipSplitTunnelingController.h (+11 -5)
📝 client/core/repositories/secureAppSettingsRepository.cpp (+44 -4)
📝 client/core/repositories/secureAppSettingsRepository.h (+5 -0)
📝 client/vpnConnection.cpp (+183 -4)
📝 client/vpnConnection.h (+29 -0)

📄 Description

Summary

Fix remaining input, import and DNS-lifecycle gaps in site split tunneling. This is the hostname/CIDR and pre-connect DNS part extracted from #3030.

Fixes #3376.
Tracking issue: #3378.

Problem

I encountered excluded destinations still using the tunnel or timing out after reconnecting. This part addresses the stored inputs and addresses, independently of WG/AWG profile eligibility and Windows route installation:

  • duplicate imported hostname records replace rather than merge their address lists;
  • stored addresses can become stale between connections;
  • asynchronous DNS results can be written to a different list after the selected route mode changes;
  • malformed CIDR-like input can fall through to URL/path normalization.

Current dev already preserves basic valid CIDRs and supports multiple addresses. This PR hardens and completes that behavior; it does not introduce those capabilities from scratch.

Changes

  • Validate IPv4/CIDR inputs before URL parsing, retaining valid prefixes and rejecting malformed ones.
  • Normalize URLs/hostnames with QUrl, including IDN-to-ACE conversion, case and trailing dots.
  • Validate imported addresses and merge duplicate hostname entries.
  • Continue reading legacy single-IP settings and retaining both the complete ips array and legacy ip export field.
  • Keep asynchronous results associated with their original route mode; do not recreate deleted entries.
  • Resolve domain entries before desktop WG/AWG activation and on reconnect: at most 16 concurrent lookups, with a 10-second preparation deadline.
  • Replace only successfully resolved address lists; retain last known addresses on failure.
  • Cancel obsolete lookups on a new connection, disconnect or destruction.
  • Use unique queued reconnect subscriptions to avoid accumulating duplicate callbacks.

The resolver uses the system hostname-resolution path, including hosts mappings. On reconnect, DNS follows the networking state available at that point; this does not forcibly reroute DNS outside an already active tunnel.

Scope and compatibility

Shared controller/repository changes are separate from the desktop-only WG/AWG preparation path. Resolution retains IPv4 addresses only. No wildcard-domain support, continuous DNS monitoring, new IPv6 site model or application-routing behavior is added.

Verification

  • The implementation was previously included in the Windows x64 client, service and installer built on upstream 94b51df2 (5.0.3.1), and used in my local 5.0.3.2 build.
  • Earlier live checks covered public multi-address services, a private hostname resolved through hosts, excluded HTTPS and disconnect/reconnect behavior.
  • For this split, the branch was based directly on dev 3f6ecacf; its changes merge cleanly with both sibling branches. The combined tree preserves the original complete patch, with only an unchanged parsing helper relocated in the sibling AllowedIPs PR.
  • git diff --check passes.

The subsequent combined client/installer rebuild is recorded below. I have not rerun a live DNS-transition matrix after the split. The controller serialization tests in the AllowedIPs sibling do not validate this PR's asynchronous DNS lifecycle.

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.
  • #2825 overlaps multi-address hostname/pre-connect DNS handling.
  • #2939 documents the earlier CIDR-import regression; basic CIDR preservation is already in dev.
  • #3018 overlaps CIDR import regression coverage.
  • #3375 / #3379 track the separate WG/AWG eligibility/serialization fix.
  • #3377 / #3030 track Windows route installation.

This PR targets dev directly and does not require a sibling to merge first. The umbrella issue #3378 tracks the combined effort.


🔄 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/3380 **Author:** [@makkoar](https://github.com/makkoar) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/site-domains-dns-refresh` --- ### 📝 Commits (2) - [`9cf1c83`](https://github.com/amnezia-vpn/amnezia-client/commit/9cf1c8348c93a2fd06eab322ff3ba52562c18d1c) fix: preserve site CIDRs and refresh domain routes - [`da5e086`](https://github.com/amnezia-vpn/amnezia-client/commit/da5e08667f9632c0fdaae99ef7a8bfc61eb995d2) docs: restore upstream split tunneling comments ### 📊 Changes **6 files changed** (+401 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `client/core/controllers/ipSplitTunnelingController.cpp` (+129 -48) 📝 `client/core/controllers/ipSplitTunnelingController.h` (+11 -5) 📝 `client/core/repositories/secureAppSettingsRepository.cpp` (+44 -4) 📝 `client/core/repositories/secureAppSettingsRepository.h` (+5 -0) 📝 `client/vpnConnection.cpp` (+183 -4) 📝 `client/vpnConnection.h` (+29 -0) </details> ### 📄 Description ## Summary Fix remaining input, import and DNS-lifecycle gaps in site split tunneling. This is the hostname/CIDR and pre-connect DNS part extracted from #3030. Fixes #3376. Tracking issue: #3378. ## Problem I encountered excluded destinations still using the tunnel or timing out after reconnecting. This part addresses the stored inputs and addresses, independently of WG/AWG profile eligibility and Windows route installation: - duplicate imported hostname records replace rather than merge their address lists; - stored addresses can become stale between connections; - asynchronous DNS results can be written to a different list after the selected route mode changes; - malformed CIDR-like input can fall through to URL/path normalization. Current dev already preserves basic valid CIDRs and supports multiple addresses. This PR hardens and completes that behavior; it does not introduce those capabilities from scratch. ## Changes - Validate IPv4/CIDR inputs before URL parsing, retaining valid prefixes and rejecting malformed ones. - Normalize URLs/hostnames with QUrl, including IDN-to-ACE conversion, case and trailing dots. - Validate imported addresses and merge duplicate hostname entries. - Continue reading legacy single-IP settings and retaining both the complete `ips` array and legacy `ip` export field. - Keep asynchronous results associated with their original route mode; do not recreate deleted entries. - Resolve domain entries before desktop WG/AWG activation and on reconnect: at most 16 concurrent lookups, with a 10-second preparation deadline. - Replace only successfully resolved address lists; retain last known addresses on failure. - Cancel obsolete lookups on a new connection, disconnect or destruction. - Use unique queued reconnect subscriptions to avoid accumulating duplicate callbacks. The resolver uses the system hostname-resolution path, including hosts mappings. On reconnect, DNS follows the networking state available at that point; this does not forcibly reroute DNS outside an already active tunnel. ## Scope and compatibility Shared controller/repository changes are separate from the desktop-only WG/AWG preparation path. Resolution retains IPv4 addresses only. No wildcard-domain support, continuous DNS monitoring, new IPv6 site model or application-routing behavior is added. ## Verification - The implementation was previously included in the Windows x64 client, service and installer built on upstream `94b51df2` (5.0.3.1), and used in my local 5.0.3.2 build. - Earlier live checks covered public multi-address services, a private hostname resolved through hosts, excluded HTTPS and disconnect/reconnect behavior. - For this split, the branch was based directly on dev `3f6ecacf`; its changes merge cleanly with both sibling branches. The combined tree preserves the original complete patch, with only an unchanged parsing helper relocated in the sibling AllowedIPs PR. - `git diff --check` passes. The subsequent combined client/installer rebuild is recorded below. I have not rerun a live DNS-transition matrix after the split. The controller serialization tests in the AllowedIPs sibling do not validate this PR's asynchronous DNS lifecycle. ### 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 - #2825 overlaps multi-address hostname/pre-connect DNS handling. - #2939 documents the earlier CIDR-import regression; basic CIDR preservation is already in dev. - #3018 overlaps CIDR import regression coverage. - #3375 / #3379 track the separate WG/AWG eligibility/serialization fix. - #3377 / #3030 track Windows route installation. This PR targets dev directly and does not require a sibling to merge first. The umbrella issue #3378 tracks the combined effort. --- <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#3269
No description provided.