Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jan 2015 20:38:53 -1000
From:      parv <parv@pair.com>
To:        perl@freebsd.org
Subject:   perl 5.21.7 - test fail of cpan/IO-Socket-IP/t/01local-client-v4.t
Message-ID:  <20150122063853.GA3463@holstein.holy.cow>

next in thread | raw e-mail | index | archive | help
Has anybody noticed the test failure (in perl 5.21.7) related to
socket address in cpan/IO-Socket-IP/t/01local-client-v4.t when
multiple aliases exist for 127.0.0.1 ...

  # cd ~/tmp/perl/perl-5.21.7
  # export LD_LIBRARY_PATH=`pwd`; perl cpan/IO-Socket-IP/t/01local-client-v4.t
  ...
  ok 9 - $socket->peerport for SOCK_STREAM
  not ok 10 - $socket->sockaddr for SOCK_STREAM
  #   Failed test '$socket->sockaddr for SOCK_STREAM'
  #   at cpan/IO-Socket-IP/t/01local-client-v4.t line 66.
  #          got: '7f000002'
  #     expected: '7f000001'
  ok 11 - $socket->peeraddr for SOCK_STREAM
  ok 12 - $socket not connected after close for SOCK_STREAM
  ...
  ok 21 - $socket->peerport for SOCK_DGRAM
  not ok 22 - $socket->sockaddr for SOCK_DGRAM
  #   Failed test '$socket->sockaddr for SOCK_DGRAM'
  #   at cpan/IO-Socket-IP/t/01local-client-v4.t line 66.
  #          got: '7f000002'
  #     expected: '7f000001'
  ok 23 - $socket->peeraddr for SOCK_DGRAM
  ...

... ? The related lines are ...

  # Some odd locations like BSD jails might not like INADDR_LOOPBACK. We'll
  # establish a baseline first to test against
  my $INADDR_LOOPBACK = do {
    socket my $sockh, PF_INET, SOCK_STREAM, 0 or die "Cannot socket(PF_INET) - $!";
    bind $sockh, pack_sockaddr_in( 0, inet_aton( "127.0.0.1" ) ) or die "Cannot bind() - $!";
    ( unpack_sockaddr_in( getsockname $sockh ) )[1];
  };
  my $INADDR_LOOPBACK_HOST = inet_ntoa( $INADDR_LOOPBACK );
  if( $INADDR_LOOPBACK ne INADDR_LOOPBACK ) {
    diag( "Testing with INADDR_LOOPBACK=$INADDR_LOOPBACK_HOST; this may be because of odd networking" );
  }
  my $INADDR_LOOPBACK_HEX = unpack "H*", $INADDR_LOOPBACK;
  .
  .
  .
  is( unpack("H*", $socket->sockaddr), $INADDR_LOOPBACK_HEX, \
    "\$socket->sockaddr for $socktype" );


As I do have these ...

  # ifconfig lo0
  lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0xd
    inet6 ::1 prefixlen 128
    inet 127.0.0.1 netmask 0xff000000
    inet 127.0.0.2 netmask 0xffffff00
    inet 127.0.0.3 netmask 0xffffff00
    inet 127.0.0.4 netmask 0xffffff00
    nd6 options=3<PERFORMNUD,ACCEPT_RTADV>


... should test failures be expected, and are not a problem?


  - parv

-- 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150122063853.GA3463>