summaryrefslogtreecommitdiffhomepage
path: root/talpid-net/src
diff options
context:
space:
mode:
authorJoakim Hulthe <joakim.hulthe@mullvad.net>2025-02-10 17:19:11 +0100
committerJoakim Hulthe <joakim.hulthe@mullvad.net>2025-02-25 13:37:30 +0100
commit2bbc8650b3c80af5c27eff1e404eb4e5f52308da (patch)
tree1006925198f1bd9f91fe3e1a56a448953a67891c /talpid-net/src
parentd145fa8249bda15cc4a45e978a5275bb14aecf98 (diff)
downloadmullvadvpn-2bbc8650b3c80af5c27eff1e404eb4e5f52308da.tar.xz
mullvadvpn-2bbc8650b3c80af5c27eff1e404eb4e5f52308da.zip
Add safety comments to talpid_net::unix
Diffstat (limited to 'talpid-net/src')
-rw-r--r--talpid-net/src/unix.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/talpid-net/src/unix.rs b/talpid-net/src/unix.rs
index ef2bfdeb27..3843968157 100644
--- a/talpid-net/src/unix.rs
+++ b/talpid-net/src/unix.rs
@@ -21,6 +21,7 @@ pub fn set_mtu(interface_name: &str, mtu: u16) -> Result<(), io::Error> {
Some(socket2::Protocol::TCP),
)?;
+ // SAFETY: ifreq is a C struct, these can safely be zeroed.
let mut ifr: libc::ifreq = unsafe { std::mem::zeroed() };
if interface_name.len() >= ifr.ifr_name.len() {
return Err(io::Error::new(
@@ -55,6 +56,7 @@ pub fn get_mtu(interface_name: &str) -> Result<u16, io::Error> {
Some(socket2::Protocol::TCP),
)?;
+ // SAFETY: ifreq is a C struct, these can safely be zeroed.
let mut ifr: libc::ifreq = unsafe { std::mem::zeroed() };
if interface_name.len() >= ifr.ifr_name.len() {
return Err(io::Error::new(