Qt4 always prefers IPv4 over IPv6

Bug #182398 reported by Bernhard Schmidt
8
Affects Status Importance Assigned to Milestone
qt4-x11 (Ubuntu)
Fix Released
Undecided
Rich Johnson

Bug Description

I installed KDE4 on Hardy and Gutsy backports today and noticed that no application (kget, konqueror, ktorrent 3.0beta1 compiled by myself) did connections through IPv6 by default. After spending some time in IRC I found out that Qt4 reorders the results of getaddrinfo() in src/network/qhostinfo_unix.cpp around line 160 and always prefers IPv4.

I have asked around why this was the case and got a few answers that don't really make sense

a) IPv6 causes problems for people with broken resolvers that time out/SERVFAIL on AAAA queries
True, but the reordering does not fix this problem, as getaddrinfo() is called with AF_UNSPEC nevertheless. Quite some work has gone into Ubuntu libc6 to avoid AAAA queries at all if no global IPv6 address is configured, so this is no cause in Ubuntu

b) The "old default" sorting (IPv6 before IPv4) loaded the module automatically since it was trying to connect() to an AF_INET6 address first.
True, but not an issue in Ubuntu due to the changes in libc6. Also, all Ubuntu boxes I had so far had IPv6 automatically loaded at boot. And the reordering only delays the autoloading until you hit the first dualstack node that is down and falls back to IPv6

c) Other issues might cause IPv6 to be considered usable when it is actually broken, timing out on connects.
True, but one should fix the root cause, not a symptom. After all the Qt4 changes don't hit ssh, telnet, Mozilla applications, gnome applications and so on. In fact, different behaviour might confuse people even more.

d) IPv6 is probably slower due to being tunneled
Erm, I don't know where some people live, but we have 10GE pipes with native IPv6 here. And even if it was always slower, IPv6 is usually an opt-in game at the moment.

The fix is easy, please change the addresses.prepend(addr) to addresses.append(addr) in src/network/qhostinfo_unix.cpp:169. I've reported the bug upstream at trolltech as well.

Tags: kde4
Revision history for this message
Bernhard Schmidt (berni) wrote :

argh, the first sentence should end "did NOT do connections through IPv6 by default".

Revision history for this message
Bernhard Schmidt (berni) wrote :
Revision history for this message
Bernhard Schmidt (berni) wrote :

Trolltech fixed the bug (after some persuasion), the fix is sheduled to be included in Qt 4.4. If this version is going to be included in Hardy feel free to close this bug, if not please apply a patch to the package (Trolltech fixed it exactly as I proposed, they changed prepend to append).

Revision history for this message
Rich Johnson (nixternal) wrote :

I will mark this as fix committed due to the fact that the trolls have gone ahead and fixed it upstream for 4.4. If 4.4 is out prior to April, then there is a good chance this will get into Hardy, if not, then I am sure it will be backported so we can get KDE 4.1 into Hardy in August.

Changed in qt4-x11:
assignee: nobody → nixternal
status: New → Fix Committed
Revision history for this message
Jonathan Thomas (echidnaman) wrote :

Qt 4.4 got backported to Hardy, so marking Fixed.

Changed in qt4-x11:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.