summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoakim Hulthe <joakim.hulthe@mullvad.net>2025-02-13 13:57:24 +0100
committerJoakim Hulthe <joakim.hulthe@mullvad.net>2025-02-25 13:37:40 +0100
commit980b0a0758d91549cf6112fe0938bb41923a1e16 (patch)
treef4a5de3a50cdaa78decd69faddd5abf51f6191a0
parent1f61549dcfcb25f99ffc445caec0764255f46da1 (diff)
downloadmullvadvpn-980b0a0758d91549cf6112fe0938bb41923a1e16.tar.xz
mullvadvpn-980b0a0758d91549cf6112fe0938bb41923a1e16.zip
Fix safety comments in talpid_core::split_tunnel::macos::bpf
-rw-r--r--talpid-core/src/split_tunnel/macos/bpf.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/talpid-core/src/split_tunnel/macos/bpf.rs b/talpid-core/src/split_tunnel/macos/bpf.rs
index 566cc1f56b..53d3d36fbe 100644
--- a/talpid-core/src/split_tunnel/macos/bpf.rs
+++ b/talpid-core/src/split_tunnel/macos/bpf.rs
@@ -132,16 +132,17 @@ impl Bpf {
return Err(Error::InterfaceNameTooLong);
}
+ // SAFETY: `name_bytes` cannot exceed the size of `ifr_name`
unsafe {
- // SAFETY: `name_bytes` cannot exceed the size of `ifr_name`
std::ptr::copy_nonoverlapping(
name_bytes.as_ptr(),
&mut ifr.ifr_name as *mut _ as *mut _,
name_bytes.len(),
- );
- // SAFETY: The fd is valid for the lifetime of `self`, and `ifr` has a valid interface
- ioctl!(self.file.as_raw_fd(), BIOCSETIF, &ifr)
- }
+ )
+ };
+
+ // SAFETY: The fd is valid for the lifetime of `self`, and `ifr` has a valid interface
+ unsafe { ioctl!(self.file.as_raw_fd(), BIOCSETIF, &ifr) }
}
/// Enable or disable immediate mode (BIOCIMMEDIATE)