tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

IPv6 socket behaviour different to IPv4?



I'm trying to get the IPFilter test suite up and running on NetBSD
and I've come to my first hurdle.

netbsd ~/ipf-test-suite# wget -O /dev/null ftp://192.168.200.2//pub/test_data.txt
--2014-06-01 17:43:55--  ftp://192.168.200.2//pub/test_data.txt
           => '/dev/null'
Connecting to 192.168.200.2:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /pub ... done.
==> SIZE test_data.txt ... 68
==> PASV ... done.    ==> RETR test_data.txt ... done.
Length: 68 (unauthoritative)

100%[=============================================================>] 68 --.-K/s in 0s

2014-06-01 17:43:56 (3.89 MB/s) - '/dev/null' saved [68]

netbsd ~/ipf-test-suite# wget -O /dev/null 'ftp://[192:168:200::2]//pub/test_data.txt'
--2014-06-01 17:44:23--  ftp://[192:168:200::2]//pub/test_data.txt
           => '/dev/null'
Connecting to [192:168:200::2]:21... failed: Can't assign requested address.
Retrying.

What actually gets tried?

  3354      1 wget     write(0x2, 0xffffffffffffaf70, 0x5d) = 93
"--2014-06-01 17:45:48-- ftp://[192:168:200::2]//pub/test_data.txt\n (try: 2) => '/dev/null"
  3354      1 wget     write(0x2, 0xffffffffffffab20, 0x25) = 37
       "Connecting to [192:168:200::2]:21... "
  3354      1 wget     __socket30(0x18, 0x1, 0)    = 4
3354 1 wget connect(0x4, 0xffffffffffffada0, 0x1c) Err#49 EADDRNOTAVAIL
  3354      1 wget     close(0x4)                  = 0

so it presumably gets an IPv6 socket but that then connect fails because
the network interface is down?

hme0: flags=8063<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu 1500
capabilities=3c00<TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx>
        enabled=0
        ec_capabilities=1<VLAN_MTU>
        ec_enabled=0
        address: 08:00:20:b6:cd:99
        media: Ethernet autoselect (none)
        status: no carrier
        inet 192.168.200.2 netmask 0xffffff00 broadcast 192.168.200.255
inet6 fe80::a00:20ff:feb6:cd99%hme0 prefixlen 64 detached scopeid 0x2
        inet6 192:168:200::2 prefixlen 48 detached

So the "IN6_IFF_DETACHED" flag is set from usr/src/sys/netinet/in6.c here:
in6_update_ifa1()
...
        if (ifp->if_link_state == LINK_STATE_DOWN) {
                ia->ia6_flags |= IN6_IFF_DETACHED;
...

Which means that the kernel never finds an active address to use when
it calls in6_ifawithifp().

Should the behaviour of the kernel be changed such that it behaves the
same way for IPv6 sockets connecting to IP addresses on network intefaces
that are down as it does for IPv4 sockets?

Or should the IPv4 behaviour be changed?

Or just leave it as it is?

Darren



Home | Main Index | Thread Index | Old Index