python / cpython

The Python programming language
https://www.python.org
Other
63.54k stars 30.44k forks source link

ipaddress - is_global method all multicast addresses and networks return true #81930

Open 56e9bb80-d951-4150-a4f0-0f60c90db603 opened 5 years ago

56e9bb80-d951-4150-a4f0-0f60c90db603 commented 5 years ago
BPO 37749
Nosy @bjames
PRs
  • python/cpython#15088
  • 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: ```python assignee = None closed_at = None created_at = labels = ['library', '3.9'] title = 'ipaddress - is_global method all multicast addresses and networks return true' updated_at = user = 'https://github.com/bjames' ``` bugs.python.org fields: ```python activity = actor = 'cheryl.sabella' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'bjames' dependencies = [] files = [] hgrepos = [] issue_num = 37749 keywords = ['patch'] message_count = 1.0 messages = ['348942'] nosy_count = 2.0 nosy_names = ['pmoody', 'bjames'] pr_nums = ['15088'] priority = 'normal' resolution = None stage = 'patch review' status = 'open' superseder = None type = None url = 'https://bugs.python.org/issue37749' versions = ['Python 3.9'] ```

    56e9bb80-d951-4150-a4f0-0f60c90db603 commented 5 years ago

    When using the ipaddress library, all multicast addresses and networks return True when using the is_global method for their respective classes. I believe their are two possible fixes for this.

    1) In practice no multicast addresses are globally routable. If our definition of is_global means the address is globally routable, then I propose adding not is_multicast to each class's is_global logic.

    2) RFC 5771 (IPv4) and RFCs 4291 and 7346 (IPv6) both have guidelines for what MAY be routed on the public internet (as mentioned above multicast is not routed globally in practice). Logic following those guidelines should be added.

    IPv4: 224.0.1.0/24, AD-HOC I, II and III addresses 224.0.2.0 - 224.0.255.255, 224.3.0.0 - 224.4.255.255, and 233.252.0.0 - 233.255.255.255

    IPv6: Multicast addresses with 0xE in the SCOPE field

    The current logic is inaccurate when looking at the relevant RFCs and worse when looking at how routing is actually implemented.

    Github PR submitted for option 1 above. I've also submitted a thread to NANOG's mailing list (currently pending moderator approval) posing a few questions regarding the RFCs above. I think it's unlikely that multicast will ever be publicly routed on the internet, so really we just need to define global here. My definition would be addresses that are routed on the public internet.