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
ipaddress module fails on rfc4007 scoped IPv6 addresses #78969
ipaddress module has no support for scoped IPv6 addresses which prevents the use of ipaddress.ip_address() and ipaddress.IPv6Address() with (always available by default on IPv6 systems) RFC conforming IPv6 link local addresses that specify interface scope.
This is bad because interface scope is required for connect() and bind() operations on multihomed machines, and virtualized or software defined networking will make this case very common.
eg.
>>> ipaddress.IPv6Address('fe80::dead:dead:beef:ffff')
IPv6Address('fe80::dead:dead:beef:ffff')
>>> ipaddress.IPv6Address('fe80::dead:dead:beef:ffff%eth0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ipaddress.py", line 1900, in __init__
self._ip = self._ip_int_from_string(addr_str)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ipaddress.py", line 1716, in _ip_int_from_string
raise AddressValueError("%s in %r" % (exc, ip_str)) from None
ipaddress.AddressValueError: Only hex digits permitted in 'ffff%eth0' in 'fe80::dead:dead:beef:ffff%eth0'
>>> ipaddress.IPv6Interface('fe80::dead:dead:beef:ffff%eth0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ipaddress.py", line 2060, in __init__
IPv6Address.__init__(self, addr[0])
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ipaddress.py", line 1900, in __init__
self._ip = self._ip_int_from_string(addr_str)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ipaddress.py", line 1716, in _ip_int_from_string
raise AddressValueError("%s in %r" % (exc, ip_str)) from None
ipaddress.AddressValueError: Only hex digits permitted in 'ffff%eth0' in 'fe80::dead:dead:beef:ffff%eth0'
I think this is something that would be good to have. Jeremy would you care to make a PR for this?
mic4ael commented on Apr 11, 2019
mic4aelmannequin
Mannequin
More actions
I would like to fix this problem if nobody is against that. I stumbled upon the very same thing recently and I think it would be a nice opportunity to contribute.
JeremyMcMillan commented on Apr 11, 2019
JeremyMcMillanmannequin
MannequinAuthor
More actions
I think the code in SaltStack to handle scoped IPv6 addresses is mature, so please look at these examples.
FWIW: Marking Component: Documentation means that the issue is only about changing the doc. Hence the auto-assignment to the nebulous docs group, which no longer exists in the form it once did. Enhancement issues nearly always need a doc change but are not marked 'Documentation'. I am not sure what Jeremy's original intent was, but the actual PR is mostly code implementing and testing the newly documented addition.
Activity
JeremyMcMillan commentedon Sep 24, 2018
ipaddress module has no support for scoped IPv6 addresses which prevents the use of ipaddress.ip_address() and ipaddress.IPv6Address() with (always available by default on IPv6 systems) RFC conforming IPv6 link local addresses that specify interface scope.
https://tools.ietf.org/html/rfc4007
This is bad because interface scope is required for connect() and bind() operations on multihomed machines, and virtualized or software defined networking will make this case very common.
eg.
JeremyMcMillan commentedon Sep 25, 2018
subclass workaround implementation example
https://github.com/isbm/salt/blob/976fe19d73ca6bf5df375eaa15d77ce4a5a54b7a/salt/_compat.py#L125
lisroach commentedon Oct 30, 2018
I think this is something that would be good to have. Jeremy would you care to make a PR for this?
mic4ael commentedon Apr 11, 2019
I would like to fix this problem if nobody is against that. I stumbled upon the very same thing recently and I think it would be a nice opportunity to contribute.
JeremyMcMillan commentedon Apr 11, 2019
I think the code in SaltStack to handle scoped IPv6 addresses is mature, so please look at these examples.
https://github.com/saltstack/salt/blob/2085cb1078f187adf82a0cf19b39d350ff1bbd50/salt/_compat.py#L125
opavlyuk commentedon Jul 3, 2019
Pull request needs a review.
terryjreedy commentedon Jul 15, 2019
FWIW: Marking Component: Documentation means that the issue is only about changing the doc. Hence the auto-assignment to the nebulous docs group, which no longer exists in the form it once did. Enhancement issues nearly always need a doc change but are not marked 'Documentation'. I am not sure what Jeremy's original intent was, but the actual PR is mostly code implementing and testing the newly documented addition.
opavlyuk commentedon Aug 2, 2019
Please, pay attention to this issue. Pull request needs core review.
terryjreedy commentedon Feb 4, 2020
Nick, can you comment on this and review the revised PR?
miss-islington commentedon Feb 26, 2020
New changeset 21da76d by opavlyuk in branch 'master':
bpo-34788: Add support for scoped IPv6 addresses (GH-13772)
21da76d