Skip to content

Commit

Permalink
Always allow fwmark in uapi commands
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jjanowsk committed Dec 2, 2024
1 parent 0bdd56b commit ffa729c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions neptun/src/device/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,19 @@ fn api_set<R: Read>(reader: &mut BufReader<R>, d: &mut LockReadGuard<Device>) ->
},
Err(_) => return EINVAL,
},
#[cfg(any(
target_os = "android",
target_os = "fuchsia",
target_os = "linux"
))]
"fwmark" => match val.parse::<u32>() {
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::<u32>() {
Ok(mark) => match device.set_fwmark(mark) {
Ok(()) => {}
Err(_) => return EADDRINUSE,
},
Err(_) => return EINVAL,
}
},
"replace_peers" => match val.parse::<bool>() {
Ok(true) => device.clear_peers(),
Expand Down

0 comments on commit ffa729c

Please sign in to comment.