feat(client): report TAP interface identity

Resolve the opened TAP adapter's NetCfgInstanceId to its Windows interface
index and LUID during startup, then print those values with the existing TAP
MAC/MTU diagnostics. This makes the interface identity visible before the next
metric-setting slice uses it for route protection.

The lookup failure is treated as startup failure because an opened TAP adapter
that cannot be resolved as a Windows network interface is not a good candidate
for metric or route management.

Verification note: I attempted to check `lanparty-client-win` for
`x86_64-pc-windows-msvc`, but this host still lacks the Windows C headers
needed by `ring`; the build stops at `assert.h` before the binary crate can be
typechecked for Windows.

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

Refs: PLAN.md
This commit is contained in:
2026-05-21 19:17:17 +02:00
parent 432d1d08d1
commit 96bfbd0dbc
2 changed files with 11 additions and 2 deletions
+3 -2
View File
@@ -137,5 +137,6 @@ and then bridges Ethernet frames between the relay and the first TAP-Windows6
adapter until shutdown. adapter until shutdown.
`--virtual-mac` can still override the stored identity for manual testing. On `--virtual-mac` can still override the stored identity for manual testing. On
Windows it marks the TAP media connected and reports the driver MAC/MTU before Windows it marks the TAP media connected and reports the driver MAC/MTU before
forwarding frames. Default-route takeover neutralization and automatic TAP forwarding frames, along with the TAP interface index/LUID. Default-route
MAC/MTU configuration are not wired yet. takeover neutralization and automatic TAP MAC/MTU configuration are not wired
yet.
+8
View File
@@ -185,6 +185,9 @@ fn print_pinned_relay_route(route: &PinnedRelayRoute) {
fn open_tap_adapter(session: &ClientSession) -> Result<lanparty_client_tap::TapAdapter> { fn open_tap_adapter(session: &ClientSession) -> Result<lanparty_client_tap::TapAdapter> {
let tap = lanparty_client_tap::open_first_adapter()?; let tap = lanparty_client_tap::open_first_adapter()?;
tap.set_media_connected(true)?; tap.set_media_connected(true)?;
let tap_interface =
lanparty_client_route::interface_identity_from_guid(tap.info().instance_id())
.context("failed to resolve TAP interface identity")?;
let driver_mac = tap.driver_mac()?; let driver_mac = tap.driver_mac()?;
let driver_mtu = tap.driver_mtu()?; let driver_mtu = tap.driver_mtu()?;
@@ -198,6 +201,11 @@ fn open_tap_adapter(session: &ClientSession) -> Result<lanparty_client_tap::TapA
driver_mtu, driver_mtu,
session.welcome().effective_tap_mtu() session.welcome().effective_tap_mtu()
); );
println!(
"TAP interface index {} LUID {}",
tap_interface.index(),
tap_interface.luid()
);
if driver_mac != session.config().virtual_mac() { if driver_mac != session.config().virtual_mac() {
eprintln!( eprintln!(
"TAP driver MAC {} does not match tunnel identity {}; MAC configuration is not wired yet", "TAP driver MAC {} does not match tunnel identity {}; MAC configuration is not wired yet",