io: use bind() to check for IPv4/6 availability
commit0a27af918b9cfb7fc1605c66dfc70700be16fab5
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 8 Mar 2016 11:39:36 +0000 (8 11:39 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 10 Mar 2016 17:10:18 +0000 (10 17:10 +0000)
tree3c361913d997f0c634e031d98f491587e00ef08f
parentc619644067f98098dcdbc951e2dda79e97560afa
io: use bind() to check for IPv4/6 availability

Currently the test-io-channel-socket.c test uses getifaddrs
to see if an IPv4/6 address is present on any host NIC, as
a way to determine if IPv4/6 sockets can be used. This is
problematic because getifaddrs is not available on Win32.

Rather than testing indirectly via getifaddrs, just create
a socket and try to bind() to the loopback address instead.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tests/test-io-channel-socket.c