diff options
| -rw-r--r-- | talpid-core/src/split_tunnel/macos/bpf.rs | 11 |
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) |
