[PR #2820] [MERGED] Fix config import parsing and VPN route edge cases #2961

Closed
opened 2026-10-14 21:06:30 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/2820
Author: @ShiroKSH
Created: 7/8/2026
Status: ✅ Merged
Merged: 8/17/2026
Merged by: @vkamn

Base: dev ← Head: fix/import-route-edge-cases


📝 Commits (2)

  • 487a5c3 fix: harden config import parsing
  • b93a495 fix: handle vpn route edge cases

📊 Changes

6 files changed (+53 additions, -27 deletions)

View changed files

📝 client/core/controllers/selfhosted/importController.cpp (+22 -7)
📝 client/core/protocols/vpnProtocol.cpp (+1 -0)
📝 client/core/utils/networkUtilities.cpp (+9 -4)
📝 client/vpnConnection.cpp (+17 -12)
📝 service/server/killswitch.cpp (+1 -1)
📝 service/server/router_linux.cpp (+3 -3)

📄 Description

Summary

  • Accept WireGuard native configs that use Key=Value formatting and split AllowedIPs regardless of whitespace around commas.
  • Reject malformed Xray configs that only contain inbounds/outbounds text but are not valid JSON objects with those arrays.
  • Make legacy WG/AWG native config parsing tolerate = formatting without crashing on missing values.
  • Initialize VPN connection/error state and fix Linux route/killswitch edge cases.

Root cause

Several import and route paths assumed narrow formatting or uninitialized state: WireGuard parsers required literal " = ", Xray import did substring detection before JSON validation, CIDR mask generation accepted invalid prefixes, Linux block-net rules used the wrong flag, and deleteTun() inverted the netlink send result.

Validation

  • git diff --check origin/dev...HEAD
  • cmake -S . -B %TEMP%/amnezia-client-cmake-verify -DPREBUILTS_ONLY=ON was attempted with Conan available in a temp venv. Configure reached Conan package resolution/build and then failed in the existing Windows OpenVPN recipe with No message compiler found, before project compilation.

🔄 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/2820 **Author:** [@ShiroKSH](https://github.com/ShiroKSH) **Created:** 7/8/2026 **Status:** ✅ Merged **Merged:** 8/17/2026 **Merged by:** [@vkamn](https://github.com/vkamn) **Base:** `dev` ← **Head:** `fix/import-route-edge-cases` --- ### 📝 Commits (2) - [`487a5c3`](https://github.com/amnezia-vpn/amnezia-client/commit/487a5c307c1417cc6461a8d7b38f1dca17d483cc) fix: harden config import parsing - [`b93a495`](https://github.com/amnezia-vpn/amnezia-client/commit/b93a495f95913d6eb1a39446daad3a0095b9d259) fix: handle vpn route edge cases ### 📊 Changes **6 files changed** (+53 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `client/core/controllers/selfhosted/importController.cpp` (+22 -7) 📝 `client/core/protocols/vpnProtocol.cpp` (+1 -0) 📝 `client/core/utils/networkUtilities.cpp` (+9 -4) 📝 `client/vpnConnection.cpp` (+17 -12) 📝 `service/server/killswitch.cpp` (+1 -1) 📝 `service/server/router_linux.cpp` (+3 -3) </details> ### 📄 Description ## Summary - Accept WireGuard native configs that use `Key=Value` formatting and split `AllowedIPs` regardless of whitespace around commas. - Reject malformed Xray configs that only contain `inbounds`/`outbounds` text but are not valid JSON objects with those arrays. - Make legacy WG/AWG native config parsing tolerate `=` formatting without crashing on missing values. - Initialize VPN connection/error state and fix Linux route/killswitch edge cases. ## Root cause Several import and route paths assumed narrow formatting or uninitialized state: WireGuard parsers required literal `" = "`, Xray import did substring detection before JSON validation, CIDR mask generation accepted invalid prefixes, Linux block-net rules used the wrong flag, and `deleteTun()` inverted the netlink send result. ## Validation - `git diff --check origin/dev...HEAD` - `cmake -S . -B %TEMP%/amnezia-client-cmake-verify -DPREBUILTS_ONLY=ON` was attempted with Conan available in a temp venv. Configure reached Conan package resolution/build and then failed in the existing Windows OpenVPN recipe with `No message compiler found`, before project compilation. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-14 21:06:30 +00:00
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#2961
No description provided.