[PR #2873] [MERGED] [client] fix/proxy close #20730

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/2873
Author: @pappz
Created: 11/10/2024
Status: Merged
Merged: 11/11/2024
Merged by: @pappz

Base: mainHead: fix/proxy-close


📝 Commits (10+)

  • 6c91e36 Remove loop after route calculation
  • 00a5e3f Protect route state manipulation with mutex
  • 0e891fe Do not update routes after peer.Open() and peer.Close()
  • a55207b Remove unused function
  • 16deec6 Fix test
  • 2089656 Avoid duplicated disconnects events
  • 3eb99c0 Reset lastKnownState flag
  • a2164a8 Add log for score calculation
  • 8f07049 Fix thread safe MarshalJson on refcounter
  • c093f89 Add route change notification for UpdatePeerICEState

📊 Changes

8 files changed (+26 additions, -16 deletions)

View changed files

📝 client/iface/wgproxy/bind/proxy.go (+5 -1)
📝 client/iface/wgproxy/ebpf/wrapper.go (+1 -1)
📝 client/iface/wgproxy/udp/proxy.go (+1 -1)
📝 client/internal/peer/conn.go (+11 -2)
📝 relay/client/client.go (+3 -4)
📝 relay/client/conn.go (+1 -2)
📝 relay/server/listener/ws/conn.go (+2 -3)
📝 relay/server/peer.go (+2 -2)

📄 Description

Describe your changes

When the remote peer switches the Relay instance then must to close the proxy connection to the old instance.

It can cause issues when the remote peer switch connects to the Relay instance multiple times and then reconnects to an instance it had previously connected to.

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)
  • Extended the README / documentation, if necessary

🔄 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/2873 **Author:** [@pappz](https://github.com/pappz) **Created:** 11/10/2024 **Status:** ✅ Merged **Merged:** 11/11/2024 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `fix/proxy-close` --- ### 📝 Commits (10+) - [`6c91e36`](https://github.com/netbirdio/netbird/commit/6c91e36a9601f57e49392bfe44f45fd355109244) Remove loop after route calculation - [`00a5e3f`](https://github.com/netbirdio/netbird/commit/00a5e3f550ea6d1ceaf214a99156280586f95bf3) Protect route state manipulation with mutex - [`0e891fe`](https://github.com/netbirdio/netbird/commit/0e891fe8f927aeca2db30074195514f6e0dc11b7) Do not update routes after peer.Open() and peer.Close() - [`a55207b`](https://github.com/netbirdio/netbird/commit/a55207b0ee7416f276759a24b32fe1725508f0ea) Remove unused function - [`16deec6`](https://github.com/netbirdio/netbird/commit/16deec6bff82c7eac7e8f850faa70fa6d4ac2250) Fix test - [`2089656`](https://github.com/netbirdio/netbird/commit/20896568adf7bc7750b7387593358967f591feb6) Avoid duplicated disconnects events - [`3eb99c0`](https://github.com/netbirdio/netbird/commit/3eb99c0ba03465a3ded3f0a2f8ae6ad5e1739c0f) Reset lastKnownState flag - [`a2164a8`](https://github.com/netbirdio/netbird/commit/a2164a80cd2c956a428f216942a95488fd3692f8) Add log for score calculation - [`8f07049`](https://github.com/netbirdio/netbird/commit/8f07049fb5e0533403f030062d42f1c2d6e2f0cc) Fix thread safe MarshalJson on refcounter - [`c093f89`](https://github.com/netbirdio/netbird/commit/c093f89e0ee8d2348a8e701c2841937e3e3e7bc5) Add route change notification for UpdatePeerICEState ### 📊 Changes **8 files changed** (+26 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `client/iface/wgproxy/bind/proxy.go` (+5 -1) 📝 `client/iface/wgproxy/ebpf/wrapper.go` (+1 -1) 📝 `client/iface/wgproxy/udp/proxy.go` (+1 -1) 📝 `client/internal/peer/conn.go` (+11 -2) 📝 `relay/client/client.go` (+3 -4) 📝 `relay/client/conn.go` (+1 -2) 📝 `relay/server/listener/ws/conn.go` (+2 -3) 📝 `relay/server/peer.go` (+2 -2) </details> ### 📄 Description ## Describe your changes When the remote peer switches the Relay instance then must to close the proxy connection to the old instance. It can cause issues when the remote peer switch connects to the Relay instance multiple times and then reconnects to an instance it had previously connected to. ## Issue ticket number and link ### Checklist - [x] 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) - [ ] Extended the README / documentation, if necessary --- <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 05:07:37 -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#20730