[PR #1305] [MERGED] Fix/acl for forward #13477

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1305
Author: @pappz
Created: 11/13/2023
Status: Merged
Merged: 12/8/2023
Merged by: @pappz

Base: mainHead: fix/acl-for-forward


📝 Commits (10+)

  • 7ac3f98 Replace input, output to pre-post-routing
  • 393bc37 Set chain type to nat
  • 2700f7e Revert change and remove IPv6
  • d2efff1 Refactor input/output logic
  • 57019dd Rename tables and chains
  • a1864dd Fix interface names in fwd chain
  • 820c72d Simplify the table check
  • 227017b Error handling
  • 2202237 Restriction for NetBird address in fwd chain
  • 12c8de7 Try to fix fwd policy

📊 Changes

50 files changed (+3699 additions, -3606 deletions)

View changed files

client/firewall/create.go (+32 -0)
client/firewall/create_linux.go (+107 -0)
client/firewall/iface.go (+11 -0)
client/firewall/iptables/acl_linux.go (+473 -0)
📝 client/firewall/iptables/manager_linux.go (+76 -399)
📝 client/firewall/iptables/manager_linux_test.go (+50 -32)
client/firewall/iptables/router_linux.go (+340 -0)
client/firewall/iptables/router_linux_test.go (+229 -0)
📝 client/firewall/iptables/rule.go (+1 -2)
client/firewall/iptables/rulestore_linux.go (+50 -0)
📝 client/firewall/manager/firewall.go (+23 -6)
📝 client/firewall/manager/port.go (+1 -1)
client/firewall/manager/routerpair.go (+18 -0)
client/firewall/nftables/acl_linux.go (+1121 -0)
client/firewall/nftables/ipsetstore_linux.go (+85 -0)
📝 client/firewall/nftables/manager_linux.go (+81 -694)
📝 client/firewall/nftables/manager_linux_test.go (+12 -16)
client/firewall/nftables/route_linux.go (+413 -0)
client/firewall/nftables/router_linux_test.go (+280 -0)
📝 client/firewall/nftables/rule_linux.go (+4 -3)

...and 30 more files

📄 Description

Describe your changes

Enforce the ACL rules for routed traffic.

Because under the hood the firewall rules depend from the route rules the two logic has been merged into the firewall package.

  • fix cleanup routine in iptables and nftables
  • refactor the nftables/iptables logic. (start to use prerouting and mangle table)
  • remove IPv6 related codes because it is unused
  • remove unused codes, variables, structures

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/1305 **Author:** [@pappz](https://github.com/pappz) **Created:** 11/13/2023 **Status:** ✅ Merged **Merged:** 12/8/2023 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `fix/acl-for-forward` --- ### 📝 Commits (10+) - [`7ac3f98`](https://github.com/netbirdio/netbird/commit/7ac3f987a6e6dd980a95367f27898a53ce1ef801) Replace input, output to pre-post-routing - [`393bc37`](https://github.com/netbirdio/netbird/commit/393bc37bdeefd5137def0586bf8433fd56f2cdae) Set chain type to nat - [`2700f7e`](https://github.com/netbirdio/netbird/commit/2700f7e82eb31c5bd6768e7cdf7b382741a09ea6) Revert change and remove IPv6 - [`d2efff1`](https://github.com/netbirdio/netbird/commit/d2efff1a49336d799bf3b131a10ae395b94b4b85) Refactor input/output logic - [`57019dd`](https://github.com/netbirdio/netbird/commit/57019dd502ce6587c3d0fa431c519b622dc4b2a4) Rename tables and chains - [`a1864dd`](https://github.com/netbirdio/netbird/commit/a1864ddeb8ad637b445aea63d0d53ae0593f3a9d) Fix interface names in fwd chain - [`820c72d`](https://github.com/netbirdio/netbird/commit/820c72def3f6ebd71f5a0b5276c39081ff7aa12b) Simplify the table check - [`227017b`](https://github.com/netbirdio/netbird/commit/227017bfa5fcfd1b2f487780ed1c2061602ac834) Error handling - [`2202237`](https://github.com/netbirdio/netbird/commit/22022370a48a07f4fd28b962e93b87a739f7c553) Restriction for NetBird address in fwd chain - [`12c8de7`](https://github.com/netbirdio/netbird/commit/12c8de7e2e173602872cd5460262abd01db0ecbf) Try to fix fwd policy ### 📊 Changes **50 files changed** (+3699 additions, -3606 deletions) <details> <summary>View changed files</summary> ➕ `client/firewall/create.go` (+32 -0) ➕ `client/firewall/create_linux.go` (+107 -0) ➕ `client/firewall/iface.go` (+11 -0) ➕ `client/firewall/iptables/acl_linux.go` (+473 -0) 📝 `client/firewall/iptables/manager_linux.go` (+76 -399) 📝 `client/firewall/iptables/manager_linux_test.go` (+50 -32) ➕ `client/firewall/iptables/router_linux.go` (+340 -0) ➕ `client/firewall/iptables/router_linux_test.go` (+229 -0) 📝 `client/firewall/iptables/rule.go` (+1 -2) ➕ `client/firewall/iptables/rulestore_linux.go` (+50 -0) 📝 `client/firewall/manager/firewall.go` (+23 -6) 📝 `client/firewall/manager/port.go` (+1 -1) ➕ `client/firewall/manager/routerpair.go` (+18 -0) ➕ `client/firewall/nftables/acl_linux.go` (+1121 -0) ➕ `client/firewall/nftables/ipsetstore_linux.go` (+85 -0) 📝 `client/firewall/nftables/manager_linux.go` (+81 -694) 📝 `client/firewall/nftables/manager_linux_test.go` (+12 -16) ➕ `client/firewall/nftables/route_linux.go` (+413 -0) ➕ `client/firewall/nftables/router_linux_test.go` (+280 -0) 📝 `client/firewall/nftables/rule_linux.go` (+4 -3) _...and 30 more files_ </details> ### 📄 Description ## Describe your changes Enforce the ACL rules for routed traffic. Because under the hood the firewall rules depend from the route rules the two logic has been merged into the firewall package. - fix cleanup routine in iptables and nftables - refactor the nftables/iptables logic. (start to use prerouting and mangle table) - remove IPv6 related codes because it is unused - remove unused codes, variables, structures ## Issue ticket number and link ### Checklist - [x] 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 --- <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:08: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#13477