[PR #915] [MERGED] Extend protocol and firewall manager to handle old management #13138

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/915
Author: @gigovich
Created: 5/30/2023
Status: Merged
Merged: 5/31/2023
Merged by: @mlsmaycon

Base: mainHead: fix-empty-rules-from-old-management


📝 Commits (6)

  • 94d3a31 Extend protocol and firewall manager to handle old management
  • 34984f9 Send correct empty firewall rules list when delete peer
  • ed96a75 Add extra tests for firewall manager and uspfilter
  • 52a7517 Work with inconsistent state
  • 70d0360 Review note
  • 6a637f5 Update comment

📊 Changes

13 files changed (+360 additions, -218 deletions)

View changed files

📝 client/firewall/iptables/manager_linux.go (+11 -2)
📝 client/firewall/nftables/manager_linux.go (+31 -28)
📝 client/firewall/uspfilter/rule.go (+1 -0)
📝 client/firewall/uspfilter/uspfilter.go (+25 -18)
📝 client/firewall/uspfilter/uspfilter_test.go (+68 -0)
📝 client/internal/acl/manager.go (+20 -2)
📝 client/internal/acl/manager_test.go (+19 -11)
📝 client/internal/engine.go (+7 -1)
📝 management/proto/management.pb.go (+156 -143)
📝 management/proto/management.proto (+3 -0)
📝 management/server/grpcserver.go (+9 -8)
📝 management/server/peer.go (+5 -3)
📝 management/server/policy.go (+5 -2)

📄 Description

Describe your changes

With old management, the new clients always will receive an empty list of firewall rules, and by default, we block all traffic. To avoid this, let’s modify the protocol and add FirewallRulesIsEmpty field (same as RemotePeersIsEmpty). When this field is not set and rules are empty, we work with the old management version, and we need to add special rules to input and output chains to allow all traffic.

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/915 **Author:** [@gigovich](https://github.com/gigovich) **Created:** 5/30/2023 **Status:** ✅ Merged **Merged:** 5/31/2023 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `fix-empty-rules-from-old-management` --- ### 📝 Commits (6) - [`94d3a31`](https://github.com/netbirdio/netbird/commit/94d3a31f4a860d59a9e8ba03e72d0c8a158dcff0) Extend protocol and firewall manager to handle old management - [`34984f9`](https://github.com/netbirdio/netbird/commit/34984f9fc125e7494cecc57e4aca7a1f45493a40) Send correct empty firewall rules list when delete peer - [`ed96a75`](https://github.com/netbirdio/netbird/commit/ed96a756c1b7101e235b066248e54fc5d3d92a14) Add extra tests for firewall manager and uspfilter - [`52a7517`](https://github.com/netbirdio/netbird/commit/52a75176629b752abb5ec8c17d8bc10fb2cf6baa) Work with inconsistent state - [`70d0360`](https://github.com/netbirdio/netbird/commit/70d0360d991c056e82e68b401464c0a950c4f07f) Review note - [`6a637f5`](https://github.com/netbirdio/netbird/commit/6a637f5eaa792c58aa213e36c8dab1ffd2c21198) Update comment ### 📊 Changes **13 files changed** (+360 additions, -218 deletions) <details> <summary>View changed files</summary> 📝 `client/firewall/iptables/manager_linux.go` (+11 -2) 📝 `client/firewall/nftables/manager_linux.go` (+31 -28) 📝 `client/firewall/uspfilter/rule.go` (+1 -0) 📝 `client/firewall/uspfilter/uspfilter.go` (+25 -18) 📝 `client/firewall/uspfilter/uspfilter_test.go` (+68 -0) 📝 `client/internal/acl/manager.go` (+20 -2) 📝 `client/internal/acl/manager_test.go` (+19 -11) 📝 `client/internal/engine.go` (+7 -1) 📝 `management/proto/management.pb.go` (+156 -143) 📝 `management/proto/management.proto` (+3 -0) 📝 `management/server/grpcserver.go` (+9 -8) 📝 `management/server/peer.go` (+5 -3) 📝 `management/server/policy.go` (+5 -2) </details> ### 📄 Description ## Describe your changes With old management, the new clients always will receive an empty list of firewall rules, and by default, we block all traffic. To avoid this, let’s modify the protocol and add `FirewallRulesIsEmpty` field (same as `RemotePeersIsEmpty`). When this field is not set and rules are empty, we work with the old management version, and we need to add special rules to input and output chains to allow all traffic. ## Issue ticket number and link ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [x] 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 02:07:33 -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#13138