From e7cc0e5eef3021e0b413cfc6ecc9015fed558e57 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Wed, 25 Dec 2024 12:09:22 +0100 Subject: [PATCH] fix(linux): don't fail on unsupported IP version (#7583) Firezone always attempts to handle IPv4 and IPv6. On Linux systems without an IPv6 stack, attempts to add an IPv6 route may fail with "Not supported (os error 95)". We don't need the IPv6 routes on those systems as we will never receive IPv6 traffic. Therefore, we can safely ignore these errors and not log them. --- rust/bin-shared/src/tun_device_manager/linux.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust/bin-shared/src/tun_device_manager/linux.rs b/rust/bin-shared/src/tun_device_manager/linux.rs index d1d125490..7716d5f92 100644 --- a/rust/bin-shared/src/tun_device_manager/linux.rs +++ b/rust/bin-shared/src/tun_device_manager/linux.rs @@ -261,6 +261,11 @@ async fn add_route(route: &IpNetwork, idx: u32, handle: &Handle) { return; } + // On systems without support for a certain IP version (i.e. no IPv6), attempting to add a route may result in "Not supported (os error 95)". + if matches!(&err, NetlinkError(err) if err.raw_code() == -libc::EOPNOTSUPP) { + return; + } + tracing::warn!(error = std_dyn_err(&err), %route, "Failed to add route"); }