[issue15617] FAIL: test_create_connection (test.test_socket.NetworkConnectionNoServer)

Martin v. Löwis report at bugs.python.org
Fri Aug 10 16:39:36 CEST 2012


Martin v. Löwis added the comment:

I was about to say that I agree that AI_ADDRCONFIG should be used in create_connection. However, RFC 3493 deviates from RFC 2553 by stating

"""If the AI_ADDRCONFIG flag is specified, IPv4 addresses shall be
   returned only if an IPv4 address is configured on the local system,
   and IPv6 addresses shall be returned only if an IPv6 address is
   configured on the local system.  The loopback address is not
   considered for this case as valid as a configured address.
"""

If this is taken literally, then it would not be possible to connect anymore to localhost if you have no IP address configured except for the loopback addresses - which in turn would make the test fail also (and would clearly be undesirable).

OSX clearly ignores that RFC - even with no IPv4 address configured, I get a result that includes 127.0.0.1. I wonder how other systems respond to 

socket.getaddrinfo('localhost', 80, 0, socket.SOCK_STREAM, 0, socket.AI_ADDRCONFIG)

if all interfaces except for lo are down (remember to reactivate the interfaces before posting a response to the bug tracker :-)

Any patch needs to be careful to use the flag only if available. Microsoft points out that the flag works only on Vista+. Not sure whether it just has no effect on XP, or makes the call fail.

----------
nosy: +loewis

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15617>
_______________________________________


More information about the Python-bugs-list mailing list