MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / mtu

Method mtu

net_util/src/tap.rs:422–434  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

420
421 #[cfg(not(fuzzing))]
422 pub fn mtu(&self) -> Result<i32> {
423 let sock = create_unix_socket().map_err(Error::NetUtil)?;
424
425 let ifreq = self.get_ifreq();
426
427 // SAFETY: ioctl is safe. Called with a valid sock fd, and we check the return.
428 unsafe { Self::ioctl_with_ref(&sock, libc::SIOCGIFMTU as c_ulong, &ifreq)? };
429
430 // SAFETY: access a union field
431 let mtu = unsafe { ifreq.ifr_ifru.ifru_mtu };
432
433 Ok(mtu)
434 }
435
436 #[cfg(fuzzing)]
437 pub fn mtu(&self) -> Result<i32> {

Callers 1

new_with_tapMethod · 0.80

Calls 2

create_unix_socketFunction · 0.85
get_ifreqMethod · 0.80

Tested by

no test coverage detected