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

[LIBCLOUD-601] Add check windows os in is_valid_ip_address to run inet_aton #343

Closed
wants to merge 3 commits into from

Conversation

ashangit
Copy link

No description provided.

@@ -73,7 +74,10 @@ def is_valid_ip_address(address, family=socket.AF_INET):
:return: ``bool`` True if the provided address is valid.
"""
try:
socket.inet_pton(family, address)
if (platform.system() == 'Windows'):
socket.inet_aton(address)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there is still an edge case with IPv6 which inet_aton doesn't support, but inet_pton does.

Maybe we should throw if running on Windows and user specifies family=socket.AF_INET6.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact there is an issue with IPv6 when using inet_aton.
So we could throw an exception or use an external library dnspython wihich provide inet_aton for ipv4 and ipv6 and for windows also.
Let me know if adding such library is something acceptable or I will just add the throw.

@Kami
Copy link
Member

Kami commented Jun 20, 2015

Sorry for the delay. I've added a check for validating IPv6 address on Windows (e105433) and merged changes into trunk.

Thanks.

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

Successfully merging this pull request may close these issues.

2 participants