STINNER Victor added the comment:

I spoke with schmir on IRC about this issue because he considers the request as 
valid, and he doesn't understand why the issue was closed with "wont fix".

--

schmir use case:

 - a network where IPv6 doesn't work (for an unknown reason)
 - a Linux system with IPv6 support and a network interface with a local link 
address (fe80:...), maybe also with a IPv6 public address (it doesn't really 
matter for the use case)
 - Python configured with --disable-ipv6 "to ensure that Python will not send 
any IPv6 request" (according to schmir) (./configure --disable-ipv6)
 - the DNS client is configured to return IPv4 addresses and then IPv6 addresses
 - call socket.create_connection((hostname, 80))
 - the computer cannot connect to this host in IPv4 nor IPv6

Current behaviour:

 - Python calls getaddrinfo() with ai_family=0 (AF_UNSPEC)
 - the DNS client (of the glibc) asks for A (IPv4) and AAAA (IPv6) DNS records
 - Python tries to connect to the IPv4 address and fails (connection error for 
example)
 - Python tries to connect to the IPv6 address and fails with a TypeError 
because AF_INET6 is not supported
 - the final exception is misleading: TypeError instead of a connection error

schmir expects that --disable-ipv6 would "really" disable IPv6 *everywhere* in 
Python, which is wrong. Python may still get IPv6 adddresses from getaddrinfo() 
if the system does somehow support IPv6.

schmir proposes the change create_connection() to really disable IPv6 there: 
force AF_INET if socket.has_ipv6 is False.
https://github.com/SiteSupport/gevent/commit/9b1bccffc11455112076189f35023291cf97a2a2

I agree that something is wrong here, but I also disagree with schmir. In my 
opinion, --disable-ipv6 is the wrong answer to the initial problem (ensure that 
the computer will not use IPv6 because IPv6 doesn't work somewhere in the 
network). The correct solution is to disable IPv6 system wide. See for example 
https://wiki.archlinux.org/index.php/IPv6#Disable_IPv6 to disable IPv6 system 
wide on Linux.

It's simpler and safer to disable IPv6 system wide instead of fixing all 
applications. Other applications will have the same issue (ask AAAA DNS 
records) in the same use case.

"wont fix" is the correct status for this issue: we agree that there is a bug, 
but it will not be fixed, because --disable-ipv6 is the wrong solution.

--

Note: ai_flags=AI_ADDRCONFIG would not change anything because the network 
interface has an IPv6 local link address. See 
http://sourceware.org/bugzilla/show_bug.cgi?id=12377 for a discussion about 
this in the glibc.

Note: schmir uses Gentoo and disabled the ipv6 use flag of its python package 
(USE=-ipv6).

----------
nosy: +haypo

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7735>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to