summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReese Hyde <34076153+rmehyde@users.noreply.github.com>2023-04-27 04:05:55 (GMT)
committerGitHub <noreply@github.com>2023-04-27 04:05:55 (GMT)
commit1d99e9e46e9b517532fea11befe2e6d0043850bd (patch)
tree167a0e7d03c62cd4183c30e10c86646b852c1e66
parent9169a56fad246364fd3224306e72e0d0725c35aa (diff)
downloadcpython-1d99e9e46e9b517532fea11befe2e6d0043850bd.zip
cpython-1d99e9e46e9b517532fea11befe2e6d0043850bd.tar.gz
cpython-1d99e9e46e9b517532fea11befe2e6d0043850bd.tar.bz2
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 <dralife@yandex.ru>
-rw-r--r--Misc/NEWS.d/next/Library/2023-04-22-11-20-27.gh-issue-89415.YHk760.rst2
-rw-r--r--Modules/socketmodule.c12
2 files changed, 14 insertions, 0 deletions
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