mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-11 17:17:54 +00:00
Cross-compilation and macOS compatibility fixes (#1)
- Ethernet ioctl: cfg-gate the ioctl request parameter type — c_int on musl, c_ulong on gnu — so the same code compiles on both x86_64-unknown-linux-gnu and x86_64-unknown-linux-musl targets - Chaos harness macOS support: replace direct host 'ip link' invocations with a privileged Docker container helper (--net=host --pid=host) that shares the Docker VM's namespaces, making veth pair setup work on both Linux and macOS (where host 'ip' is unavailable and container PIDs live inside the Docker Desktop VM) - Python 3.9 compat: add 'from __future__ import annotations' to docker_exec.py for X|Y union syntax support - Add deploy/ to .gitignore Co-authored-by: origami74 <origami74@gmail.com>
This commit is contained in:
@@ -329,7 +329,11 @@ fn get_mac_addr(fd: RawFd, if_index: i32) -> Result<[u8; 6], TransportError> {
|
||||
);
|
||||
}
|
||||
|
||||
let ret = unsafe { libc::ioctl(fd, libc::SIOCGIFHWADDR as libc::c_ulong, &ifr) };
|
||||
#[cfg(target_env = "musl")]
|
||||
let ioctl_req = libc::SIOCGIFHWADDR as libc::c_int;
|
||||
#[cfg(not(target_env = "musl"))]
|
||||
let ioctl_req = libc::SIOCGIFHWADDR as libc::c_ulong;
|
||||
let ret = unsafe { libc::ioctl(fd, ioctl_req, &ifr) };
|
||||
if ret < 0 {
|
||||
return Err(TransportError::StartFailed(format!(
|
||||
"ioctl(SIOCGIFHWADDR) failed: {}",
|
||||
@@ -375,7 +379,11 @@ fn get_if_mtu(fd: RawFd, if_index: i32) -> Result<u16, TransportError> {
|
||||
);
|
||||
}
|
||||
|
||||
let ret = unsafe { libc::ioctl(fd, libc::SIOCGIFMTU as libc::c_ulong, &ifr) };
|
||||
#[cfg(target_env = "musl")]
|
||||
let ioctl_req = libc::SIOCGIFMTU as libc::c_int;
|
||||
#[cfg(not(target_env = "musl"))]
|
||||
let ioctl_req = libc::SIOCGIFMTU as libc::c_ulong;
|
||||
let ret = unsafe { libc::ioctl(fd, ioctl_req, &ifr) };
|
||||
if ret < 0 {
|
||||
return Err(TransportError::StartFailed(format!(
|
||||
"ioctl(SIOCGIFMTU) failed: {}",
|
||||
|
||||
Reference in New Issue
Block a user