[PR #5837] [MERGED] [management] Reconcile IPv6 addresses on group membership changes #24085

Open
opened 2026-08-05 06:08:14 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

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

Base: proto-ipv6-overlayHead: mgmt-ipv6-group-assignment


📝 Commits (1)

  • 70fe227 Reconcile IPv6 addresses on group membership changes

📊 Changes

5 files changed (+248 additions, -42 deletions)

View changed files

📝 management/server/account.go (+65 -13)
📝 management/server/account_test.go (+5 -5)
📝 management/server/group.go (+47 -24)
management/server/group_ipv6_test.go (+125 -0)
📝 management/server/user.go (+6 -0)

📄 Description

Describe your changes

IPv6 overlay addresses were only assigned/removed in AddPeer (first registration) and SaveAccountSettings (when admin changes IPv6 settings). If a peer was added to or removed from an IPv6-enabled group after registration, its IPv6 address was never updated.

  • Add reconcileIPv6ForGroupChanges that checks if changed group IDs overlap with IPv6EnabledGroups, and if so runs the existing full updatePeerIPv6Addresses reconciliation
  • Wire it into all group membership mutation paths: UpdateGroup, UpdateGroups, GroupAddPeer, GroupDeletePeer, DeleteGroups, propagateUserGroupMemberships, SyncUserJWTGroups, and user auto-group changes
  • Change propagateUserGroupMemberships from standalone function to method on DefaultAccountManager so it can call the reconciler
  • Fix append aliasing bug in SyncUserJWTGroups and processUserUpdate where append(removedGroups, addedGroups...) could mutate the first slice

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)

Summary by CodeRabbit

  • Improvements
    • IPv6 address management is now automatically synchronized when group memberships change, ensuring consistent address assignment and removal.
    • IPv6-enabled groups properly reconcile peer IPv6 addresses during all group operations, including adding/removing peers and updating group configurations.
    • Enhanced handling of IPv6 addresses across user group updates.

🔄 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/5837 **Author:** [@lixmal](https://github.com/lixmal) **Created:** 4/9/2026 **Status:** ✅ Merged **Merged:** 4/9/2026 **Merged by:** [@lixmal](https://github.com/lixmal) **Base:** `proto-ipv6-overlay` ← **Head:** `mgmt-ipv6-group-assignment` --- ### 📝 Commits (1) - [`70fe227`](https://github.com/netbirdio/netbird/commit/70fe2275c0686388538024f212a297e9724f9076) Reconcile IPv6 addresses on group membership changes ### 📊 Changes **5 files changed** (+248 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `management/server/account.go` (+65 -13) 📝 `management/server/account_test.go` (+5 -5) 📝 `management/server/group.go` (+47 -24) ➕ `management/server/group_ipv6_test.go` (+125 -0) 📝 `management/server/user.go` (+6 -0) </details> ### 📄 Description ## Describe your changes IPv6 overlay addresses were only assigned/removed in AddPeer (first registration) and SaveAccountSettings (when admin changes IPv6 settings). If a peer was added to or removed from an IPv6-enabled group after registration, its IPv6 address was never updated. - Add `reconcileIPv6ForGroupChanges` that checks if changed group IDs overlap with IPv6EnabledGroups, and if so runs the existing full `updatePeerIPv6Addresses` reconciliation - Wire it into all group membership mutation paths: UpdateGroup, UpdateGroups, GroupAddPeer, GroupDeletePeer, DeleteGroups, propagateUserGroupMemberships, SyncUserJWTGroups, and user auto-group changes - Change `propagateUserGroupMemberships` from standalone function to method on DefaultAccountManager so it can call the reconciler - Fix `append` aliasing bug in SyncUserJWTGroups and processUserUpdate where `append(removedGroups, addedGroups...)` could mutate the first slice ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] 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) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * IPv6 address management is now automatically synchronized when group memberships change, ensuring consistent address assignment and removal. * IPv6-enabled groups properly reconcile peer IPv6 addresses during all group operations, including adding/removing peers and updating group configurations. * Enhanced handling of IPv6 addresses across user group updates. <!-- 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:08:14 -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#24085