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
This commit is contained in:
Nikita Sobolev 2024-06-12 04:00:56 +03:00 committed by GitHub
parent 34e4d3287e
commit f5a9c34f38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View File

@ -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_*

View File

@ -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).

View File

@ -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