[PR #911] [MERGED] Wg ebpf proxy #13134

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/911
Author: @pappz
Created: 5/30/2023
Status: Merged
Merged: 7/26/2023
Merged by: @mlsmaycon

Base: mainHead: wg_ebpf_proxy


📝 Commits (10+)

📊 Changes

28 files changed (+1117 additions, -379 deletions)

View changed files

📝 client/internal/engine.go (+15 -10)
📝 client/internal/engine_test.go (+2 -2)
📝 client/internal/peer/conn.go (+94 -69)
📝 client/internal/peer/conn_test.go (+27 -13)
client/internal/proxy/dummy.go (+0 -72)
client/internal/proxy/noproxy.go (+0 -42)
client/internal/proxy/proxy.go (+0 -35)
client/internal/proxy/wireguard.go (+0 -128)
client/internal/wgproxy/bpf/portreplace.c (+90 -0)
client/internal/wgproxy/bpf_bpfeb.go (+120 -0)
client/internal/wgproxy/bpf_bpfeb.o (+0 -0)
client/internal/wgproxy/bpf_bpfel.go (+120 -0)
client/internal/wgproxy/bpf_bpfel.o (+0 -0)
client/internal/wgproxy/factory.go (+20 -0)
client/internal/wgproxy/factory_linux.go (+19 -0)
client/internal/wgproxy/factory_nonlinux.go (+7 -0)
client/internal/wgproxy/loader.go (+80 -0)
client/internal/wgproxy/loader_test.go (+18 -0)
client/internal/wgproxy/portlookup.go (+32 -0)
client/internal/wgproxy/portlookup_test.go (+42 -0)

...and 8 more files

📄 Description

Describe your changes

EBPF proxy between TURN (relay) and WireGuard to reduce number of used ports used by the NetBird agent.

  • Separate the wg configuration from the proxy logic
  • In case if eBPF type proxy has only one single proxy instance
  • In case if the eBPF is not supported fallback to the original proxy Implementation

Between the signature of eBPF type proxy and original proxy has
differences so this is why the factory structure exists

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/911 **Author:** [@pappz](https://github.com/pappz) **Created:** 5/30/2023 **Status:** ✅ Merged **Merged:** 7/26/2023 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `wg_ebpf_proxy` --- ### 📝 Commits (10+) - [`9ad6585`](https://github.com/netbirdio/netbird/commit/9ad65857b06f15ae25fc0dad7b220fe28ee2e5a3) Remove unused dummy proxy - [`eba909b`](https://github.com/netbirdio/netbird/commit/eba909bd641c06c97074bcbc234ea88b88f16e86) Delete proxy package - [`ac4af65`](https://github.com/netbirdio/netbird/commit/ac4af65387e166adee7da62a54dbab53232a2ea2) Add ebpf based wg proxy - [`d12f371`](https://github.com/netbirdio/netbird/commit/d12f371afda28892a7f61badfb02ca204282cd46) - thread safe conn store - [`a010593`](https://github.com/netbirdio/netbird/commit/a0105932b919b61ae575b36282d3bf2e8be80f15) - Use cilium instead of iovisor - [`60405fb`](https://github.com/netbirdio/netbird/commit/60405fb237e977f293ca3328772e3c9ec413a92b) - Remove unused imports - [`4c64da5`](https://github.com/netbirdio/netbird/commit/4c64da515e37f55b3f2a2f05bb64b6f17c7606d4) - error handling - [`32688ee`](https://github.com/netbirdio/netbird/commit/32688ee1873e96490fc8c43af8f07b7949e14dba) change log text - [`f0a892d`](https://github.com/netbirdio/netbird/commit/f0a892dec0802b2ebf55648eaaf2d830e2e95d35) Add free port lookup for proxy - [`46c3e33`](https://github.com/netbirdio/netbird/commit/46c3e339b6e1271ef0e5f7a0fadc04762a0cfd39) Share the port settings with eBPF program ### 📊 Changes **28 files changed** (+1117 additions, -379 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/engine.go` (+15 -10) 📝 `client/internal/engine_test.go` (+2 -2) 📝 `client/internal/peer/conn.go` (+94 -69) 📝 `client/internal/peer/conn_test.go` (+27 -13) ➖ `client/internal/proxy/dummy.go` (+0 -72) ➖ `client/internal/proxy/noproxy.go` (+0 -42) ➖ `client/internal/proxy/proxy.go` (+0 -35) ➖ `client/internal/proxy/wireguard.go` (+0 -128) ➕ `client/internal/wgproxy/bpf/portreplace.c` (+90 -0) ➕ `client/internal/wgproxy/bpf_bpfeb.go` (+120 -0) ➕ `client/internal/wgproxy/bpf_bpfeb.o` (+0 -0) ➕ `client/internal/wgproxy/bpf_bpfel.go` (+120 -0) ➕ `client/internal/wgproxy/bpf_bpfel.o` (+0 -0) ➕ `client/internal/wgproxy/factory.go` (+20 -0) ➕ `client/internal/wgproxy/factory_linux.go` (+19 -0) ➕ `client/internal/wgproxy/factory_nonlinux.go` (+7 -0) ➕ `client/internal/wgproxy/loader.go` (+80 -0) ➕ `client/internal/wgproxy/loader_test.go` (+18 -0) ➕ `client/internal/wgproxy/portlookup.go` (+32 -0) ➕ `client/internal/wgproxy/portlookup_test.go` (+42 -0) _...and 8 more files_ </details> ### 📄 Description ## Describe your changes EBPF proxy between TURN (relay) and WireGuard to reduce number of used ports used by the NetBird agent. - Separate the wg configuration from the proxy logic - In case if eBPF type proxy has only one single proxy instance - In case if the eBPF is not supported fallback to the original proxy Implementation Between the signature of eBPF type proxy and original proxy has differences so this is why the factory structure exists ## Issue ticket number and link ### Checklist - [ ] 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 02:07:32 -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#13134