[PR #5688] [MERGED] [client] Add IPv6 support to ACL manager, USP filter, and forwarder #26485

Open
opened 2026-08-05 07:07:24 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5688
Author: @lixmal
Created: 3/25/2026
Status: Merged
Merged: 4/9/2026
Merged by: @lixmal

Base: proto-ipv6-overlayHead: client-ipv6-acl-usp


📝 Commits (10+)

  • 133f004 Add IPv6 support to ACL manager, USP filter, and forwarder
  • 780fd66 Fix review findings: v6 block rule, PMTUD, eBPF typed IP, tracer validation
  • 569244a Merge branch 'client-ipv6-ssh-netflow' into client-ipv6-acl-usp
  • 7fe417c Merge branch 'client-ipv6-ssh-netflow' into client-ipv6-acl-usp
  • 5e1cdd7 Fix localip bitmap aliasing and bench test indentation
  • aebf3ce Merge branch 'client-ipv6-ssh-netflow' into client-ipv6-acl-usp
  • 76414a1 Merge branch 'client-ipv6-ssh-netflow' into client-ipv6-acl-usp
  • fcf8c4b Handle ICMP directly in forwarder, bypassing gVisor network layer
  • ed5cfa6 Fix CodeRabbit findings: fragment guard, v6 raw socket probe, v6 echo logging
  • 974ea1f Merge remote-tracking branch 'origin/proto-ipv6-overlay' into client-ipv6-acl-usp

📊 Changes

78 files changed (+3603 additions, -1068 deletions)

View changed files

📝 client/android/client.go (+60 -19)
📝 client/android/route_command.go (+5 -2)
📝 client/anonymize/anonymize.go (+9 -2)
📝 client/anonymize/anonymize_test.go (+7 -7)
📝 client/cmd/ssh.go (+2 -2)
📝 client/cmd/ssh_test.go (+2 -2)
📝 client/firewall/iptables/acl_linux.go (+28 -3)
📝 client/firewall/iptables/manager_linux.go (+210 -26)
📝 client/firewall/iptables/router_linux.go (+50 -18)
📝 client/firewall/iptables/rule.go (+1 -0)
📝 client/firewall/iptables/state_linux.go (+30 -0)
📝 client/firewall/nftables/acl_linux.go (+18 -26)
client/firewall/nftables/addr_family_linux.go (+81 -0)
📝 client/firewall/nftables/manager_linux.go (+258 -29)
📝 client/firewall/nftables/manager_linux_test.go (+124 -0)
📝 client/firewall/nftables/router_linux.go (+104 -61)
📝 client/firewall/nftables/router_linux_test.go (+186 -3)
📝 client/firewall/uspfilter/allow_netbird_windows.go (+38 -15)
📝 client/firewall/uspfilter/conntrack/common.go (+5 -2)
📝 client/firewall/uspfilter/conntrack/icmp.go (+62 -21)

...and 58 more files

📄 Description

Describe your changes

  • ACL manager: read SourcePrefixes from firewall rules (compact bytes), fall back to deprecated PeerIP for old management. Accumulate errors instead of rolling back on first failure.
  • USP filter: dual-parser decoder (v4/v6 selected by version nibble), ICMPv6 conntrack with echo type mapping, cross-family ICMP rule matching, IPv6 fragment detection, TCP MSS clamping with v6 pseudo-header
  • USP filter DNAT: rewriteIPv4/rewriteIPv6 split (v6 has no header checksum), updateICMPv6Checksum with pseudo-header, zero-alloc extractPacketIPs
  • USP forwarder: dual-stack gvisor NIC, ICMPv6 echo handling via ping6, proper [v6]:port formatting
  • Local IP manager: lock-free atomic snapshot with v4 bitmap + v6 map
  • Refactor: consolidate splitAllowedIPs/extractPeerIPs into overlayAddrsFromAllowedIPs returning typed netip.Addr
  • Tests for IPv6 peer ACL filtering, route ACL matching, and local IP detection

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

  • New Features

    • Full dual-stack IPv4/IPv6 support across firewall, NAT, routing, forwarding, and peer/route ACLs.
    • ICMPv6 support with echo handling, reply synthesis, and IPv6-aware ping selection.
  • Behavior Changes

    • Separate TCP MSS clamping for IPv4 vs IPv6.
    • Event/flow reporting and connection tracking now correctly handle IPv4 and IPv6.
    • ICMP error handling extended to ICMPv6.
  • Performance

    • Lock-free local IP snapshot for faster membership checks.
  • Tests

    • Added IPv6-focused tests and benchmarks for ACLs, NAT, forwarding, and local IP checks.

🔄 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/5688 **Author:** [@lixmal](https://github.com/lixmal) **Created:** 3/25/2026 **Status:** ✅ Merged **Merged:** 4/9/2026 **Merged by:** [@lixmal](https://github.com/lixmal) **Base:** `proto-ipv6-overlay` ← **Head:** `client-ipv6-acl-usp` --- ### 📝 Commits (10+) - [`133f004`](https://github.com/netbirdio/netbird/commit/133f00408633686499c993c4e828c902c07f69d4) Add IPv6 support to ACL manager, USP filter, and forwarder - [`780fd66`](https://github.com/netbirdio/netbird/commit/780fd66dd74d093fbdf1cb81f96d11d20a1e8649) Fix review findings: v6 block rule, PMTUD, eBPF typed IP, tracer validation - [`569244a`](https://github.com/netbirdio/netbird/commit/569244a59c591d0213a0f9c6b9fd13e301ab28ba) Merge branch 'client-ipv6-ssh-netflow' into client-ipv6-acl-usp - [`7fe417c`](https://github.com/netbirdio/netbird/commit/7fe417c6b4e4eef20cd1e9ce9eea971639e0da47) Merge branch 'client-ipv6-ssh-netflow' into client-ipv6-acl-usp - [`5e1cdd7`](https://github.com/netbirdio/netbird/commit/5e1cdd7d367d1ea3b792a8719b9804ffe61db3ee) Fix localip bitmap aliasing and bench test indentation - [`aebf3ce`](https://github.com/netbirdio/netbird/commit/aebf3ceb4089f81fbbbf5c1d11f1709aa0e326ad) Merge branch 'client-ipv6-ssh-netflow' into client-ipv6-acl-usp - [`76414a1`](https://github.com/netbirdio/netbird/commit/76414a1061ee7839032c852201e6c455e23ae3c3) Merge branch 'client-ipv6-ssh-netflow' into client-ipv6-acl-usp - [`fcf8c4b`](https://github.com/netbirdio/netbird/commit/fcf8c4b30ee700e072999af75fad1efc88296595) Handle ICMP directly in forwarder, bypassing gVisor network layer - [`ed5cfa6`](https://github.com/netbirdio/netbird/commit/ed5cfa6dc57177cb60a85527592f919516b54481) Fix CodeRabbit findings: fragment guard, v6 raw socket probe, v6 echo logging - [`974ea1f`](https://github.com/netbirdio/netbird/commit/974ea1fb094daf9879e859071ee7c345f9086640) Merge remote-tracking branch 'origin/proto-ipv6-overlay' into client-ipv6-acl-usp ### 📊 Changes **78 files changed** (+3603 additions, -1068 deletions) <details> <summary>View changed files</summary> 📝 `client/android/client.go` (+60 -19) 📝 `client/android/route_command.go` (+5 -2) 📝 `client/anonymize/anonymize.go` (+9 -2) 📝 `client/anonymize/anonymize_test.go` (+7 -7) 📝 `client/cmd/ssh.go` (+2 -2) 📝 `client/cmd/ssh_test.go` (+2 -2) 📝 `client/firewall/iptables/acl_linux.go` (+28 -3) 📝 `client/firewall/iptables/manager_linux.go` (+210 -26) 📝 `client/firewall/iptables/router_linux.go` (+50 -18) 📝 `client/firewall/iptables/rule.go` (+1 -0) 📝 `client/firewall/iptables/state_linux.go` (+30 -0) 📝 `client/firewall/nftables/acl_linux.go` (+18 -26) ➕ `client/firewall/nftables/addr_family_linux.go` (+81 -0) 📝 `client/firewall/nftables/manager_linux.go` (+258 -29) 📝 `client/firewall/nftables/manager_linux_test.go` (+124 -0) 📝 `client/firewall/nftables/router_linux.go` (+104 -61) 📝 `client/firewall/nftables/router_linux_test.go` (+186 -3) 📝 `client/firewall/uspfilter/allow_netbird_windows.go` (+38 -15) 📝 `client/firewall/uspfilter/conntrack/common.go` (+5 -2) 📝 `client/firewall/uspfilter/conntrack/icmp.go` (+62 -21) _...and 58 more files_ </details> ### 📄 Description ## Describe your changes - ACL manager: read `SourcePrefixes` from firewall rules (compact bytes), fall back to deprecated `PeerIP` for old management. Accumulate errors instead of rolling back on first failure. - USP filter: dual-parser decoder (v4/v6 selected by version nibble), ICMPv6 conntrack with echo type mapping, cross-family ICMP rule matching, IPv6 fragment detection, TCP MSS clamping with v6 pseudo-header - USP filter DNAT: `rewriteIPv4`/`rewriteIPv6` split (v6 has no header checksum), `updateICMPv6Checksum` with pseudo-header, zero-alloc `extractPacketIPs` - USP forwarder: dual-stack gvisor NIC, ICMPv6 echo handling via ping6, proper `[v6]:port` formatting - Local IP manager: lock-free atomic snapshot with v4 bitmap + v6 map - Refactor: consolidate `splitAllowedIPs`/`extractPeerIPs` into `overlayAddrsFromAllowedIPs` returning typed `netip.Addr` - Tests for IPv6 peer ACL filtering, route ACL matching, and local IP detection ## Issue ticket number and link ## Stack - #5631 - #5675 - #5686 - #5687 - #5688 :point_left: - #5706 - #5707 - #5708 ### 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) > 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 - **New Features** - Full dual-stack IPv4/IPv6 support across firewall, NAT, routing, forwarding, and peer/route ACLs. - ICMPv6 support with echo handling, reply synthesis, and IPv6-aware ping selection. - **Behavior Changes** - Separate TCP MSS clamping for IPv4 vs IPv6. - Event/flow reporting and connection tracking now correctly handle IPv4 and IPv6. - ICMP error handling extended to ICMPv6. - **Performance** - Lock-free local IP snapshot for faster membership checks. - **Tests** - Added IPv6-focused tests and benchmarks for ACLs, NAT, forwarding, and local IP checks. <!-- 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 07:07:24 -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#26485