From 11d5305d8c6a9f9a9d5b64a86564e996fa60b56d Mon Sep 17 00:00:00 2001 From: "E. Kaparulin" Date: Sat, 25 Jul 2026 18:00:40 +0300 Subject: [PATCH] chore: sync konduit-platform v0.1.0-beta.11 --- konduit-platform/src/routes/linux.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/konduit-platform/src/routes/linux.rs b/konduit-platform/src/routes/linux.rs index 6e2429d..51eab52 100644 --- a/konduit-platform/src/routes/linux.rs +++ b/konduit-platform/src/routes/linux.rs @@ -90,6 +90,14 @@ impl RouteManager { // Collect all default-route gateways with their metrics. // VPN default routes have low metric (50); physical/DHCP routes have high metric (600+). // We want the physical gateway, so take the one with the highest metric. + // + // The metric comparison alone is not reliable: the kernel does not always + // round-trip the Priority attribute on route dumps (see the Oif-based match + // in suspend_default_route() below, which exists for the same reason), and a + // leftover default route on a reused tun ifindex from an imperfectly torn + // down previous session can win the metric comparison by accident. Since we + // already know our own tun interface's index at this point, exclude it + // outright rather than trusting metric alone to steer around it. let mut candidates: Vec<(u32, Ipv4Addr, u32)> = Vec::new(); while let Some(route) = routes.try_next().await? { @@ -110,6 +118,9 @@ impl RouteManager { } } if let (Some(gw), Some(idx)) = (gateway, oif) { + if Some(idx) == self.tun_index { + continue; + } candidates.push((metric, gw, idx)); } }