Auto merge of #1902 - george-hopkins:mptcp, r=JohnTitor

linux: Add definitions for Multipath TCP

The Linux kernel recently gained support for [Multipath TCP](https://en.wikipedia.org/wiki/Multipath_TCP), a protocol which builds upon TCP. This patch adds `IPPROTO_MPTCP` to open new sockets and `TCP_ULP` to query the upper layer protocol of traditional TCP sockets (which is set to `mptcp` for all underlying connections)

Source: [tcp: Define IPPROTO_MPTCP](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=faf391c3826cd29feae02078ca2022d2f912f7cc)

cc #1896
This commit is contained in:
bors 2020-10-24 23:20:17 +00:00
commit e0a4fb0397
5 changed files with 22 additions and 1 deletions

View File

@ -2613,6 +2613,10 @@ fn test_linux(target: &str) {
// Require Linux kernel 5.6:
"VMADDR_CID_LOCAL" => true,
// IPPROTO_MAX was increased in 5.6 for IPPROTO_MPTCP:
| "IPPROTO_MAX"
| "IPPROTO_MPTCP" => true,
// Defined in kernel headers but musl removes it; need musl 1.2 for definition in musl
// headers.
"P_PIDFD" => true,

View File

@ -1025,6 +1025,8 @@ pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SOCK_DCCP: ::c_int = 6;
pub const SOCK_PACKET: ::c_int = 10;
pub const IPPROTO_MAX: ::c_int = 256;
pub const SOL_SOCKET: ::c_int = 1;
pub const SOL_SCTP: ::c_int = 132;
pub const SOL_IPX: ::c_int = 256;
@ -1085,6 +1087,8 @@ pub const SO_RXQ_OVFL: ::c_int = 40;
pub const SO_PEEK_OFF: ::c_int = 42;
pub const SO_BUSY_POLL: ::c_int = 46;
pub const TCP_ULP: ::c_int = 31;
pub const IPTOS_ECN_NOTECT: u8 = 0x00;
pub const O_ACCMODE: ::c_int = 3;

View File

@ -1557,6 +1557,8 @@ pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_SEQPACKET: ::c_int = 5;
pub const IPPROTO_MAX: ::c_int = 256;
pub const SOL_SOCKET: ::c_int = 1;
pub const SO_REUSEADDR: ::c_int = 2;

View File

@ -1240,6 +1240,7 @@ pub const RTLD_NOW: ::c_int = 0x2;
pub const AT_EACCESS: ::c_int = 0x200;
pub const TCP_MD5SIG: ::c_int = 14;
pub const TCP_ULP: ::c_int = 31;
align_const! {
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
@ -1274,6 +1275,17 @@ pub const SCHED_RESET_ON_FORK: ::c_int = 0x40000000;
// netinet/in.h
// NOTE: These are in addition to the constants defined in src/unix/mod.rs
/// Multipath TCP
pub const IPPROTO_MPTCP: ::c_int = 262;
#[deprecated(
since = "0.2.80",
note = "This value was increased in the newer kernel \
and we'll change this following upstream in the future release. \
See #1896 for more info."
)]
pub const IPPROTO_MAX: ::c_int = 256;
pub const AF_IB: ::c_int = 27;
pub const AF_MPLS: ::c_int = 28;
pub const AF_NFC: ::c_int = 39;

View File

@ -869,7 +869,6 @@ pub const IPPROTO_UDPLITE: ::c_int = 136;
pub const IPPROTO_MPLS: ::c_int = 137;
/// raw IP packet
pub const IPPROTO_RAW: ::c_int = 255;
pub const IPPROTO_MAX: ::c_int = 256;
pub const MCAST_EXCLUDE: ::c_int = 0;
pub const MCAST_INCLUDE: ::c_int = 1;