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

getmyip doesn't raise InternetConnectivityError #73

Open
aaaaalbert opened this issue Jun 17, 2014 · 0 comments
Open

getmyip doesn't raise InternetConnectivityError #73

aaaaalbert opened this issue Jun 17, 2014 · 0 comments
Labels

Comments

@aaaaalbert
Copy link
Collaborator

When I go offline with my Mac OS X 10.6.8 machine, getmyip() yields 127.0.0.1, but doesn't raise an InternetConnectivityError. This has implications for components like the nodemanager and its advertise thread.
What happens is that when emulcomm's _is_valid_ip_address function is employed to check the local IP of a test socket, it happily returns localhost (after performing a couple of weird checks that have nothing to do with the validity of the address as such).


I think the desired function would be _is_ipv4_address_loopback_or_multicast (i.e. from IPv4 address ranges 127/8 or 224/4), and if it is, we take this as an indicator that we aren't connected to the Internet at the moment. Link-local (169.254/16) and this-host-on-this-network (0/8) would be further logical candidates. A larger list of potentially un-routeable adresses is available from RFC6890.

It might be worth the effort to write up a little IPv4 library to abstract out this (and other) functionality so it can be reused with greater ease.


A side effect of fixing this issue could be that user code needs to be amended to correctly run offline by catching the InternetConnectivityError (which isn't necessary at the moment). It's fine to continue then by just letting, e.g., the local IP in a socket operation be 127.0.0.1, but you would need to be explicit.

@aaaaalbert aaaaalbert added the bug label Jun 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant