mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
net_gen: replace net_gen with libc
The libc crate provides all functionality provided by the net_gen crate. Removing the net_gen crate reduces the maintenance burden. The switch to libc required some fixes, most notably the switch from a `Vec<u8>` to a `CString` for the `net_util::Tap.if_name` field. On-behalf-of: SAP julian.schindel@sap.com Signed-off-by: Julian Schindel <julian.schindel@cyberus-technology.de>
This commit is contained in:
committed by
Rob Bradford
parent
3a56f20ee1
commit
2b28c5b15a
@@ -150,16 +150,16 @@ impl Emulator {
|
||||
|
||||
// SAFETY: FFI calls and return value of the unsafe call is checked
|
||||
unsafe {
|
||||
let tv = net_gen::iff::timeval {
|
||||
let tv = libc::timeval {
|
||||
tv_sec: 0,
|
||||
tv_usec: 100000, // Set recv timeout to 100ms
|
||||
};
|
||||
let ret = net_gen::setsockopt(
|
||||
let ret = libc::setsockopt(
|
||||
fds[0],
|
||||
net_gen::iff::SOL_SOCKET as i32,
|
||||
net_gen::iff::SO_RCVTIMEO as i32,
|
||||
libc::SOL_SOCKET,
|
||||
libc::SO_RCVTIMEO,
|
||||
&tv as *const _ as *const libc::c_void,
|
||||
std::mem::size_of::<net_gen::iff::timeval>() as u32,
|
||||
std::mem::size_of::<libc::timeval>() as u32,
|
||||
);
|
||||
if ret == -1 {
|
||||
return Err(Error::PrepareDataFd(anyhow!(
|
||||
|
||||
Reference in New Issue
Block a user