From ffa729c3e21d59508de77ff2f9a695bc8c29af19 Mon Sep 17 00:00:00 2001 From: Jakub Janowski Date: Mon, 2 Dec 2024 13:26:19 +0200 Subject: [PATCH] Always allow fwmark in uapi commands Allow fwmark to be in the config even on platforms that do not support it. Just ignore it. It is in line with wireguard-go behaviour. --- neptun/src/device/api.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/neptun/src/device/api.rs b/neptun/src/device/api.rs index 7d33736..8ffdaae 100644 --- a/neptun/src/device/api.rs +++ b/neptun/src/device/api.rs @@ -230,17 +230,19 @@ fn api_set(reader: &mut BufReader, d: &mut LockReadGuard) -> }, Err(_) => return EINVAL, }, - #[cfg(any( - target_os = "android", - target_os = "fuchsia", - target_os = "linux" - ))] - "fwmark" => match val.parse::() { - Ok(mark) => match device.set_fwmark(mark) { - Ok(()) => {} - Err(_) => return EADDRINUSE, - }, - Err(_) => return EINVAL, + "fwmark" => { + #[cfg(any( + target_os = "android", + target_os = "fuchsia", + target_os = "linux" + ))] + match val.parse::() { + Ok(mark) => match device.set_fwmark(mark) { + Ok(()) => {} + Err(_) => return EADDRINUSE, + }, + Err(_) => return EINVAL, + } }, "replace_peers" => match val.parse::() { Ok(true) => device.clear_peers(),