net001 test failure

Simon Marlow simonmarhaskell at
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 

   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)
         (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 =, 
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?


More information about the Libraries mailing list