[PR #836] [MERGED] Userspace packet filtering #13058

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/836
Author: @gigovich
Created: 5/5/2023
Status: Merged
Merged: 5/18/2023
Merged by: @gigovich

Base: feat-linux-firewall-supportHead: feat-linux-firewall-support-bind


📝 Commits (10+)

  • a41db39 Add TUN injector interface
  • 4778219 WIP userspace filters
  • 1d335b2 Working state of userspace firewall
  • 1bd9ebe Fix tests for userspace filtering. Refactor ACL manager
  • 30f2eaf Fix dependencies
  • 46b06aa Add wrappers fot TUN to Windows and Android
  • bcc1d4f Linter fix
  • 0bca752 Fix Codacy issue and build issue
  • 0f2f28a Fix Android build
  • 3c59aaf Fix rule delete in uspfilter. Add common unit tests for uspfilter.

📊 Changes

25 files changed (+1482 additions, -181 deletions)

View changed files

📝 client/firewall/firewall.go (+2 -1)
📝 client/firewall/iptables/manager_linux.go (+135 -50)
📝 client/firewall/iptables/manager_linux_test.go (+11 -11)
📝 client/firewall/iptables/rule.go (+1 -0)
📝 client/firewall/nftables/manager_linux.go (+82 -49)
📝 client/firewall/nftables/manager_linux_test.go (+4 -3)
client/firewall/uspfilter/rule.go (+27 -0)
client/firewall/uspfilter/uspfilter.go (+288 -0)
client/firewall/uspfilter/uspfilter_test.go (+169 -0)
📝 client/internal/acl/manager.go (+73 -47)
📝 client/internal/acl/manager_create.go (+15 -2)
📝 client/internal/acl/manager_create_linux.go (+17 -8)
📝 client/internal/acl/manager_test.go (+16 -6)
client/internal/acl/mocks/iface_mapper.go (+77 -0)
📝 client/internal/engine.go (+1 -1)
📝 go.mod (+2 -1)
📝 go.sum (+2 -0)
iface/device_wrapper.go (+90 -0)
iface/device_wrapper_test.go (+216 -0)
📝 iface/iface.go (+15 -0)

...and 5 more files

📄 Description

Describe your changes

Add TUN device wrapper and userspace packet filter to use it as firewall manager for ACL controller.

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/836 **Author:** [@gigovich](https://github.com/gigovich) **Created:** 5/5/2023 **Status:** ✅ Merged **Merged:** 5/18/2023 **Merged by:** [@gigovich](https://github.com/gigovich) **Base:** `feat-linux-firewall-support` ← **Head:** `feat-linux-firewall-support-bind` --- ### 📝 Commits (10+) - [`a41db39`](https://github.com/netbirdio/netbird/commit/a41db3938f6cb810e26d215413dd698bac4745fa) Add TUN injector interface - [`4778219`](https://github.com/netbirdio/netbird/commit/4778219d8bd6564c5c27c7345a596512a057f750) WIP userspace filters - [`1d335b2`](https://github.com/netbirdio/netbird/commit/1d335b25ee362a44b7c6af985e0ebc3a68534811) Working state of userspace firewall - [`1bd9ebe`](https://github.com/netbirdio/netbird/commit/1bd9ebebcca1bb627e2947c68c399dba1c6791a2) Fix tests for userspace filtering. Refactor ACL manager - [`30f2eaf`](https://github.com/netbirdio/netbird/commit/30f2eaff3d1ab0df31fd1e92b2bb60c3ab309e04) Fix dependencies - [`46b06aa`](https://github.com/netbirdio/netbird/commit/46b06aae239d67266cad82290969f2b3dc215752) Add wrappers fot TUN to Windows and Android - [`bcc1d4f`](https://github.com/netbirdio/netbird/commit/bcc1d4f85ba8d2135069794fe350f708ae0569d0) Linter fix - [`0bca752`](https://github.com/netbirdio/netbird/commit/0bca752e5db5def0b299cf1b01b371402775e947) Fix Codacy issue and build issue - [`0f2f28a`](https://github.com/netbirdio/netbird/commit/0f2f28a9b7f7889d1ba36531c850c204aadd8166) Fix Android build - [`3c59aaf`](https://github.com/netbirdio/netbird/commit/3c59aaffbf89bca7a1427db53a6cd70a22c4c5b4) Fix rule delete in uspfilter. Add common unit tests for uspfilter. ### 📊 Changes **25 files changed** (+1482 additions, -181 deletions) <details> <summary>View changed files</summary> 📝 `client/firewall/firewall.go` (+2 -1) 📝 `client/firewall/iptables/manager_linux.go` (+135 -50) 📝 `client/firewall/iptables/manager_linux_test.go` (+11 -11) 📝 `client/firewall/iptables/rule.go` (+1 -0) 📝 `client/firewall/nftables/manager_linux.go` (+82 -49) 📝 `client/firewall/nftables/manager_linux_test.go` (+4 -3) ➕ `client/firewall/uspfilter/rule.go` (+27 -0) ➕ `client/firewall/uspfilter/uspfilter.go` (+288 -0) ➕ `client/firewall/uspfilter/uspfilter_test.go` (+169 -0) 📝 `client/internal/acl/manager.go` (+73 -47) 📝 `client/internal/acl/manager_create.go` (+15 -2) 📝 `client/internal/acl/manager_create_linux.go` (+17 -8) 📝 `client/internal/acl/manager_test.go` (+16 -6) ➕ `client/internal/acl/mocks/iface_mapper.go` (+77 -0) 📝 `client/internal/engine.go` (+1 -1) 📝 `go.mod` (+2 -1) 📝 `go.sum` (+2 -0) ➕ `iface/device_wrapper.go` (+90 -0) ➕ `iface/device_wrapper_test.go` (+216 -0) 📝 `iface/iface.go` (+15 -0) _...and 5 more files_ </details> ### 📄 Description ## Describe your changes Add TUN device wrapper and userspace packet filter to use it as firewall manager for ACL controller. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [x] 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:22 -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#13058