diff options
| author | David Lönnhager <david.l@mullvad.net> | 2025-01-13 13:36:57 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2025-01-24 17:35:03 +0100 |
| commit | 4752a1600c01f0ff89c07507104cd7df92ca70f1 (patch) | |
| tree | 88b263344043fe76979a1a9b298898f2d6e14ddb | |
| parent | 1874bbe83ae48c943f061639cfd505bab6c26b34 (diff) | |
| download | mullvadvpn-4752a1600c01f0ff89c07507104cd7df92ca70f1.tar.xz mullvadvpn-4752a1600c01f0ff89c07507104cd7df92ca70f1.zip | |
Don't include maybenot_ffi on Windows
| -rw-r--r-- | wireguard-go-rs/Cargo.toml | 1 | ||||
| -rw-r--r-- | wireguard-go-rs/src/lib.rs | 21 |
2 files changed, 2 insertions, 20 deletions
diff --git a/wireguard-go-rs/Cargo.toml b/wireguard-go-rs/Cargo.toml index b1388ab146..976b2bd6b1 100644 --- a/wireguard-go-rs/Cargo.toml +++ b/wireguard-go-rs/Cargo.toml @@ -16,6 +16,7 @@ zeroize = "1.8.1" # This is done, instead of using the makefile in wireguard-go to build maybenot-ffi into its archive, to prevent # name clashes induced by link-time optimization. # NOTE: the version of maybenot-ffi below must be the same as the version checked into the wireguard-go submodule +[target.'cfg(unix)'.dependencies] maybenot-ffi = "2.0.1" [target.'cfg(target_os = "windows")'.dependencies] diff --git a/wireguard-go-rs/src/lib.rs b/wireguard-go-rs/src/lib.rs index 4386c1f48a..037d17709d 100644 --- a/wireguard-go-rs/src/lib.rs +++ b/wireguard-go-rs/src/lib.rs @@ -32,7 +32,7 @@ pub type LoggingCallback = unsafe extern "system" fn(level: WgLogLevel, msg: *const c_char, context: LoggingContext); // Make symbols from maybenot-ffi visible to wireguard-go -#[cfg(daita)] +#[cfg(all(daita, unix))] use maybenot_ffi as _; /// A wireguard-go tunnel @@ -304,25 +304,6 @@ impl Drop for Tunnel { } } -/// Check whether `machines` contains a valid, LF-separated maybenot machines. Return an error -/// otherwise. -pub fn validate_maybenot_machines(machines: &CStr) -> Result<(), Error> { - use maybenot_ffi::MaybenotResult; - - let mut framework = MaybeUninit::uninit(); - // SAFETY: `machines` is a null-terminated string, and `&mut framework` is a valid pointer - let result = - unsafe { maybenot_ffi::maybenot_start(machines.as_ptr(), 0.0, 0.0, &mut framework) }; - - if result as u32 == MaybenotResult::Ok as u32 { - // SAFETY: `maybenot_start` succeeded, so `framework` points to a valid framework - unsafe { maybenot_ffi::maybenot_stop(framework.assume_init()) }; - Ok(()) - } else { - Err(Error::Other) - } -} - fn result_from_code(code: i32) -> Result<(), Error> { // NOTE: must be kept in sync with enum definition Err(match code { |
