summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2024-06-12 01:00:56 (GMT)
committerGitHub <noreply@github.com>2024-06-12 01:00:56 (GMT)
commitf5a9c34f38886c5cf9c2f8d860eee3473447e030 (patch)
treeb13a74a5eaa3a68f78278c8d38009d652d7c8462
parent34e4d3287e724c065cc07b04a1ee8715817db284 (diff)
downloadcpython-f5a9c34f38886c5cf9c2f8d860eee3473447e030.zip
cpython-f5a9c34f38886c5cf9c2f8d860eee3473447e030.tar.gz
cpython-f5a9c34f38886c5cf9c2f8d860eee3473447e030.tar.bz2
gh-120056: Add `IP_RECVERR`, `IP_RECVORIGDSTADDR`, `IP_RECVTTL` to `socket` module (#120058)
* gh-120056: Add `IP_RECVERR` and `IP_RECVTTL` to `socket` module * Fix news * Address review * Update NEWS
-rw-r--r--Doc/library/socket.rst4
-rw-r--r--Misc/NEWS.d/next/Library/2024-06-04-19-49-16.gh-issue-120056.5aqozw.rst3
-rw-r--r--Modules/socketmodule.c9
3 files changed, 16 insertions, 0 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 2df0257..782fb9b 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -450,6 +450,10 @@ Constants
same way that ``SO_BINDTODEVICE`` is used, but with the index of a
network interface instead of its name.
+ .. versionchanged:: 3.14
+ Added missing ``IP_RECVERR``, ``IP_RECVTTL``, and ``IP_RECVORIGDSTADDR``
+ on Linux.
+
.. data:: AF_CAN
PF_CAN
SOL_CAN_*
diff --git a/Misc/NEWS.d/next/Library/2024-06-04-19-49-16.gh-issue-120056.5aqozw.rst b/Misc/NEWS.d/next/Library/2024-06-04-19-49-16.gh-issue-120056.5aqozw.rst
new file mode 100644
index 0000000..0adb70f
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-06-04-19-49-16.gh-issue-120056.5aqozw.rst
@@ -0,0 +1,3 @@
+Add :data:`!socket.IP_RECVERR` and :data:`!socket.IP_RECVTTL` constants
+(both available since Linux 2.2).
+And :data:`!socket.IP_RECVORIGDSTADDR` constant (available since Linux 2.6.29).
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index cb7dc25..0626d79 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -8412,15 +8412,24 @@ socket_exec(PyObject *m)
#ifdef IP_TTL
ADD_INT_MACRO(m, IP_TTL);
#endif
+#ifdef IP_RECVERR
+ ADD_INT_MACRO(m, IP_RECVERR);
+#endif
#ifdef IP_RECVOPTS
ADD_INT_MACRO(m, IP_RECVOPTS);
#endif
+#ifdef IP_RECVORIGDSTADDR
+ ADD_INT_MACRO(m, IP_RECVORIGDSTADDR);
+#endif
#ifdef IP_RECVRETOPTS
ADD_INT_MACRO(m, IP_RECVRETOPTS);
#endif
#ifdef IP_RECVTOS
ADD_INT_MACRO(m, IP_RECVTOS);
#endif
+#ifdef IP_RECVTTL
+ ADD_INT_MACRO(m, IP_RECVTTL);
+#endif
#ifdef IP_RECVDSTADDR
ADD_INT_MACRO(m, IP_RECVDSTADDR);
#endif