Daniel Berlin <dberlin@dberlin.org> writes:
> I can reproduce your problem, i know what it is.
>
> You have ::1 localhost and 127.0.0.1 localhost in /etc/hosts
My /etc/hosts contained
127.0.0.1 localhost
and
::1 ip6-localhost ip6-loopback
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
but I have just removed all the :: lines and it makes no difference.
> It prefers the ::1 over 127.0.0.1, and thus gives us back the ipv6
> address, even though we can't even use ipv6.
> This is dumb.
When APR calls getaddrinfo it gets
(gdb) p ai_list[0]
$1 = {ai_flags = 1, ai_family = 10, ai_socktype = 1, ai_protocol = 6,
ai_addrlen = 28, ai_addr = 0x8051f30, ai_canonname = 0x0,
ai_next = 0x8051f50}
(gdb) p ai_list[0].ai_addr[0]
$3 = {sa_family = 10, sa_data = "\016j", '\0' <repeats 11 times>}
(gdb) p ai_list[0].ai_next[0]
$4 = {ai_flags = 1, ai_family = 2, ai_socktype = 1, ai_protocol = 6,
ai_addrlen = 16, ai_addr = 0x8051f70, ai_canonname = 0x0, ai_next = 0x0}
(gdb) p ai_list[0].ai_next[0].ai_addr[0]
$5 = {sa_family = 2, sa_data = "\016j", '\0' <repeats 11 times>}
I not a network expert but I think ai_family=10 is PF_INET6 and
ai_family=2 is PF_INET, so APR is being given both with ipv6 first.
> Server side, i can just add a -6 parameter and make people who want ipv6
> support use it.
>
>
> Client side, this is going to be stupid.
> I'd have to do a v6 lookup and connect, then a v4 lookup and connect, or
> something.
> I'm not sure what to do, i guess we have three options:
>
> 1. Say this an apr bug.
> 2. Say this is user error for having localhost resolve to ::1 when you
> have no ipv6 support loaded
> 3. Prefer ipv4 over ipv6 (or vice versa) in the client.
> 4. Do the same runtime check neon does to see if we support ipv6 before
> letting apr decide we can use it on it's own.
>
> Neon avoids this problem by triyng to create an ipv6 socket at runtime
> first, and if it fails, avoid asking anything about IPV6:
>
> hints.ai_family = ipv6_disabled ? AF_INET : AF_UNSPEC;
> addr->errnum = getaddrinfo(hostname, NULL, &hints,
> &addr->result);
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 4 03:45:10 2005