[PR #612] [MERGED] HA Network Routes: prevent routing directly-accessible networks through VPN interface #12793

Closed
opened 2026-08-05 02:06:41 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/612
Author: @nazarewk
Created: 12/6/2022
Status: Merged
Merged: 12/8/2022
Merged by: @mlsmaycon

Base: mainHead: fix-ha-routes


📝 Commits (3)

  • 6b417a8 test HA routing to own networks
  • a4b82dc HA Network Routes: prevent routing directly-accessible networks through VPN interface
  • 2d2235f UpdateRoutes: move newServerRoutesMap handling to first loop

📊 Changes

3 files changed (+70 additions, -11 deletions)

View changed files

📝 client/internal/routemanager/client.go (+3 -2)
📝 client/internal/routemanager/manager.go (+14 -6)
📝 client/internal/routemanager/manager_test.go (+53 -3)

📄 Description

Describe your changes

It prevents Server from adding rules to route directly accessible/own networks through VPN when the route is in HA mode (has more than 1 entry):

  1. the code was checking membership against a single Network Route entry with equality operator on Peer attribute:
    1. there is 1 Route per Peer
    2. second (HA) Route entry did not pass the check because it was not the server
    3. rule for routing the traffic through VPN interface is created
    4. host X is routing through host Y
    5. host Y is routing through host X
    6. (i assume) we have a routing loop passing packets back and forth between HA hosts instead of going to the real network
  2. The code fixes above issue by checking NetID instead of Peer values

see the linked issue for more details

fixes: https://github.com/netbirdio/netbird/issues/598

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • 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/612 **Author:** [@nazarewk](https://github.com/nazarewk) **Created:** 12/6/2022 **Status:** ✅ Merged **Merged:** 12/8/2022 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `fix-ha-routes` --- ### 📝 Commits (3) - [`6b417a8`](https://github.com/netbirdio/netbird/commit/6b417a86af41e7cd4eed9919316f2a502cd52527) test HA routing to own networks - [`a4b82dc`](https://github.com/netbirdio/netbird/commit/a4b82dcdf678129287c3643117329bb12e79ede5) HA Network Routes: prevent routing directly-accessible networks through VPN interface - [`2d2235f`](https://github.com/netbirdio/netbird/commit/2d2235fa1170733d4837360246f4fdf38377a73d) UpdateRoutes: move newServerRoutesMap handling to first loop ### 📊 Changes **3 files changed** (+70 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/routemanager/client.go` (+3 -2) 📝 `client/internal/routemanager/manager.go` (+14 -6) 📝 `client/internal/routemanager/manager_test.go` (+53 -3) </details> ### 📄 Description ## Describe your changes It prevents Server from adding rules to route directly accessible/own networks through VPN when the route is in HA mode (has more than 1 entry): 1. the code was checking membership against a single Network Route entry with equality operator on `Peer` attribute: 1. there is 1 Route per Peer 2. second (HA) Route entry did not pass the check because it was not the server 3. rule for routing the traffic through VPN interface is created 4. host X is routing through host Y 5. host Y is routing through host X 6. (i assume) we have a routing loop passing packets back and forth between HA hosts instead of going to the real network 2. The code fixes above issue by checking `NetID` instead of `Peer` values see the linked issue for more details ## Issue ticket number and link fixes: https://github.com/netbirdio/netbird/issues/598 ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] Created tests that fail without the change (if possible) - [x] 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 02:06:41 -04:00
saavagebueno changed title from [PR #612] HA Network Routes: prevent routing directly-accessible networks through VPN interface to [PR #612] [MERGED] HA Network Routes: prevent routing directly-accessible networks through VPN interface 2026-08-05 03:07:04 -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#12793