Fix tracked routes being collapsed by incomplete comparison - #41393
Fix tracked routes being collapsed by incomplete comparison#41393Feng Wang (chemwolf6922) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes mirrored route tracking dropping distinct routes by correcting TrackedRoute’s std::set ordering: route-class precedence is preserved, but route identity now uses the full EndpointRoute comparison (including prefix length and next hop).
Changes:
- Update
TrackedRoute::operator<to compare by route class first, then by fullEndpointRouteordering. - Add a regression test covering route identity (prefix length, next hop, metric, duplicates) and route-class ordering.
- Update test build include paths to access the tracked-route definitions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/windows/NetworkTests.cpp | Adds TrackedRouteOrderingPreservesRouteIdentity regression test for route identity + class ordering. |
| test/windows/CMakeLists.txt | Adds an include path so tests can include WslCoreTcpIpStateTracking.h. |
| src/windows/service/exe/WslCoreTcpIpStateTracking.h | Fixes TrackedRoute ordering to avoid collapsing distinct routes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
test/windows/CMakeLists.txt:39
- Using a per-source INCLUDE_DIRECTORIES property is unusual in this repo and can be fragile with CMake features like UNITY_BUILD (the unity translation unit may not inherit source-specific include dirs consistently). Prefer adding the directory to the target include paths instead, and remove the source-level property so NetworkTests.cpp builds the same way in all configurations.
target_include_directories(wsltests PRIVATE
${CMAKE_SOURCE_DIR}/src/windows/WslcSDK
${CMAKE_BINARY_DIR}/src/windows/WslcSDK/winrt/${TARGET_PLATFORM}/${CMAKE_BUILD_TYPE})
set_property(SOURCE NetworkTests.cpp APPEND PROPERTY INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/src/windows/service/exe)
|
Hi Blue (@OneBlue) , Keith Horton (@keith-horton) . This may need review from you as well. Please help take a look. Thanks. |
|
thanks for finding this, just curious - was this found via code inspection or based on some github report? |
Summary of the Pull Request
Mirrored route tracking used an incomplete comparator that considered only route class, destination address, and metric. Distinct routes with different prefix lengths or next hops could therefore be treated as equivalent and silently omitted.
The fix preserves the existing route-class ordering while using the complete
EndpointRoutecomparison for route identity. Regression tests cover prefix length, next hop, metric, exact duplicates, and dependency ordering.PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Add test:
NetworkTests::NetworkTests::TrackedRouteOrderingPreservesRouteIdentity