]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-91968: Add socket constants SO_USER_COOKIE/SO_RTABLE from BSD (#91967)
authorDavid CARLIER <devnexen@gmail.com>
Sun, 8 May 2022 23:19:41 +0000 (00:19 +0100)
committerGitHub <noreply@github.com>
Sun, 8 May 2022 23:19:41 +0000 (16:19 -0700)
Those are somewhat equivalent to Linux' SO_MARK.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Doc/library/socket.rst
Misc/NEWS.d/next/Library/2022-04-26-18-37-24.gh-issue-91968.fuuH1_.rst [new file with mode: 0644]
Modules/socketmodule.c

index ee1aee5278b3be39e952e797ead70fb606cd2a67..4c193b892bda8fc106a6709e3a6071c7e969998e 100755 (executable)
@@ -392,6 +392,11 @@ Constants
       Added ``TCP_CONNECTION_INFO``. On MacOS this constant can be used in the
       same way that ``TCP_INFO`` is used on Linux and BSD.
 
+   .. 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.
+
 .. data:: AF_CAN
           PF_CAN
           SOL_CAN_*
diff --git a/Misc/NEWS.d/next/Library/2022-04-26-18-37-24.gh-issue-91968.fuuH1_.rst b/Misc/NEWS.d/next/Library/2022-04-26-18-37-24.gh-issue-91968.fuuH1_.rst
new file mode 100644 (file)
index 0000000..f16f5d3
--- /dev/null
@@ -0,0 +1 @@
+Add ``SO_RTABLE`` and ``SO_USER_COOKIE`` constants to :mod:`socket`.
index 9aefa443c7c694745a073578a7b623b56286ccc5..f376513fead1b83a769b44bb721a255025445508 100644 (file)
@@ -7595,6 +7595,12 @@ PyInit__socket(void)
 #ifdef  SO_MARK
     PyModule_AddIntMacro(m, SO_MARK);
 #endif
+#ifdef  SO_USER_COOKIE
+    PyModule_AddIntMacro(m, SO_USER_COOKIE);
+#endif
+#ifdef  SO_RTABLE
+    PyModule_AddIntMacro(m, SO_RTABLE);
+#endif
 #ifdef SO_DOMAIN
     PyModule_AddIntMacro(m, SO_DOMAIN);
 #endif