Skip to content

Commit e6dd013

Browse files
authored
Merge pull request #839 from blechschmidt/main
Support TUNSETIFF on MIPS, PPC and SPARC
2 parents 28a5dd1 + 47c9a59 commit e6dd013

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/phy/sys/linux.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,22 @@ pub const SIOCGIFINDEX: libc::c_ulong = 0x8933;
55
pub const ETH_P_ALL: libc::c_short = 0x0003;
66
pub const ETH_P_IEEE802154: libc::c_short = 0x00F6;
77

8-
pub const TUNSETIFF: libc::c_ulong = 0x400454CA;
8+
// Constant definition as per
9+
// https://github.com/golang/sys/blob/master/unix/zerrors_linux_<arch>.go
10+
pub const TUNSETIFF: libc::c_ulong = if cfg!(any(
11+
target_arch = "mips",
12+
target_arch = "mips64",
13+
target_arch = "mips64el",
14+
target_arch = "mipsel",
15+
target_arch = "powerpc",
16+
target_arch = "powerpc64",
17+
target_arch = "powerpc64le",
18+
target_arch = "sparc64"
19+
)) {
20+
0x800454CA
21+
} else {
22+
0x400454CA
23+
};
924
pub const IFF_TUN: libc::c_int = 0x0001;
1025
pub const IFF_TAP: libc::c_int = 0x0002;
1126
pub const IFF_NO_PI: libc::c_int = 0x1000;

0 commit comments

Comments
 (0)