[PR #5174] [MERGED] [client] Refactor/optimise raw socket headers #22264

Closed
opened 2026-08-05 06:05:45 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5174
Author: @pappz
Created: 1/24/2026
Status: Merged
Merged: 1/28/2026
Merged by: @pappz

Base: mainHead: refactor/optimise-raw-socket-headers


📝 Commits (7)

  • c8fffe0 Add IPv6 support to UDP WireGuard proxy
  • 7cb6947 Add IPv6 support to eBPF WireGuard proxy
  • 4c04fe8 Refactor eBPF WireGuard proxy to use reusable PacketHeaders for efficient packet handling
  • 57d02f6 Deduplicate local constants and serialization options in eBPF proxy and wrapper.
  • 03fe093 Merge branch 'main' into refactor/optimise-raw-socket-headers
  • b01df80 Validate raw connection availability in eBPF WireGuard proxy before packet handling.
  • 26650ab Ensure raw connection consistency in eBPF proxy Work method

📊 Changes

2 files changed (+147 additions, -78 deletions)

View changed files

📝 client/iface/wgproxy/ebpf/proxy.go (+0 -72)
📝 client/iface/wgproxy/ebpf/wrapper.go (+147 -6)

📄 Description

Describe your changes

Pre-create and reuse packet headers to eliminate per-packet allocations.

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)

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

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Refactor
    • Improved packet header management and per-endpoint header preparation for more reliable UDP packet transmission.
    • Enhanced IPv4/IPv6 raw socket selection and packet serialization for more consistent sending behavior.
    • Removed legacy packet serialization path, simplifying and streamlining internal transmission flow.

✏️ Tip: You can customize this high-level summary in your review settings.


🔄 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/5174 **Author:** [@pappz](https://github.com/pappz) **Created:** 1/24/2026 **Status:** ✅ Merged **Merged:** 1/28/2026 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `refactor/optimise-raw-socket-headers` --- ### 📝 Commits (7) - [`c8fffe0`](https://github.com/netbirdio/netbird/commit/c8fffe0a758459f2fcded3d7e536f17f058e5877) Add IPv6 support to UDP WireGuard proxy - [`7cb6947`](https://github.com/netbirdio/netbird/commit/7cb6947babafb422bf0a5af46362196704769097) Add IPv6 support to eBPF WireGuard proxy - [`4c04fe8`](https://github.com/netbirdio/netbird/commit/4c04fe8362b218282447913a706860a8e7829a21) Refactor eBPF WireGuard proxy to use reusable PacketHeaders for efficient packet handling - [`57d02f6`](https://github.com/netbirdio/netbird/commit/57d02f6c2c0c117a29722399cfbe7aa20fc81c51) Deduplicate local constants and serialization options in eBPF proxy and wrapper. - [`03fe093`](https://github.com/netbirdio/netbird/commit/03fe093568417635a6c8623ea71aabe91911b342) Merge branch 'main' into refactor/optimise-raw-socket-headers - [`b01df80`](https://github.com/netbirdio/netbird/commit/b01df80ab76d9d9cc6a1c6a2b78e77c4953dbb23) Validate raw connection availability in eBPF WireGuard proxy before packet handling. - [`26650ab`](https://github.com/netbirdio/netbird/commit/26650abe73ce7a263ab69df4f527bada687e0439) Ensure raw connection consistency in eBPF proxy Work method ### 📊 Changes **2 files changed** (+147 additions, -78 deletions) <details> <summary>View changed files</summary> 📝 `client/iface/wgproxy/ebpf/proxy.go` (+0 -72) 📝 `client/iface/wgproxy/ebpf/wrapper.go` (+147 -6) </details> ### 📄 Description ## Describe your changes Pre-create and reuse packet headers to eliminate per-packet allocations. ## 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) > 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). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Improved packet header management and per-endpoint header preparation for more reliable UDP packet transmission. * Enhanced IPv4/IPv6 raw socket selection and packet serialization for more consistent sending behavior. * Removed legacy packet serialization path, simplifying and streamlining internal transmission flow. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <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 06:05:45 -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#22264