Handle Linux failures from GNS callbacks - #41396
Handle Linux failures from GNS callbacks#41396Shawn Yuan (shuaiyuanxx) wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates mirrored networking’s GNS callback handling so that a successful transport HRESULT is no longer treated as a successful operation when Linux reports a nonzero result code, aligning Windows-side success/failure with actual guest configuration outcomes.
Changes:
- Add a shared helper (
GetGnsCallbackResult) to combine the transportHRESULTand Linux result code with aConnectTestexception. - Update the mirrored networking GNS callback to use the helper’s combined result.
- Add unit/regression tests covering key transport/Linux result combinations, including
ConnectTest.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/windows/common/WslCoreNetworkingSupport.h |
Introduces the shared helper for determining the effective callback HRESULT from transport + Linux result. |
src/windows/service/exe/MirroredNetworking.cpp |
Uses the shared helper to return failure when Linux reports nonzero for non-ConnectTest messages. |
test/windows/NetworkTests.cpp |
Adds tests validating the helper’s semantics across transport/Linux result combinations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Blue (OneBlue)
left a comment
There was a problem hiding this comment.
This a change behavior from the previous implementation, which doesn't retry when an failed HRESULT is returned.
I'm not sure that it makes sense to retry in that case. If the socket is closed for instance, retrying for 3 seconds would only delay a potential shutdown.
Summary of the Pull Request
Propagates nonzero Linux GNS results as callback failures instead of treating a successful transport as a successful network configuration operation.
The change preserves transport failures and the special
ConnectTestresult semantics, and adds regression tests for all result combinations.PR Checklist
Detailed Description of the Pull Request / Additional comments
GNS callbacks provide two independent results:
HRESULT, indicating whether communication with Linux succeeded;Previously, the callback returned only the transport
HRESULT. If communication succeeded but Linux failed to apply an address,route, interface, or DNS update, the operation was reported as successful. This could cause Windows to mark the configuration as
synchronized and stop retrying it.
This change combines the two results for ordinary GNS requests:
HRESULT;ConnectTestremains exempt because its nonzero result is connectivity status data, not an operation failure.The result handling is implemented in a shared helper so production code and regression tests use the same logic.
Validation Steps Performed