[client] Restart engine when peer IP address changes#5614
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughDetects when the WireGuard interface IP differs from the new config and triggers a client restart: logs the restart, wraps Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@client/internal/engine.go`:
- Around line 993-997: The restart path currently nulls out the wrapped error
and returns nil, allowing updateNetworkMap to continue; change the branch so it
returns the non-nil wrapped error instead of nil: return the result of
CtxGetState(e.ctx).Wrap(ErrResetConnection) after calling e.clientCancel()
(i.e., do not assign to `_`), so the caller (updateNetworkMap) short-circuits
further processing when e.clientCancel() is invoked.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|



Describe your changes
When management reallocates peer IPs (e.g. after a network range change), the client now restarts the engine instead of just logging the change. The firewall, route manager, and other components cache the old address, so a restart is needed for the new IP to take effect.
Uses the same
ErrResetConnection+clientCancel()pattern as the network monitor and interface monitor restarts.Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
Not needed: no user-facing API or configuration change.
Summary by CodeRabbit