net001 test failure

Simon Marlow simonmarhaskell at gmail.com
Tue Jun 12 04:13:00 EDT 2007


The test net001 from the network package is failing on my RedHat 9 box, so I 
went investigating.  Bear in mind I'm completely ignorant of IPV6.  This test 
invokes

   Network.listenOn (PortNumber 22222)

and gets:

   socket: unsupported operation (Address family not supported by protocol)

This machine has getaddrinfo(), so the IPV6 support is enabled.  listenOn does this:

     proto <- getProtocolNumber "tcp"
     let hints = defaultHints { addrFlags = [AI_ADDRCONFIG, AI_PASSIVE]
                              , addrProtocol = proto }
     addrs <- getAddrInfo (Just hints) Nothing (Just serv)
     Exception.bracketOnError
         (socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr))
         ...

and addrs is:

[AddrInfo {addrFlags = [AI_PASSIVE], addrFamily = AF_INET6, addrSocketType = 
Stream, addrProtocol = 6, addrAddress = [::]:22222, addrCanonName = 
Nothing},AddrInfo {addrFlags = [AI_PASSIVE], addrFamily = AF_INET, 
addrSocketType = Stream, addrProtocol = 6, addrAddress = 0.0.0.0:22222, 
addrCanonName = Nothing}]

So the first address in the list is an IPV6 address, but socket refuses to open 
the socket because (I assume) IPV6 is not really supported.

What should we do in this case?  Should listenOn try all the available addresses 
until it finds one that works?

Cheers,
	Simon


More information about the Libraries mailing list