Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 IPSet difference returning v4-mapped result #153

Open
silverwind opened this issue Feb 17, 2017 · 4 comments
Open

IPv6 IPSet difference returning v4-mapped result #153

silverwind opened this issue Feb 17, 2017 · 4 comments

Comments

@silverwind
Copy link

>>> import netaddr
>>> a = netaddr.IPSet()
>>> b = netaddr.IPSet()
>>> a.add("::/126")
>>> b.add("::/127")
>>> a.difference(b)
IPSet(['::0.0.0.2/127'])

Is the ::0.0.0.2/127 result expected? How would one get it into regular IPv6 format? I've tried ipnetwork.ipv6(ipv4_compatible=False) but it doesn't change it, unfortunately.

@snordhausen
Copy link
Contributor

I get the expected IPSet(['::2/127']) on my system. I tested netaddr version 0.7.19 with Python 2.7 & netaddr 0.7.14 with Python 3.5, both on Linux. Which versions/OS are you using?

@silverwind
Copy link
Author

silverwind commented Feb 17, 2017

I see the issue on macOs 10.12.4, Python 3.6.0, netAddr 0.7.19. On Linux with Python 3.6.0 and netAddr 0.7.19 it indeed works as expected.

Why is this stuff platform-dependant?

@Akasurde
Copy link

Same here - macOs 10.13.4, Python 3.6.4, netAddr 0.7.19

@jstasiak
Copy link
Contributor

jstasiak commented Jul 3, 2020

This is likely caused by inet_ntop working differently on Mac, see #82.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants