test(route): cover relay host-route pin matching

The Windows client protects the relay connection by pinning a host route before
activating TAP, then checking that the best route still matches that pinned
host route after TAP route policy changes. That predicate is part of the route
boundary, not the Windows binary's frame-pump logic.

Move the exact match check onto RouteSnapshot and cover the important mismatch
cases: default-route fallback, wrong next hop, wrong interface index/LUID, and
IPv6 on-link host routes. The Windows client keeps the same behavior but calls
the route-crate helper.

Test Plan:
- cargo fmt --check
- cargo test -p lanparty-client-route matches_pinned_host_route_identity
- cargo test -p lanparty-client-route matches_ipv6_on_link_pinned_host_route
- cargo test -p lanparty-client-route
- cargo test -p lanparty-client-win
- cargo test --workspace
- cargo clippy -p lanparty-client-route --all-targets -- -D warnings
- cargo clippy -p lanparty-client-win --all-targets -- -D warnings
- cargo clippy --workspace --all-targets -- -D warnings
- cargo check -p lanparty-client-route --target x86_64-pc-windows-msvc
- git diff --check
- git diff --cached --check

Refs: MVP relay-route protection
This commit is contained in:
2026-05-22 07:51:44 +02:00
parent 6bf23fff19
commit 81878133d2
3 changed files with 100 additions and 5 deletions
+6 -5
View File
@@ -436,11 +436,12 @@ fn verify_relay_route_is_pinned(
#[cfg(windows)]
fn relay_route_matches_pin(route: &RouteSnapshot, pin: &PinnedRelayRoute) -> bool {
route.destination() == pin.destination()
&& route.is_host_route_to(pin.destination())
&& route.next_hop() == pin.next_hop()
&& route.interface_index() == pin.interface_index()
&& route.interface_luid() == pin.interface_luid()
route.matches_pinned_host_route(
pin.destination(),
pin.next_hop(),
pin.interface_index(),
pin.interface_luid(),
)
}
#[cfg(windows)]