summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Sauthoff <mail@georg.so>2021-06-20 20:08:07 (GMT)
committerGitHub <noreply@github.com>2021-06-20 20:08:07 (GMT)
commita317778fd58b1c6b250feffbdb4ecf15e293ef48 (patch)
treed9c3a32f3633994602750c43b4a88f9d97c88b74
parent7265b277fa00337dfe4ea202c7f666dceb87a0b3 (diff)
downloadcpython-a317778fd58b1c6b250feffbdb4ecf15e293ef48.zip
cpython-a317778fd58b1c6b250feffbdb4ecf15e293ef48.tar.gz
cpython-a317778fd58b1c6b250feffbdb4ecf15e293ef48.tar.bz2
bpo-44077: Expose IP_RECVTOS in the socket module (GH-25992)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
-rwxr-xr-xDoc/library/socket.rst3
-rw-r--r--Doc/whatsnew/3.10.rst3
-rw-r--r--Misc/NEWS.d/next/Library/2021-05-13-19-44-38.bpo-44077.04b2a4.rst3
-rw-r--r--Modules/socketmodule.c3
4 files changed, 12 insertions, 0 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index da3d0d8..d67df47 100755
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -379,6 +379,9 @@ Constants
On Windows, ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` appear if run-time Windows
supports.
+ .. versionchanged:: 3.10
+ ``IP_RECVTOS`` was added.
+
.. data:: AF_CAN
PF_CAN
SOL_CAN_*
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index ba5b0a2..528d8ab 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -1219,6 +1219,9 @@ The exception :exc:`socket.timeout` is now an alias of :exc:`TimeoutError`.
Add option to create MPTCP sockets with ``IPPROTO_MPTCP``
(Contributed by Rui Cunha in :issue:`43571`.)
+Add ``IP_RECVTOS`` option to receive the type of service (ToS) or DSCP/ECN fields
+(Contributed by Georg Sauthoff in :issue:`44077`.)
+
ssl
---
diff --git a/Misc/NEWS.d/next/Library/2021-05-13-19-44-38.bpo-44077.04b2a4.rst b/Misc/NEWS.d/next/Library/2021-05-13-19-44-38.bpo-44077.04b2a4.rst
new file mode 100644
index 0000000..7bb4379
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-05-13-19-44-38.bpo-44077.04b2a4.rst
@@ -0,0 +1,3 @@
+It's now possible to receive the type of service (ToS), a.k.a. differentiated
+services (DS), a.k.a. differenciated services code point (DSCP) and excplicit
+congestion notification (ECN) IP header fields with ``socket.IP_RECVTOS``.
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 79559c0..142cc7c 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -8024,6 +8024,9 @@ PyInit__socket(void)
#ifdef IP_RECVRETOPTS
PyModule_AddIntMacro(m, IP_RECVRETOPTS);
#endif
+#ifdef IP_RECVTOS
+ PyModule_AddIntMacro(m, IP_RECVTOS);
+#endif
#ifdef IP_RECVDSTADDR
PyModule_AddIntMacro(m, IP_RECVDSTADDR);
#endif