From 08b296902c4116d128f13dfee9e21bcd811e5a83 Mon Sep 17 00:00:00 2001 From: database64128 Date: Fri, 3 Mar 2023 23:50:23 +0800 Subject: [PATCH] macos: add TCP_FASTOPEN_FORCE_ENABLE This is used to disable the backoff mechanism, otherwise TFO is basically unusable. Updates #1632 and #1635 Definition: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet/tcp.h#L310 Related commits/PRs: https://github.com/zonyitoo/tokio-tfo/pull/5, https://github.com/database64128/tfo-go/commit/c980f6b18b76910d79908eba489e5f16a98278a9 --- libc-test/semver/apple.txt | 1 + src/unix/bsd/apple/mod.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index b697b893ae7a3..b43f28eaabf76 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1349,6 +1349,7 @@ TAB2 TAB3 TABDLY TCP_FASTOPEN +TCP_FASTOPEN_FORCE_ENABLE TCP_KEEPALIVE TCP_KEEPCNT TCP_KEEPINTVL diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 519a99346504d..d6d713576bbd9 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -3657,6 +3657,8 @@ pub const TCP_KEEPINTVL: ::c_int = 0x101; pub const TCP_KEEPCNT: ::c_int = 0x102; /// Enable/Disable TCP Fastopen on this socket pub const TCP_FASTOPEN: ::c_int = 0x105; +/// Disable/Enable TCP Fastopen backoff mechanism. +pub const TCP_FASTOPEN_FORCE_ENABLE: ::c_int = 0x218; pub const SOL_LOCAL: ::c_int = 0;