staging: usbip: Fix IPv6 support in usbipd
authorDominik Paulus <dominik.paulus@fau.de>
Fri, 13 Sep 2013 09:55:51 +0000 (11:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Sep 2013 23:35:56 +0000 (16:35 -0700)
commitf49ad35cd1241a278f073b6674e38eef7dd78c11
tree45c051b6d8277c65c8e2f3ff4c57a16e8d69ecca
parent414ef695c491ae1d496d10de0660550fe79abdbf
staging: usbip: Fix IPv6 support in usbipd

getaddrinfo() leaves the order of the returned addrinfo structs
unspecified. On systems with bindv6only disabled (this is the default),
PF_INET6 sockets bind to IPv4, too. Thus, IPv6 support in usbipd was
broken when getaddrinfo returned first IPv4 and then IPv6 addrinfos, as
the IPv6 bind failed with EADDRINUSE.

This patch uses seperate sockets for IPv4 and IPv6 and sets IPV6_V6ONLY
on all IPv6 sockets. Two command line arguments, -4 and -6 were added to
manually select the socket family.

Signed-off-by: Tobias Polzer <tobias.polzer@fau.de>
Signed-off-by: Dominik Paulus <dominik.paulus@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/usbip/userspace/src/usbip_network.c
drivers/staging/usbip/userspace/src/usbip_network.h
drivers/staging/usbip/userspace/src/usbipd.c