From b1c980189756a524c21d2d29c598f2e045d29acd Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Tue, 17 Sep 2024 02:43:58 -0700 Subject: [PATCH] Support more TCP socket options on Windows --- libc/sysv/consts.sh | 14 +++++++------- libc/sysv/consts/TCP_CONGESTION.S | 2 +- libc/sysv/consts/TCP_INFO.S | 2 +- libc/sysv/consts/TCP_KEEPCNT.S | 2 +- libc/sysv/consts/TCP_KEEPIDLE.S | 2 +- libc/sysv/consts/TCP_KEEPINTVL.S | 2 +- libc/sysv/consts/TCP_MD5SIG.S | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libc/sysv/consts.sh b/libc/sysv/consts.sh index 0488fbce2..a372572b5 100755 --- a/libc/sysv/consts.sh +++ b/libc/sysv/consts.sh @@ -678,18 +678,18 @@ syscon tcp TCP_CORK 3 3 4 4 4 16 4 0 # nagle's algorithm stri syscon tcp TCP_MAXSEG 2 2 2 2 2 2 2 0 # reduces tcp segment size; see also tcp offloading syscon tcp TCP_FASTOPEN 23 23 0x105 0x105 0x0401 0 0 15 # reduces roundtrips; for listener; Linux 3.7+ (c. 2012) / or is windows it 0x22? /proc/sys/net/ipv4/tcp_fastopen TODO(jart): MSG_FASTOPEN; XNU sources say 261 but not sure if that's true syscon tcp TCP_FASTOPEN_CONNECT 30 30 0 0 0 0 0 0 # reduces roundtrips; for listener; Linux 3.7+ (c. 2012) / or is windows it 0x22? /proc/sys/net/ipv4/tcp_fastopen TODO(jart): MSG_FASTOPEN; XNU sources say 261 but not sure if that's true -syscon tcp TCP_KEEPIDLE 4 4 0 0 0x100 0 3 0 # start keepalives after this period -syscon tcp TCP_KEEPINTVL 5 5 0x101 0x101 0x200 0 5 0 # interval between keepalives -syscon tcp TCP_KEEPCNT 6 6 0x102 0x102 0x400 0 6 0 # number of keepalives before death +syscon tcp TCP_KEEPIDLE 4 4 0 0 0x100 0 3 3 # start keepalives after this period +syscon tcp TCP_KEEPINTVL 5 5 0x101 0x101 0x200 0 5 17 # interval between keepalives +syscon tcp TCP_KEEPCNT 6 6 0x102 0x102 0x400 0 6 16 # number of keepalives before death +syscon tcp TCP_INFO 11 11 0x200 0x200 32 9 9 0 # get connection info +syscon tcp TCP_NOTSENT_LOWAT 25 25 513 513 0 0 0 0 # limit unset byte queue +syscon tcp TCP_MD5SIG 14 14 0 0 16 4 16 0 # what is it (rfc2385) +syscon tcp TCP_CONGESTION 13 13 0 0 64 0 0 0 # set traffic control syscon tcp TCP_SYNCNT 7 7 0 0 0 0 0 0 # how hard to syn packet the enemy syscon tcp TCP_ULP 31 31 0 0 0 0 0 0 # setsockopt(sock, IPPROTO_TCP, TCP_ULP, "tls", 4) syscon tcp TCP_COOKIE_TRANSACTIONS 15 15 0 0 0 0 0 0 # defense against the syn packets syscon tcp TCP_LINGER2 8 8 0 0 0 0 0 0 # orphaned fin-wait-2 lifetime cf. net.ipv4.tcp_fin_timeout see cloudflare blog -syscon tcp TCP_NOTSENT_LOWAT 25 25 513 513 0 0 0 0 # limit unset byte queue -syscon tcp TCP_INFO 11 11 0 0 0x20 0 9 0 # get connection info syscon tcp TCP_CC_INFO 26 26 0 0 0 0 0 0 # get congestion control info -syscon tcp TCP_CONGESTION 13 13 0 0 0x40 0 0 0 # set traffic control -syscon tcp TCP_MD5SIG 14 14 0 0 0x10 4 16 0 # what is it (rfc2385) syscon tcp TCP_MD5SIG_MAXKEYLEN 80 80 0 0 0 0 0 0 # what is it syscon tcp TCP_TIMESTAMP 24 24 0 0 0 0 0 0 # what is it syscon tcp TCP_USER_TIMEOUT 18 18 0 0 0 0 0 0 # what is it diff --git a/libc/sysv/consts/TCP_CONGESTION.S b/libc/sysv/consts/TCP_CONGESTION.S index aed94356e..5817b15c7 100644 --- a/libc/sysv/consts/TCP_CONGESTION.S +++ b/libc/sysv/consts/TCP_CONGESTION.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon tcp,TCP_CONGESTION,13,13,0,0,0x40,0,0,0 +.syscon tcp,TCP_CONGESTION,13,13,0,0,64,0,0,0 diff --git a/libc/sysv/consts/TCP_INFO.S b/libc/sysv/consts/TCP_INFO.S index a1aba3722..ed51f0771 100644 --- a/libc/sysv/consts/TCP_INFO.S +++ b/libc/sysv/consts/TCP_INFO.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon tcp,TCP_INFO,11,11,0,0,0x20,0,9,0 +.syscon tcp,TCP_INFO,11,11,0x200,0x200,32,9,9,0 diff --git a/libc/sysv/consts/TCP_KEEPCNT.S b/libc/sysv/consts/TCP_KEEPCNT.S index 97c36dcfc..4bc84b47a 100644 --- a/libc/sysv/consts/TCP_KEEPCNT.S +++ b/libc/sysv/consts/TCP_KEEPCNT.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon tcp,TCP_KEEPCNT,6,6,0x102,0x102,0x400,0,6,0 +.syscon tcp,TCP_KEEPCNT,6,6,0x102,0x102,0x400,0,6,16 diff --git a/libc/sysv/consts/TCP_KEEPIDLE.S b/libc/sysv/consts/TCP_KEEPIDLE.S index 5751644c2..f5886f4cc 100644 --- a/libc/sysv/consts/TCP_KEEPIDLE.S +++ b/libc/sysv/consts/TCP_KEEPIDLE.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon tcp,TCP_KEEPIDLE,4,4,0,0,0x100,0,3,0 +.syscon tcp,TCP_KEEPIDLE,4,4,0,0,0x100,0,3,3 diff --git a/libc/sysv/consts/TCP_KEEPINTVL.S b/libc/sysv/consts/TCP_KEEPINTVL.S index 3b94ca585..6f94429df 100644 --- a/libc/sysv/consts/TCP_KEEPINTVL.S +++ b/libc/sysv/consts/TCP_KEEPINTVL.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon tcp,TCP_KEEPINTVL,5,5,0x101,0x101,0x200,0,5,0 +.syscon tcp,TCP_KEEPINTVL,5,5,0x101,0x101,0x200,0,5,17 diff --git a/libc/sysv/consts/TCP_MD5SIG.S b/libc/sysv/consts/TCP_MD5SIG.S index 7ee7876b3..fc1388aa4 100644 --- a/libc/sysv/consts/TCP_MD5SIG.S +++ b/libc/sysv/consts/TCP_MD5SIG.S @@ -1,2 +1,2 @@ #include "libc/sysv/consts/syscon.internal.h" -.syscon tcp,TCP_MD5SIG,14,14,0,0,0x10,4,16,0 +.syscon tcp,TCP_MD5SIG,14,14,0,0,16,4,16,0