gh-98030: socket: add missing TCP socket options (#98031)

A few TCP socket options have been added to the Linux kernel these last
few years.

This commit adds all the ones available in Linux 6.0:

  https://elixir.bootlin.com/linux/v6.0/source/include/uapi/linux/tcp.h#L91

While at it, the TCP_FASTOPEN option has been moved lower in the list
just to keep the same order as in tcp.h to ease future synchronisations.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
This commit is contained in:
Matthieu Baerts 2022-12-08 05:59:37 +01:00 committed by GitHub
parent 90d5c9b195
commit cce8362960
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 4 deletions

View File

@ -428,7 +428,14 @@ Constants
.. versionchanged:: 3.12
Added ``SO_RTABLE`` and ``SO_USER_COOKIE``. On OpenBSD
and FreeBSD respectively those constants can be used in the same way that
``SO_MARK`` is used on Linux.
``SO_MARK`` is used on Linux. Also added missing TCP socket options from
Linux: ``TCP_MD5SIG``, ``TCP_THIN_LINEAR_TIMEOUTS``, ``TCP_THIN_DUPACK``,
``TCP_REPAIR``, ``TCP_REPAIR_QUEUE``, ``TCP_QUEUE_SEQ``,
``TCP_REPAIR_OPTIONS``, ``TCP_TIMESTAMP``, ``TCP_CC_INFO``,
``TCP_SAVE_SYN``, ``TCP_SAVED_SYN``, ``TCP_REPAIR_WINDOW``,
``TCP_FASTOPEN_CONNECT``, ``TCP_ULP``, ``TCP_MD5SIG_EXT``,
``TCP_FASTOPEN_KEY``, ``TCP_FASTOPEN_NO_COOKIE``,
``TCP_ZEROCOPY_RECEIVE``, ``TCP_INQ``, ``TCP_TX_DELAY``.
.. data:: AF_CAN
PF_CAN

View File

@ -0,0 +1,7 @@
Add missing TCP socket options from Linux: ``TCP_MD5SIG``,
``TCP_THIN_LINEAR_TIMEOUTS``, ``TCP_THIN_DUPACK``, ``TCP_REPAIR``,
``TCP_REPAIR_QUEUE``, ``TCP_QUEUE_SEQ``, ``TCP_REPAIR_OPTIONS``,
``TCP_TIMESTAMP``, ``TCP_CC_INFO``, ``TCP_SAVE_SYN``, ``TCP_SAVED_SYN``,
``TCP_REPAIR_WINDOW``, ``TCP_FASTOPEN_CONNECT``, ``TCP_ULP``,
``TCP_MD5SIG_EXT``, ``TCP_FASTOPEN_KEY``, ``TCP_FASTOPEN_NO_COOKIE``,
``TCP_ZEROCOPY_RECEIVE``, ``TCP_INQ``, ``TCP_TX_DELAY``.

View File

@ -8484,18 +8484,78 @@ PyInit__socket(void)
#ifdef TCP_QUICKACK
PyModule_AddIntMacro(m, TCP_QUICKACK);
#endif
#ifdef TCP_FASTOPEN
PyModule_AddIntMacro(m, TCP_FASTOPEN);
#endif
#ifdef TCP_CONGESTION
PyModule_AddIntMacro(m, TCP_CONGESTION);
#endif
#ifdef TCP_MD5SIG
PyModule_AddIntMacro(m, TCP_MD5SIG);
#endif
#ifdef TCP_THIN_LINEAR_TIMEOUTS
PyModule_AddIntMacro(m, TCP_THIN_LINEAR_TIMEOUTS);
#endif
#ifdef TCP_THIN_DUPACK
PyModule_AddIntMacro(m, TCP_THIN_DUPACK);
#endif
#ifdef TCP_USER_TIMEOUT
PyModule_AddIntMacro(m, TCP_USER_TIMEOUT);
#endif
#ifdef TCP_REPAIR
PyModule_AddIntMacro(m, TCP_REPAIR);
#endif
#ifdef TCP_REPAIR_QUEUE
PyModule_AddIntMacro(m, TCP_REPAIR_QUEUE);
#endif
#ifdef TCP_QUEUE_SEQ
PyModule_AddIntMacro(m, TCP_QUEUE_SEQ);
#endif
#ifdef TCP_REPAIR_OPTIONS
PyModule_AddIntMacro(m, TCP_REPAIR_OPTIONS);
#endif
#ifdef TCP_FASTOPEN
PyModule_AddIntMacro(m, TCP_FASTOPEN);
#endif
#ifdef TCP_TIMESTAMP
PyModule_AddIntMacro(m, TCP_TIMESTAMP);
#endif
#ifdef TCP_NOTSENT_LOWAT
PyModule_AddIntMacro(m, TCP_NOTSENT_LOWAT);
#endif
#ifdef TCP_CC_INFO
PyModule_AddIntMacro(m, TCP_CC_INFO);
#endif
#ifdef TCP_SAVE_SYN
PyModule_AddIntMacro(m, TCP_SAVE_SYN);
#endif
#ifdef TCP_SAVED_SYN
PyModule_AddIntMacro(m, TCP_SAVED_SYN);
#endif
#ifdef TCP_REPAIR_WINDOW
PyModule_AddIntMacro(m, TCP_REPAIR_WINDOW);
#endif
#ifdef TCP_FASTOPEN_CONNECT
PyModule_AddIntMacro(m, TCP_FASTOPEN_CONNECT);
#endif
#ifdef TCP_ULP
PyModule_AddIntMacro(m, TCP_ULP);
#endif
#ifdef TCP_MD5SIG_EXT
PyModule_AddIntMacro(m, TCP_MD5SIG_EXT);
#endif
#ifdef TCP_FASTOPEN_KEY
PyModule_AddIntMacro(m, TCP_FASTOPEN_KEY);
#endif
#ifdef TCP_FASTOPEN_NO_COOKIE
PyModule_AddIntMacro(m, TCP_FASTOPEN_NO_COOKIE);
#endif
#ifdef TCP_ZEROCOPY_RECEIVE
PyModule_AddIntMacro(m, TCP_ZEROCOPY_RECEIVE);
#endif
#ifdef TCP_INQ
PyModule_AddIntMacro(m, TCP_INQ);
#endif
#ifdef TCP_TX_DELAY
PyModule_AddIntMacro(m, TCP_TX_DELAY);
#endif
/* IPX options */
#ifdef IPX_TYPE