[PR #1317] [MERGED] Remove the gateway check for routes #15214

Open
opened 2026-08-05 03:07:11 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1317
Author: @mlsmaycon
Created: 11/17/2023
Status: Merged
Merged: 11/24/2023
Merged by: @mlsmaycon

Base: mainHead: remove-gateway-check-routes


📝 Commits (9)

  • 085be95 Remove the gateway check for routes
  • 1a5f51f get list or routed ranges
  • 17d551c check for subrange and try to add route for default gateway
  • abe5aa1 fix subrange check and removal for windows
  • 36a737d fix tests
  • 10741a4 fix tests
  • 64bdbf6 add existsInRouteTable and isSubRange tests
  • 548dad5 add existsInRouteTable and isSubRange tests
  • 7daeb7c fix spell

📊 Changes

8 files changed (+231 additions, -72 deletions)

View changed files

📝 client/internal/routemanager/client.go (+2 -0)
📝 client/internal/routemanager/manager.go (+1 -1)
📝 client/internal/routemanager/systemops_bsd.go (+33 -22)
📝 client/internal/routemanager/systemops_linux.go (+25 -9)
📝 client/internal/routemanager/systemops_nonandroid.go (+66 -15)
📝 client/internal/routemanager/systemops_nonandroid_test.go (+81 -15)
📝 client/internal/routemanager/systemops_nonlinux.go (+6 -2)
📝 client/internal/routemanager/systemops_windows.go (+17 -8)

📄 Description

Describe your changes

Most operating systems add a /32 route for the default gateway address to its routing table

This will allow routes to be configured into the system even when the incoming range contains the default gateway.

In case a range is a sub-range of an existing route and this range happens to contain the default gateway it attempts to create a default gateway route to prevent loop issues

#840

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/1317 **Author:** [@mlsmaycon](https://github.com/mlsmaycon) **Created:** 11/17/2023 **Status:** ✅ Merged **Merged:** 11/24/2023 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `remove-gateway-check-routes` --- ### 📝 Commits (9) - [`085be95`](https://github.com/netbirdio/netbird/commit/085be956246708b389722c7455d73fae2522b0f1) Remove the gateway check for routes - [`1a5f51f`](https://github.com/netbirdio/netbird/commit/1a5f51f484c9fc19b13b5b9f7bc015422ce92837) get list or routed ranges - [`17d551c`](https://github.com/netbirdio/netbird/commit/17d551c857742c1f4d250af91d83efe63578062c) check for subrange and try to add route for default gateway - [`abe5aa1`](https://github.com/netbirdio/netbird/commit/abe5aa1b66e633b230ee2afb000d9a41e5768f94) fix subrange check and removal for windows - [`36a737d`](https://github.com/netbirdio/netbird/commit/36a737da9176042e3d24983a52102343cb6037b0) fix tests - [`10741a4`](https://github.com/netbirdio/netbird/commit/10741a48023cb4595e710fcd83e44d329ebe32b3) fix tests - [`64bdbf6`](https://github.com/netbirdio/netbird/commit/64bdbf681ba874707868cd036302970385e3eb2a) add existsInRouteTable and isSubRange tests - [`548dad5`](https://github.com/netbirdio/netbird/commit/548dad52c961299ed40c2045a6674080d70989a5) add existsInRouteTable and isSubRange tests - [`7daeb7c`](https://github.com/netbirdio/netbird/commit/7daeb7c486279683aeb79a032c10870029817657) fix spell ### 📊 Changes **8 files changed** (+231 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/routemanager/client.go` (+2 -0) 📝 `client/internal/routemanager/manager.go` (+1 -1) 📝 `client/internal/routemanager/systemops_bsd.go` (+33 -22) 📝 `client/internal/routemanager/systemops_linux.go` (+25 -9) 📝 `client/internal/routemanager/systemops_nonandroid.go` (+66 -15) 📝 `client/internal/routemanager/systemops_nonandroid_test.go` (+81 -15) 📝 `client/internal/routemanager/systemops_nonlinux.go` (+6 -2) 📝 `client/internal/routemanager/systemops_windows.go` (+17 -8) </details> ### 📄 Description ## Describe your changes Most operating systems add a /32 route for the default gateway address to its routing table This will allow routes to be configured into the system even when the incoming range contains the default gateway. In case a range is a sub-range of an existing route and this range happens to contain the default gateway it attempts to create a default gateway route to prevent loop issues ## Issue ticket number and link #840 ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [x] 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 03:07:11 -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#15214