[Xorp-hackers] Is localhost IPv4 or IPv6?

Mark Handley M.Handley at cs.ucl.ac.uk
Wed Aug 16 15:18:46 PDT 2006


Thanks - I'll verify that this fixes the random test failures.

 - Mark

On 8/16/06, Atanu Ghosh <atanu at icsi.berkeley.edu> wrote:
> Hi,
>
> Either IPv4 or IPv6 addresses are acceptable as a resolution for
> localhost, getting a mix is not useful.
>
> I have changed localhost to 127.0.0.1 where appropriate.
>
>   Atanu.
>
> >>>>> "Mark" == Mark Handley <M.Handley at cs.ucl.ac.uk> writes:
>
>     Mark> I'm getting random test failures on MacOS 10.4.7 (intel):
>     Mark> Entering ./test_peering1.sh   -l -t test34^M
>     Mark> local_config 65008 192.150.187.78^M
>     Mark> register_rib^M
>     Mark> add_peer localhost 10001 localhost 20001 65008 192.150.187.78 30^M
>     Mark> [ 2006/08/16 11:12:11  WARNING xorp_bgp:3089 XrlBgpTarget +478 bgp_base.cc hand\
>     Mark> le_bgp_0_2_add_peer ] Handling method for bgp/0.2/add_peer failed: XrlCmdError \
>     Mark> 102 Command failed AddressFamilyMismatch from line 61 of iptuple.cc: mismatch l\
>     Mark> ocalhost localhost^M
>     Mark> [ 2006/08/16 11:12:11  ERROR call_xrl:3098 XRL +59 call_xrl.cc response_handler\
>     Mark> ] Failed.  Reason: 102 Command failed AddressFamilyMismatch from line 61 of ip\
>     Mark> tuple.cc: mismatch localhost localhost ("finder://bgp/bgp/0.2/add_peer?local_ip\
>     Mark> :txt=localhost&local_port:u32=10001&peer_ip:txt=localhost&peer_port:u32=20001&a\
>     Mark> s:u32=65008&next_hop:ipv4=192.150.187.78&holdtime:u32=30")^M
>     Mark> ./test_peering1.sh: Tests Failed^M
>     Mark> SIGTERM received. Exiting.^M
>     Mark> ./test_peering1.sh: Tests Failed^M
>     Mark> ./test_peering1.sh: Tests Failed^M
>     Mark> FAIL: test_peering1.sh^M
>
>
>     Mark> Seemed very odd.  The AF of localhost is not the same as the AF of
>     Mark> localhost.  I can't reproduce this error by running test34 by itself -
>     Mark> I only saw it in the middle of the entire test suite.  It's not always
>     Mark> the same test that fails either, I've also seen test12 fail.
>
>     Mark> I instrumented the code, and it turns out that AF for _local_sock is
>     Mark> 30 (IPv6) and AF for _peer_sock is 2 (IPv4) in the particular case I
>     Mark> observed, although both are specified as simply "localhost".
>
>     Mark> So, under some circumstances MacOS decides to default to IPv6 for the
>     Mark> IP address for "localhost" if you don't specify the AF.  This is
>     Mark> presumably reasonable, as the default /etc/hosts file contains:
>
>     Mark> ##
>     Mark> # Host Database
>     Mark> #
>     Mark> # localhost is used to configure the loopback interface
>     Mark> # when the system is booting.  Do not change this entry.
>     Mark> ##
>     Mark> 127.0.0.1       localhost
>     Mark> 255.255.255.255 broadcasthost
>     Mark> ::1             localhost
>
>     Mark> I don't understand what the circumstances are where it chooses IPv4 vs
>     Mark> IPv6, but it seems like perhaps we should not be specifying localhost
>     Mark> by name in the test suite, but by IP address instead.
>
>     Mark> - Mark
>



More information about the Xorp-hackers mailing list