[PR #75] fix: parse tab-delimited dump correctly in wg-json #76

Open
opened 2026-10-13 21:03:02 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amneziawg-tools/pull/75
Author: @HeisLuka
Created: 9/14/2026
Status: 🔄 Open

Base: master ← Head: fix/wg-json-dump-parsing


📝 Commits (1)

  • 9a821b7 fix: parse tab-delimited AWG dump in wg-json

📊 Changes

1 file changed (+16 additions, -7 deletions)

View changed files

📝 contrib/json/wg-json (+16 -7)

📄 Description

Summary

Fix contrib/json/wg-json parsing of awg show all dump.

The dump format is tab-delimited, but the script parsed the remainder of each line with the shell's default whitespace IFS. CPS values such as <b 0x...>, <r 8> and chained I1-I5 expressions contain spaces by design, so those spaces shifted every following field.

Use tab-only IFS for both device and peer dump rows so spaces inside a field are preserved.

The current dump format also has AWG 3.1 fields between I1-I5 and fwmark. The script still used the older 2.0 column list, so on 3.1 those values were all shifted and the first 3.1 field was interpreted as fwmark. This change consumes the current fields and serializes non-default 3.1 values to JSON.

It also treats the current (null) placeholder for absent I1-I5 values as absent rather than emitting it as a literal value.

Validation

Checked the tab parser with:

  • a CPS I1 value containing multiple spaces and default 3.1 fields;
  • a full 3.1 row containing HeaderProtectionKey, all timing ranges, RandomTrailers, DisableCookies and a non-default fwmark.

In both cases the CPS value stayed intact and the final fields remained aligned.

Fixes #36


🔄 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/amneziawg-tools/pull/75 **Author:** [@HeisLuka](https://github.com/HeisLuka) **Created:** 9/14/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix/wg-json-dump-parsing` --- ### 📝 Commits (1) - [`9a821b7`](https://github.com/amnezia-vpn/amneziawg-tools/commit/9a821b74ce9b3fd7ec7a5309d1ded30bfbe6e2f2) fix: parse tab-delimited AWG dump in wg-json ### 📊 Changes **1 file changed** (+16 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `contrib/json/wg-json` (+16 -7) </details> ### 📄 Description ## Summary Fix `contrib/json/wg-json` parsing of `awg show all dump`. The dump format is tab-delimited, but the script parsed the remainder of each line with the shell's default whitespace `IFS`. CPS values such as `<b 0x...>`, `<r 8>` and chained I1-I5 expressions contain spaces by design, so those spaces shifted every following field. Use tab-only `IFS` for both device and peer dump rows so spaces inside a field are preserved. The current dump format also has AWG 3.1 fields between I1-I5 and `fwmark`. The script still used the older 2.0 column list, so on 3.1 those values were all shifted and the first 3.1 field was interpreted as `fwmark`. This change consumes the current fields and serializes non-default 3.1 values to JSON. It also treats the current `(null)` placeholder for absent I1-I5 values as absent rather than emitting it as a literal value. ## Validation Checked the tab parser with: - a CPS I1 value containing multiple spaces and default 3.1 fields; - a full 3.1 row containing HeaderProtectionKey, all timing ranges, RandomTrailers, DisableCookies and a non-default fwmark. In both cases the CPS value stayed intact and the final fields remained aligned. Fixes #36 --- <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/amneziawg-tools#76
No description provided.