Merged
Conversation
moubctez
reviewed
Mar 3, 2026
Co-authored-by: Adam <adam@defguard.net>
moubctez
previously approved these changes
Mar 3, 2026
There was a problem hiding this comment.
Pull request overview
Updates DefGuard’s WireGuard location/network address modification flow so admins can change the VPN network while devices exist, and the system will reassign device IPs that no longer fit the updated network (issue #2112), with additional optimization work and tests.
Changes:
- Allow updating a location’s network address while devices exist and show a UI warning about address rewrites.
- Optimize IP assignment by precomputing “used IPs” and passing them through assignment paths; add
all_used_ips_for_network. - Update/adjust tests for the new “network update succeeds” behavior and add new assignment tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| web/src/pages/EditLocationPage/EditLocationPage.tsx | Shows a new warning and allows editing the gateway/network address even when devices exist. |
| web/messages/en/location.json | Adds new warning copy for address rewrite behavior. |
| tools/defguard_generator/src/vpn_session_stats.rs | Uses precomputed used_ips when auto-assigning device IPs during stats generation. |
| crates/defguard_core/tests/integration/api/wireguard.rs | Updates the network address reassignment integration test expectations. |
| crates/defguard_core/src/location_management/mod.rs | Uses used_ips to speed up reassignment during allowed-device sync. |
| crates/defguard_core/src/lib.rs | Updates dev env init to pass used_ips into assignment. |
| crates/defguard_core/src/handlers/wireguard.rs | Removes the server-side block that prevented network address changes when devices are assigned. |
| crates/defguard_common/src/db/models/wireguard.rs | Adds all_used_ips_for_network helper and threads used_ips through assignment helpers. |
| crates/defguard_common/src/db/models/device.rs | Updates assign_next_network_ip to use used_ips and adds tests around subnet changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wojcik91
previously approved these changes
Mar 4, 2026
wojcik91
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Involves: #2112