Skip to content

Commit 9d85aba

Browse files
gh-91968: Add socket constants SO_USER_COOKIE/SO_RTABLE from BSD (#91967)
Those are somewhat equivalent to Linux' SO_MARK. Co-authored-by: Jelle Zijlstra <[email protected]>
1 parent 859250c commit 9d85aba

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Doc/library/socket.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,11 @@ Constants
392392
Added ``TCP_CONNECTION_INFO``. On MacOS this constant can be used in the
393393
same way that ``TCP_INFO`` is used on Linux and BSD.
394394

395+
.. versionchanged:: 3.12
396+
Added ``SO_RTABLE`` and ``SO_USER_COOKIE``. On OpenBSD
397+
and FreeBSD respectively those constants can be used in the same way that
398+
``SO_MARK`` is used on Linux.
399+
395400
.. data:: AF_CAN
396401
PF_CAN
397402
SOL_CAN_*
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add ``SO_RTABLE`` and ``SO_USER_COOKIE`` constants to :mod:`socket`.

Modules/socketmodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7595,6 +7595,12 @@ PyInit__socket(void)
75957595
#ifdef SO_MARK
75967596
PyModule_AddIntMacro(m, SO_MARK);
75977597
#endif
7598+
#ifdef SO_USER_COOKIE
7599+
PyModule_AddIntMacro(m, SO_USER_COOKIE);
7600+
#endif
7601+
#ifdef SO_RTABLE
7602+
PyModule_AddIntMacro(m, SO_RTABLE);
7603+
#endif
75987604
#ifdef SO_DOMAIN
75997605
PyModule_AddIntMacro(m, SO_DOMAIN);
76007606
#endif

0 commit comments

Comments
 (0)