From 1d99e9e46e9b517532fea11befe2e6d0043850bd Mon Sep 17 00:00:00 2001 From: Reese Hyde <34076153+rmehyde@users.noreply.github.com> Date: Thu, 27 Apr 2023 00:05:55 -0400 Subject: gh-89415: Add source-specific multicast constants to socket module (#103684) Add socket options for source-specific multicast when present as C #defines. Co-authored-by: Oleg Iarygin --- .../Library/2023-04-22-11-20-27.gh-issue-89415.YHk760.rst | 2 ++ Modules/socketmodule.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-04-22-11-20-27.gh-issue-89415.YHk760.rst diff --git a/Misc/NEWS.d/next/Library/2023-04-22-11-20-27.gh-issue-89415.YHk760.rst b/Misc/NEWS.d/next/Library/2023-04-22-11-20-27.gh-issue-89415.YHk760.rst new file mode 100644 index 0000000..a5b99a2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-04-22-11-20-27.gh-issue-89415.YHk760.rst @@ -0,0 +1,2 @@ +Add :mod:`socket` constants for source-specific multicast. +Patch by Reese Hyde. diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 656cd54..f11d4b1 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -8418,6 +8418,18 @@ socket_exec(PyObject *m) #ifdef IP_BIND_ADDRESS_NO_PORT ADD_INT_MACRO(m, IP_BIND_ADDRESS_NO_PORT); #endif +#ifdef IP_UNBLOCK_SOURCE + ADD_INT_MACRO(m, IP_UNBLOCK_SOURCE); +#endif +#ifdef IP_BLOCK_SOURCE + ADD_INT_MACRO(m, IP_BLOCK_SOURCE); +#endif +#ifdef IP_ADD_SOURCE_MEMBERSHIP + ADD_INT_MACRO(m, IP_ADD_SOURCE_MEMBERSHIP); +#endif +#ifdef IP_DROP_SOURCE_MEMBERSHIP + ADD_INT_MACRO(m, IP_DROP_SOURCE_MEMBERSHIP); +#endif /* IPv6 [gs]etsockopt options, defined in RFC2553 */ #ifdef IPV6_JOIN_GROUP -- cgit v0.12