[PR #3046] [MERGED] Fix: wgShow parsing bug causing new peers to steal stats of other peers #3063

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

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/3046
Author: @HugoFiermein
Created: 8/25/2026
Status: ✅ Merged
Merged: 8/27/2026
Merged by: @vkamn

Base: dev ← Head: fix-wgshow-parsing


📝 Commits (1)

  • 91e52cb Fix bug where new WireGuard peers steal stats of other peers due to missing handshake

📊 Changes

1 file changed (+37 additions, -23 deletions)

View changed files

📝 client/core/controllers/selfhosted/usersController.cpp (+37 -23)

📄 Description

When a new WireGuard configuration is created but hasn't handshaked yet, wg show all omits the latest handshake: line entirely for that peer.

The previous index-based parsing logic extracted latest handshake: and ransfer: fields into separate isolated arrays using parts.filter(). Because some peers lack handshakes, these arrays could be of different lengths, causing the stats of all subsequent peers to be misaligned (shifted by one) in the UI. For instance, a brand new peer with 0 bytes transferred could suddenly display '45 days ago' and gigabytes of usage belonging to another peer.

This PR rewrites UsersController::wgShow to read the command output block-by-block (sequentially iterating through the peer blocks), completely eliminating the index misalignment issue.


🔄 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/3046 **Author:** [@HugoFiermein](https://github.com/HugoFiermein) **Created:** 8/25/2026 **Status:** ✅ Merged **Merged:** 8/27/2026 **Merged by:** [@vkamn](https://github.com/vkamn) **Base:** `dev` ← **Head:** `fix-wgshow-parsing` --- ### 📝 Commits (1) - [`91e52cb`](https://github.com/amnezia-vpn/amnezia-client/commit/91e52cbf67ecb9921a61d4ebfbff7e6fc2ea61cf) Fix bug where new WireGuard peers steal stats of other peers due to missing handshake ### 📊 Changes **1 file changed** (+37 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `client/core/controllers/selfhosted/usersController.cpp` (+37 -23) </details> ### 📄 Description When a new WireGuard configuration is created but hasn't handshaked yet, wg show all omits the latest handshake: line entirely for that peer. The previous index-based parsing logic extracted latest handshake: and ransfer: fields into separate isolated arrays using parts.filter(). Because some peers lack handshakes, these arrays could be of different lengths, causing the stats of all subsequent peers to be misaligned (shifted by one) in the UI. For instance, a brand new peer with 0 bytes transferred could suddenly display '45 days ago' and gigabytes of usage belonging to another peer. This PR rewrites UsersController::wgShow to read the command output block-by-block (sequentially iterating through the peer blocks), completely eliminating the index misalignment issue. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-14 21:07:15 +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#3063
No description provided.