[PR #4003] [MERGED] [management] Add backward compatibility for older clients without firewall rules port range support #22203

Closed
opened 2026-08-05 05:09:28 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/4003
Author: @bcmmbaga
Created: 6/18/2025
Status: Merged
Merged: 6/19/2025
Merged by: @bcmmbaga

Base: mainHead: netmap-port-range


📝 Commits (10+)

  • 7ed2635 refactor version check to separate func
  • a900627 Add fallback to single ports for clients not supporting port ranges
  • 82e4c14 refactor
  • 2ead981 fix tests
  • 99a69b0 skip processing port ranges for unsupported versions
  • 1be41d5 Merge branch 'main' into netmap-port-range
  • a618a06 fix tests
  • 9ab0905 refactor
  • 7ec92ce update min peer version for port ranges support and allow single-port ranges for old version
  • db9f55d fix tests

📊 Changes

6 files changed (+246 additions, -63 deletions)

View changed files

📝 management/server/peer.go (+2 -2)
📝 management/server/policy_test.go (+106 -33)
📝 management/server/posture/nb_version.go (+20 -10)
📝 management/server/posture/nb_version_test.go (+65 -0)
📝 management/server/types/account.go (+53 -17)
📝 management/server/types/firewall_rule.go (+0 -1)

📄 Description

Describe your changes

This PR adds backward compatibility for clients with versions prior to v0.48.0 that do not support port range firewall rules. For these older clients, port ranges are expanded into individual ports during network map generation.

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

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


🔄 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/4003 **Author:** [@bcmmbaga](https://github.com/bcmmbaga) **Created:** 6/18/2025 **Status:** ✅ Merged **Merged:** 6/19/2025 **Merged by:** [@bcmmbaga](https://github.com/bcmmbaga) **Base:** `main` ← **Head:** `netmap-port-range` --- ### 📝 Commits (10+) - [`7ed2635`](https://github.com/netbirdio/netbird/commit/7ed26356a3d51b9cdead0450cda6cc474e5234a6) refactor version check to separate func - [`a900627`](https://github.com/netbirdio/netbird/commit/a9006277bb99b802eddf6acf757d25cd711461a0) Add fallback to single ports for clients not supporting port ranges - [`82e4c14`](https://github.com/netbirdio/netbird/commit/82e4c14fcac3934af79c365395bc8d8a636afba0) refactor - [`2ead981`](https://github.com/netbirdio/netbird/commit/2ead981fa4bae3b3f6d31ec68f3960b1f4969095) fix tests - [`99a69b0`](https://github.com/netbirdio/netbird/commit/99a69b003eb3b77550d03c5d5de10e2ebf755cd8) skip processing port ranges for unsupported versions - [`1be41d5`](https://github.com/netbirdio/netbird/commit/1be41d54a76b258b2df85dbe6ea5c19df75f6227) Merge branch 'main' into netmap-port-range - [`a618a06`](https://github.com/netbirdio/netbird/commit/a618a065a7f23408cb20542fa5af3452e2dd1a21) fix tests - [`9ab0905`](https://github.com/netbirdio/netbird/commit/9ab09057de48fa39b29aa57957c7fa118bbfffd8) refactor - [`7ec92ce`](https://github.com/netbirdio/netbird/commit/7ec92ceaf04b366de67c65caae61f55dbbaab9b1) update min peer version for port ranges support and allow single-port ranges for old version - [`db9f55d`](https://github.com/netbirdio/netbird/commit/db9f55d31af46671bf3d10c4ea9697e098fae0d6) fix tests ### 📊 Changes **6 files changed** (+246 additions, -63 deletions) <details> <summary>View changed files</summary> 📝 `management/server/peer.go` (+2 -2) 📝 `management/server/policy_test.go` (+106 -33) 📝 `management/server/posture/nb_version.go` (+20 -10) 📝 `management/server/posture/nb_version_test.go` (+65 -0) 📝 `management/server/types/account.go` (+53 -17) 📝 `management/server/types/firewall_rule.go` (+0 -1) </details> ### 📄 Description ## Describe your changes This PR adds backward compatibility for clients with versions prior to `v0.48.0` that do not support port range firewall rules. For these older clients, port ranges are expanded into individual ports during network map generation. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary > 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). --- <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:09:28 -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#22203