Bug 549892 - glibc default address selection policy should prefer ipv4 addresses
Summary: glibc default address selection policy should prefer ipv4 addresses
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 11
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Andreas Schwab
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-12-22 22:25 UTC by Jason Merrill
Modified: 2010-01-26 21:02 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2010-01-25 17:18:00 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jason Merrill 2009-12-22 22:25:25 UTC
Description of problem:

Currently, when a hostname resolves to both ipv4 and ipv6 addresses, curl and firefox try the ipv6 address first.  With current network hardware, this is less likely to work; until ipv6 functionality is more universal, the ipv4 address should be preferred.  Many consumer-level routers (such as the two I have) seem to just drop ipv6 packets on the floor.

RFC 3484 talks about configuring this preference in section 10.3.  I could override it myself via gai.conf, but I doubt I am the only one for whom this is an issue.

Version-Release number of selected component (if applicable):

glibc-2.10.2-1.i686

How reproducible:

Always

Steps to Reproduce:
1. curl -v fedoraproject.org
  
Actual results:

* About to connect() to fedoraproject.org port 80 (#0)
*   Trying 2610:28:200:1::fed0:1... Timeout [after 1 minute wait]
*   Trying 66.35.62.162... connected

Expected results:

* About to connect() to fedoraproject.org port 80 (#0)
*   Trying 66.35.62.162... connected

Additional info:

curl-7.19.7-3.fc11.i586

Comment 1 Jason Merrill 2009-12-22 22:53:29 UTC
Hmm, the gai.conf precedence lines from the man page adjusted as suggested in 10.3 of the RFC don't produce the desired result for me:

       precedence  ::1/128       50
       precedence  ::/0          40
       precedence  2002::/16     30
       precedence ::/96          20
       precedence ::ffff:0:0/96  100

and curl/firefox are still trying the ipv6 address first, even after a reboot.

There's also a typo ("precendence") in those lines in the man page, but I get the same behavior with either spelling (or with no gai.conf).

Comment 2 Andreas Schwab 2010-01-04 14:17:54 UTC
What do you get from getent ahosts fedoraproject.org?

Comment 3 Jason Merrill 2010-01-05 02:33:22 UTC
2610:28:200:1::fed0:1 STREAM fedoraproject.org
2610:28:200:1::fed0:1 DGRAM  
2610:28:200:1::fed0:1 RAW    
66.35.62.162    STREAM 
66.35.62.162    DGRAM  
66.35.62.162    RAW    
80.239.156.214  STREAM 
80.239.156.214  DGRAM  
80.239.156.214  RAW    
152.46.7.221    STREAM 
152.46.7.221    DGRAM  
152.46.7.221    RAW

Comment 4 Andreas Schwab 2010-01-05 10:23:14 UTC
You need to fix your network configuration, glibc is following RFC 3484.

Comment 5 Jason Merrill 2010-01-05 13:51:53 UTC
Regardless of the default, surely gai.conf should work as documented?

From /usr/share/doc/glibc-common*/gai.conf:

#    For sites which prefer IPv4 connections change the last line to
#
precedence ::ffff:0:0/96  100

...but this doesn't work.

Comment 6 Andreas Schwab 2010-01-25 17:18:00 UTC
If you are behind a NAT you need to adjust the scope table so that your interface address is no longer classified as link-local.  Otherwise a global scope address will never match.

Comment 7 Jason Merrill 2010-01-26 21:02:46 UTC
I have no idea how to do that, and it seems rather unfortunate to require users in an extremely common situation (i.e. behind a consumer-level NAT router) to jump through so many hoops to get basic functionality to work properly.


Note You need to log in before you can comment on or make changes to this bug.