From d7ebd07183a3e41f9aaf9ae269bdfc80a32e60bf Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 11 Feb 2025 04:47:51 +0000 Subject: [PATCH] fix(linux): check for correct sign of netlink error code (#8087) We've previously tried to handle the "No such process" error from netlink when it tries to remove a route that no longer exists. What we failed to do is use the correct sign for the error code as netlink errors are always negative, yet when printed, the are positive numbers. --- rust/bin-shared/src/tun_device_manager/linux.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/bin-shared/src/tun_device_manager/linux.rs b/rust/bin-shared/src/tun_device_manager/linux.rs index d5584076f..0acd12d21 100644 --- a/rust/bin-shared/src/tun_device_manager/linux.rs +++ b/rust/bin-shared/src/tun_device_manager/linux.rs @@ -287,7 +287,7 @@ async fn remove_route(route: &IpNetwork, idx: u32, handle: &Handle) { // "No such process" is another version of "route does not exist". // See . - if matches!(&err, NetlinkError(err) if err.raw_code() == ESRCH) { + if matches!(&err, NetlinkError(err) if err.raw_code() == -ESRCH) { return; }