You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing support for Source Specific Multicast #89415
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2021-09-21.00:26:04.617>labels= ['type-feature', 'library', '3.11']
title='Missing support for Source Specific Multicast'updated_at=<Date2021-09-24.23:41:45.383>user='https://github.com/ciresnave'
It appears that Python's socket module is missing support for the IGMPv3 socket options needed to support Source Specific Multicast. Many developers appear to be adding the necessary constants through something like:
...but it would be nice if these were added to the official module as they are supported under current versions of Windows, Linux, and BSD at the least.
I'm sorry to ask if getting the right flags setup. Is socket.IPPROTO_IP the correct way to setup SSM because the old examples out there using socket.SOL_IP cause endless "invalid argument" errors. The struct packing is similar to the windows docs. Needs to join the group, source ip, then local ip
Here is a patch for windows and macOS I've come up with. Will eventually test on macOS but Windows first.
platform = platform.system()
if (platform == "Windows"):
if not hasattr(socket, "IP_UNBLOCK_SOURCE"):
setattr(socket, "IP_UNBLOCK_SOURCE", 18)
if not hasattr(socket, "IP_BLOCK_SOURCE"):
setattr(socket, "IP_BLOCK_SOURCE", 17)
if not hasattr(socket, "IP_ADD_SOURCE_MEMBERSHIP"):
setattr(socket, "IP_ADD_SOURCE_MEMBERSHIP", 15)
if not hasattr(socket, "IP_DROP_SOURCE_MEMBERSHIP"):
setattr(socket, "IP_DROP_SOURCE_MEMBERSHIP", 16)
elif (platform == 'Darwin'):
if not hasattr(socket, "IP_UNBLOCK_SOURCE"):
setattr(socket, "IP_UNBLOCK_SOURCE", 73)
if not hasattr(socket, "IP_BLOCK_SOURCE"):
setattr(socket, "IP_BLOCK_SOURCE", 72)
if not hasattr(socket, "IP_ADD_SOURCE_MEMBERSHIP"):
setattr(socket, "IP_ADD_SOURCE_MEMBERSHIP", 70)
if not hasattr(socket, "IP_DROP_SOURCE_MEMBERSHIP"):
setattr(socket, "IP_DROP_SOURCE_MEMBERSHIP", 71)
else:
if not hasattr(socket, "IP_UNBLOCK_SOURCE"):
setattr(socket, "IP_UNBLOCK_SOURCE", 37)
if not hasattr(socket, "IP_BLOCK_SOURCE"):
setattr(socket, "IP_BLOCK_SOURCE", 38)
if not hasattr(socket, "IP_ADD_SOURCE_MEMBERSHIP"):
setattr(socket, "IP_ADD_SOURCE_MEMBERSHIP", 39)
if not hasattr(socket, "IP_DROP_SOURCE_MEMBERSHIP"):
setattr(socket, "IP_DROP_SOURCE_MEMBERSHIP", 40)
Activity
ciresnave commentedon Sep 21, 2021
It appears that Python's socket module is missing support for the IGMPv3 socket options needed to support Source Specific Multicast. Many developers appear to be adding the necessary constants through something like:
...but it would be nice if these were added to the official module as they are supported under current versions of Windows, Linux, and BSD at the least.
19 remaining items
danrossi commentedon Jul 30, 2022
That is what I figured it needs to match the constant flags on the OS. For darwin it says 70. So mac needs something different ?
https://github.com/apple/darwin-xnu/blob/8f02f2a044b9bb1ad951987ef5bab20ec9486310/bsd/netinet/in.h
danrossi commentedon Jul 30, 2022
I found a header for win 10 SDK. It says 15.
https://github.com/tpn/winsdk-10/blob/master/Include/10.0.16299.0/shared/ws2ipdef.h
danrossi commentedon Jul 30, 2022
I'm sorry to ask if getting the right flags setup. Is socket.IPPROTO_IP the correct way to setup SSM because the old examples out there using socket.SOL_IP cause endless "invalid argument" errors. The struct packing is similar to the windows docs. Needs to join the group, source ip, then local ip
danrossi commentedon Jul 30, 2022
Here is a patch for windows and macOS I've come up with. Will eventually test on macOS but Windows first.
pythongh-89415: Add socket options for source-specific multicast
gh-89415: Add source-specific multicast constants to socket module (#…
pythongh-89415: update docs
pythongh-89415: news file update
pythongh-89415: news file update
pythongh-89415: Mention new `IP_*` constants in `socket` module in th…
gh-89415: Mention new `IP_*` constants in `socket` module in the docs (…
pythongh-89415: Mention new `IP_*` constants in `socket` module in th…
[3.12] gh-89415: Mention new `IP_*` constants in `socket` module in t…