diff --git a/libc-test/build.rs b/libc-test/build.rs index f7b030e8b54bd..5595106289be6 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1830,6 +1830,9 @@ fn test_android(target: &str) { // kernel 5.6 minimum required "IPPROTO_MPTCP" | "IPPROTO_ETHERNET" => true, + // kernel 6.2 minimum + "TUN_F_USO4" | "TUN_F_USO6" | "IFF_NO_CARRIER" => true, + // FIXME: NDK r22 minimum required | "FDB_NOTIFY_BIT" | "FDB_NOTIFY_INACTIVE_BIT" @@ -3862,6 +3865,9 @@ fn test_linux(target: &str) { // kernel 6.1 minimum "MADV_COLLAPSE" => true, + // kernel 6.2 minimum + "TUN_F_USO4" | "TUN_F_USO6" | "IFF_NO_CARRIER" => true, + // FIXME: Requires more recent kernel headers | "IFLA_PARENT_DEV_NAME" // linux v5.13+ | "IFLA_PARENT_DEV_BUS_NAME" // linux v5.13+ diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 09551d329c435..bc8f673b15d08 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -699,6 +699,7 @@ IFF_MASTER IFF_MULTICAST IFF_NOARP IFF_NOTRAILERS +IFF_NO_CARRIER IFF_NO_PI IFF_POINTOPOINT IFF_PORTSEL @@ -708,6 +709,13 @@ IFF_SLAVE IFF_TAP IFF_TUN IFF_UP +TUN_F_CSUM +TUN_F_TSO4 +TUN_F_TSO6 +TUN_F_TSO_ECN +TUN_F_UFO +TUN_F_USO4 +TUN_F_USO6 IFNAMSIZ IF_NAMESIZE IFA_UNSPEC diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 007692c9d4dbc..d60d9d9fec7b8 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -932,6 +932,7 @@ IFF_LOWER_UP IFF_MASTER IFF_MULTICAST IFF_MULTI_QUEUE +IFF_NO_CARRIER IFF_NOARP IFF_NOFILTER TUN_TX_TIMESTAMP @@ -940,6 +941,8 @@ TUN_F_TSO4 TUN_F_TSO6 TUN_F_TSO_ECN TUN_F_UFO +TUN_F_USO4 +TUN_F_USO6 TUN_PKT_STRIP TUN_FLT_ALLMULTI IFF_NOTRAILERS diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 98a9d9b2b8448..606eefa2c0d55 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -2481,6 +2481,7 @@ pub const IFF_TUN: ::c_int = 0x0001; pub const IFF_TAP: ::c_int = 0x0002; pub const IFF_NAPI: ::c_int = 0x0010; pub const IFF_NAPI_FRAGS: ::c_int = 0x0020; +pub const IFF_NO_CARRIER: ::c_int = 0x0040; pub const IFF_NO_PI: ::c_int = 0x1000; pub const IFF_ONE_QUEUE: ::c_int = 0x2000; pub const IFF_VNET_HDR: ::c_int = 0x4000; @@ -2490,6 +2491,14 @@ pub const IFF_ATTACH_QUEUE: ::c_int = 0x0200; pub const IFF_DETACH_QUEUE: ::c_int = 0x0400; pub const IFF_PERSIST: ::c_int = 0x0800; pub const IFF_NOFILTER: ::c_int = 0x1000; +// Features for GSO (TUNSETOFFLOAD) +pub const TUN_F_CSUM: ::c_uint = 0x01; +pub const TUN_F_TSO4: ::c_uint = 0x02; +pub const TUN_F_TSO6: ::c_uint = 0x04; +pub const TUN_F_TSO_ECN: ::c_uint = 0x08; +pub const TUN_F_UFO: ::c_uint = 0x10; +pub const TUN_F_USO4: ::c_uint = 0x20; +pub const TUN_F_USO6: ::c_uint = 0x40; // start android/platform/bionic/libc/kernel/uapi/linux/if_ether.h // from https://android.googlesource.com/platform/bionic/+/HEAD/libc/kernel/uapi/linux/if_ether.h diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 224300a64609e..3cad1fdbe5370 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1866,6 +1866,8 @@ pub const IFF_TUN: ::c_int = 0x0001; pub const IFF_TAP: ::c_int = 0x0002; pub const IFF_NAPI: ::c_int = 0x0010; pub const IFF_NAPI_FRAGS: ::c_int = 0x0020; +// Used in TUNSETIFF to bring up tun/tap without carrier +pub const IFF_NO_CARRIER: ::c_int = 0x0040; pub const IFF_NO_PI: ::c_int = 0x1000; // Read queue size pub const TUN_READQ_SIZE: ::c_short = 500; @@ -1886,11 +1888,13 @@ pub const IFF_NOFILTER: ::c_int = 0x1000; // Socket options pub const TUN_TX_TIMESTAMP: ::c_int = 1; // Features for GSO (TUNSETOFFLOAD) -pub const TUN_F_CSUM: ::c_ushort = 0x01; /* You can hand me unchecksummed packets. */ -pub const TUN_F_TSO4: ::c_ushort = 0x02; /* I can handle TSO for IPv4 packets */ -pub const TUN_F_TSO6: ::c_ushort = 0x04; /* I can handle TSO for IPv6 packets */ -pub const TUN_F_TSO_ECN: ::c_ushort = 0x08; /* I can handle TSO with ECN bits. */ -pub const TUN_F_UFO: ::c_ushort = 0x10; /* I can handle UFO packets */ +pub const TUN_F_CSUM: ::c_uint = 0x01; +pub const TUN_F_TSO4: ::c_uint = 0x02; +pub const TUN_F_TSO6: ::c_uint = 0x04; +pub const TUN_F_TSO_ECN: ::c_uint = 0x08; +pub const TUN_F_UFO: ::c_uint = 0x10; +pub const TUN_F_USO4: ::c_uint = 0x20; +pub const TUN_F_USO6: ::c_uint = 0x40; // Protocol info prepended to the packets (when IFF_NO_PI is not set) pub const TUN_PKT_STRIP: ::c_int = 0x0001; // Accept all multicast packets