(&self)
| 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> { |
no test coverage detected