Skip to content

Commit 0f4ae0b

Browse files
author
luozijun
committed
Add constants IFF_TUN, IFF_TAP and IFF_NO_PI on linux, android and fuchsia system
1 parent 9e8447d commit 0f4ae0b

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

libc-test/build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ fn main() {
265265
cfg.header("sys/fsuid.h");
266266
cfg.header("linux/seccomp.h");
267267
cfg.header("linux/if_ether.h");
268-
268+
cfg.header("linux/if_tun.h");
269269
// DCCP support
270270
if !uclibc && !musl && !emscripten {
271271
cfg.header("linux/dccp.h");
@@ -280,7 +280,6 @@ fn main() {
280280
cfg.header("linux/random.h");
281281
cfg.header("elf.h");
282282
cfg.header("link.h");
283-
cfg.header("linux/if_tun.h");
284283
cfg.header("spawn.h");
285284
}
286285

src/fuchsia/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,9 @@ pub const IFF_MULTICAST: ::c_int = 0x1000;
13511351
pub const IFF_PORTSEL: ::c_int = 0x2000;
13521352
pub const IFF_AUTOMEDIA: ::c_int = 0x4000;
13531353
pub const IFF_DYNAMIC: ::c_int = 0x8000;
1354+
pub const IFF_TUN: ::c_int = 0x0001;
1355+
pub const IFF_TAP: ::c_int = 0x0002;
1356+
pub const IFF_NO_PI: ::c_int = 0x1000;
13541357

13551358
pub const SOL_IP: ::c_int = 0;
13561359
pub const SOL_TCP: ::c_int = 6;

src/unix/notbsd/android/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,10 @@ pub const NFT_MSG_DELOBJ: ::c_int = 20;
978978
pub const NFT_MSG_GETOBJ_RESET: ::c_int = 21;
979979
pub const NFT_MSG_MAX: ::c_int = 22;
980980

981+
pub const IFF_TUN: ::c_int = 0x0001;
982+
pub const IFF_TAP: ::c_int = 0x0002;
983+
pub const IFF_NO_PI: ::c_int = 0x1000;
984+
981985
f! {
982986
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
983987
for slot in cpuset.__bits.iter_mut() {

src/unix/notbsd/linux/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -756,16 +756,15 @@ pub const IFF_DORMANT: ::c_int = 0x20000;
756756
pub const IFF_ECHO: ::c_int = 0x40000;
757757

758758
// linux/if_tun.h
759+
pub const IFF_TUN: ::c_short = 0x0001;
760+
pub const IFF_TAP: ::c_short = 0x0002;
761+
pub const IFF_NO_PI: ::c_short = 0x1000;
759762
// Read queue size
760763
pub const TUN_READQ_SIZE: ::c_short = 500;
761764
// TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead.
762-
pub const TUN_TUN_DEV: ::c_short = IFF_TUN;
763-
pub const TUN_TAP_DEV: ::c_short = IFF_TAP;
765+
pub const TUN_TUN_DEV: ::c_short = ::IFF_TUN;
766+
pub const TUN_TAP_DEV: ::c_short = ::IFF_TAP;
764767
pub const TUN_TYPE_MASK: ::c_short = 0x000f;
765-
// TUNSETIFF ifr flags
766-
pub const IFF_TUN: ::c_short = 0x0001;
767-
pub const IFF_TAP: ::c_short = 0x0002;
768-
pub const IFF_NO_PI: ::c_short = 0x1000;
769768
// This flag has no real effect
770769
pub const IFF_ONE_QUEUE: ::c_short = 0x2000;
771770
pub const IFF_VNET_HDR: ::c_short = 0x4000;

0 commit comments

Comments
 (0)