[PR #6681] [CLOSED] [client] Diagnostic logs #26652

Closed
opened 2026-08-05 07:07:38 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6681
Author: @riccardomanfrin
Created: 7/6/2026
Status: Closed

Base: mainHead: diagnostic_logs


📝 Commits (6)

  • 8012294 Add logs for Rosenpass to check for lost key
  • 0860660 Adds logs for 6626
  • bf9de56 Route diagnostics
  • 2f3bf5b [client] diag: log remote rosenpass key presence + RP negotiation start
  • dd20a40 Revert "[client] Fix race between WG watcher initial handshake read and endpoint creation (#6626)"
  • e24ae10 Revert V4 mapped to V6 not working on Darwin/Freebsd for V6 netbird

📊 Changes

7 files changed (+69 additions, -64 deletions)

View changed files

📝 client/internal/peer/conn.go (+12 -10)
📝 client/internal/peer/endpoint.go (+6 -0)
📝 client/internal/peer/wg_watcher.go (+26 -26)
📝 client/internal/peer/wg_watcher_test.go (+0 -10)
📝 client/internal/rosenpass/manager.go (+16 -14)
📝 client/internal/rosenpass/netbird_handler.go (+1 -0)
📝 client/internal/routemanager/client/client.go (+8 -4)

📄 Description

Describe your changes

Diagnostic logging only. Purpose: produce a snapshot

Three grep-able Warn-level log groups (visible at default log level, no trace needed):

  • ROUTE-DIAG (routemanager/client/client.go) — when a network has no usable
    routing peer, logs each candidate peer's connection state (connecting/connected/
    idle, relayed, latency), and the moment a routing peer becomes usable. Maps the
    DNS-outage-at-connect convergence window (Martin's variant).
  • WGW-DIAG (peer/wg_watcher.go) — watcher baseline handshake, each check
    (ok / timeout), and the teardown decision (ctx live → TEARDOWN vs cancelled →
    stand down), with a per-instance id to spot overlapping/superseded watchers.
    Probes the #6626 watcher-rework behaviour (Erik's stuck-loop variant).
  • PSK-DIAG (peer/conn.go, peer/endpoint.go, rosenpass/netbird_handler.go)
    — Rosenpass PSK lifecycle: when RP sets the PSK, when RemoveEndpointAddress
    drops it, what presharedKey() returns, and whether WG is configured with a
    PSK present/absent after reconnect.

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Throwaway diagnostic logging to produce a debug build for customer
troubleshooting. Not intended to merge; no public API / CLI / config change.

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

N/A

Summary by CodeRabbit

  • Bug Fixes
    • Improved WireGuard watcher diagnostics, including baseline handshake reporting, clearer timeout/connection-check outcomes, and more informative reset/stop logs.
    • Enhanced preshared key and endpoint troubleshooting warnings during endpoint updates, switches, and removals (including when the on-wire key is dropped/preserved).
    • Improved route-selection diagnostics when no route is available and when a new route is chosen.
    • Improved Rosenpass UDP handling by using IPv4-only binding to avoid IPv6→IPv4 send issues.
  • Tests
    • Updated WireGuard watcher tests to remove reliance on initial-handshake readiness checks.

🔄 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/netbirdio/netbird/pull/6681 **Author:** [@riccardomanfrin](https://github.com/riccardomanfrin) **Created:** 7/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `diagnostic_logs` --- ### 📝 Commits (6) - [`8012294`](https://github.com/netbirdio/netbird/commit/80122940422c291aacdd2d35c0cd96e58a64d9d4) Add logs for Rosenpass to check for lost key - [`0860660`](https://github.com/netbirdio/netbird/commit/0860660a77bc5322d8156c8c758c423e89f00c1e) Adds logs for 6626 - [`bf9de56`](https://github.com/netbirdio/netbird/commit/bf9de561b9d48a42058d73d67cc513366877bf9c) Route diagnostics - [`2f3bf5b`](https://github.com/netbirdio/netbird/commit/2f3bf5bb164fd7282b1b00964b3be8ecee6a7113) [client] diag: log remote rosenpass key presence + RP negotiation start - [`dd20a40`](https://github.com/netbirdio/netbird/commit/dd20a4076b8aefeb4195fc0c2f2bcadf69ccc894) Revert "[client] Fix race between WG watcher initial handshake read and endpoint creation (#6626)" - [`e24ae10`](https://github.com/netbirdio/netbird/commit/e24ae1017a39ecba889ad9fd71baaf26c1726ac4) Revert V4 mapped to V6 not working on Darwin/Freebsd for V6 netbird ### 📊 Changes **7 files changed** (+69 additions, -64 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/peer/conn.go` (+12 -10) 📝 `client/internal/peer/endpoint.go` (+6 -0) 📝 `client/internal/peer/wg_watcher.go` (+26 -26) 📝 `client/internal/peer/wg_watcher_test.go` (+0 -10) 📝 `client/internal/rosenpass/manager.go` (+16 -14) 📝 `client/internal/rosenpass/netbird_handler.go` (+1 -0) 📝 `client/internal/routemanager/client/client.go` (+8 -4) </details> ### 📄 Description ## Describe your changes Diagnostic logging only. Purpose: produce a snapshot Three grep-able Warn-level log groups (visible at default log level, no trace needed): - `ROUTE-DIAG` (`routemanager/client/client.go`) — when a network has no usable routing peer, logs each candidate peer's connection state (connecting/connected/ idle, relayed, latency), and the moment a routing peer becomes usable. Maps the DNS-outage-at-connect convergence window (Martin's variant). - `WGW-DIAG` (`peer/wg_watcher.go`) — watcher baseline handshake, each check (ok / timeout), and the teardown decision (ctx live → TEARDOWN vs cancelled → stand down), with a per-instance id to spot overlapping/superseded watchers. Probes the #6626 watcher-rework behaviour (Erik's stuck-loop variant). - `PSK-DIAG` (`peer/conn.go`, `peer/endpoint.go`, `rosenpass/netbird_handler.go`) — Rosenpass PSK lifecycle: when RP sets the PSK, when RemoveEndpointAddress drops it, what `presharedKey()` returns, and whether WG is configured with a PSK present/absent after reconnect. ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) Throwaway diagnostic logging to produce a debug build for customer troubleshooting. Not intended to merge; no public API / CLI / config change. ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: N/A <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved WireGuard watcher diagnostics, including baseline handshake reporting, clearer timeout/connection-check outcomes, and more informative reset/stop logs. * Enhanced preshared key and endpoint troubleshooting warnings during endpoint updates, switches, and removals (including when the on-wire key is dropped/preserved). * Improved route-selection diagnostics when no route is available and when a new route is chosen. * Improved Rosenpass UDP handling by using IPv4-only binding to avoid IPv6→IPv4 send issues. * **Tests** * Updated WireGuard watcher tests to remove reliance on initial-handshake readiness checks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 07:07:38 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#26652