Skip to content

Missing support for Source Specific Multicast #89415

Description

@ciresnave
mannequin
BPO 45252
Nosy @ciresnave

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 = None
closed_at = None
created_at = <Date 2021-09-21.00:26:04.617>
labels = ['type-feature', 'library', '3.11']
title = 'Missing support for Source Specific Multicast'
updated_at = <Date 2021-09-24.23:41:45.383>
user = 'https://github.com/ciresnave'

bugs.python.org fields:

activity = <Date 2021-09-24.23:41:45.383>
actor = 'terry.reedy'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2021-09-21.00:26:04.617>
creator = 'ciresnave'
dependencies = []
files = []
hgrepos = []
issue_num = 45252
keywords = []
message_count = 1.0
messages = ['402283']
nosy_count = 1.0
nosy_names = ['ciresnave']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue45252'
versions = ['Python 3.11']

Linked PRs

Activity

  1. ciresnave commented on Sep 21, 2021

    ciresnavemannequin
    MannequinAuthor

    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:

    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)

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

  2. added
    3.11only security fixes
    stdlibStandard Library Python modules in the Lib/ directory
    type-featureA feature request or enhancement
    on Sep 21, 2021
  3. 19 remaining items

  4. danrossi commented on Jul 30, 2022

    @danrossi

    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

  5. danrossi commented on Jul 30, 2022

    @danrossi
  6. danrossi commented on Jul 30, 2022

    @danrossi

    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

  7. danrossi commented on Jul 30, 2022

    @danrossi

    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)
    
  8. added a commit that references this issue on Apr 22, 2023
  9. self-assigned this
    on Apr 27, 2023
  10. added a commit that references this issue on Apr 27, 2023
  11. added 3 commits that reference this issue on Apr 27, 2023
  12. added a commit that references this issue on Jun 3, 2023
  13. added a commit that references this issue on Jun 3, 2023
  14. added a commit that references this issue on Jun 3, 2023
  15. added a commit that references this issue on Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.12only security fixeseasyextension-modulesC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions