diff --git a/.gitignore b/.gitignore index 51040c6..ffaa70c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /usbredir-0.5.1.tar.bz2 /usbredir-0.5.2.tar.bz2 /usbredir-0.6.tar.bz2 +/usbredir-0.7.tar.bz2 diff --git a/0001-usbredirserver-Allow-connections-from-both-ipv6-and-.patch b/0001-usbredirserver-Allow-connections-from-both-ipv6-and-.patch deleted file mode 100644 index 0ccfd06..0000000 --- a/0001-usbredirserver-Allow-connections-from-both-ipv6-and-.patch +++ /dev/null @@ -1,88 +0,0 @@ -From c7e8bfe7f88ea11b31ebe115a629fb1cc903f7bc Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Tue, 7 May 2013 15:29:09 +0200 -Subject: [PATCH 1/3] usbredirserver: Allow connections from both ipv6 and ipv4 - -The while loop over the getaddrinfo result would bind to the ipv4 addr and -then stop, causing usbredirserver to not accept connections on ipv6. - -Instead bind explicitly to ipv6 with in6addr_any, which accepts connections -from both. - -Signed-off-by: Hans de Goede ---- - usbredirserver/usbredirserver.c | 42 +++++++++++++++++------------------------ - 1 file changed, 17 insertions(+), 25 deletions(-) - -diff --git a/usbredirserver/usbredirserver.c b/usbredirserver/usbredirserver.c -index 7e063a8..c45a27c 100644 ---- a/usbredirserver/usbredirserver.c -+++ b/usbredirserver/usbredirserver.c -@@ -196,9 +196,9 @@ int main(int argc, char *argv[]) - int usbaddr = -1; - int usbvendor = -1; - int usbproduct = -1; -- struct addrinfo *r, *res, hints; -+ int on = 1; -+ struct sockaddr_in6 serveraddr; - struct sigaction act; -- char port_str[16]; - libusb_device_handle *handle = NULL; - - while ((o = getopt_long(argc, argv, "hp:v:", longopts, NULL)) != -1) { -@@ -271,37 +271,29 @@ int main(int argc, char *argv[]) - - libusb_set_debug(ctx, verbose); - -- memset(&hints, 0, sizeof(hints)); -- hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICSERV | AI_PASSIVE; -- hints.ai_family = AF_UNSPEC; -- hints.ai_socktype = SOCK_STREAM; -- hints.ai_protocol = IPPROTO_TCP; -- -- sprintf(port_str, "%d", port); -- if (getaddrinfo(NULL, port_str, &hints, &res) != 0) { -- perror("getaddrinfo"); -+ server_fd = socket(AF_INET6, SOCK_STREAM, 0); -+ if (server_fd == -1) { -+ perror("Error creating ipv6 socket"); - exit(1); - } - -- for (r = res; r != NULL; r = r->ai_next) { -- server_fd = socket(r->ai_family, r->ai_socktype, r->ai_protocol); -- if (server_fd == -1) -- continue; -- -- if (bind(server_fd, r->ai_addr, r->ai_addrlen) == 0) -- break; -- -- close(server_fd); -+ if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) { -+ perror("Error setsockopt(SO_REUSEADDR) failed"); -+ exit(1); - } -- freeaddrinfo(res); -- -- if (r == NULL) { -- fprintf(stderr, "Could not bind to port: %s\n", port_str); -+ -+ memset(&serveraddr, 0, sizeof(serveraddr)); -+ serveraddr.sin6_family = AF_INET6; -+ serveraddr.sin6_port = htons(port); -+ serveraddr.sin6_addr = in6addr_any; -+ -+ if (bind(server_fd, (struct sockaddr *)&serveraddr, sizeof(serveraddr))) { -+ fprintf(stderr, "Error binding port %d: %s\n", port, strerror(errno)); - exit(1); - } - - if (listen(server_fd, 1)) { -- perror("listen"); -+ perror("Error listening"); - exit(1); - } - --- -1.8.2.1 - diff --git a/0002-usbredirserver-testclient-Error-check-fcntl-calls.patch b/0002-usbredirserver-testclient-Error-check-fcntl-calls.patch deleted file mode 100644 index 2501a35..0000000 --- a/0002-usbredirserver-testclient-Error-check-fcntl-calls.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 65b99a49dc4d5d4cf16ba880d3377196e96f1bc5 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Mon, 13 May 2013 09:59:32 +0200 -Subject: [PATCH 2/3] usbredirserver/testclient: Error check fcntl calls - -Signed-off-by: Hans de Goede ---- - usbredirserver/usbredirserver.c | 14 +++++++++++--- - usbredirtestclient/usbredirtestclient.c | 14 ++++++++++++-- - 2 files changed, 23 insertions(+), 5 deletions(-) - -diff --git a/usbredirserver/usbredirserver.c b/usbredirserver/usbredirserver.c -index c45a27c..d2765c6 100644 ---- a/usbredirserver/usbredirserver.c -+++ b/usbredirserver/usbredirserver.c -@@ -189,7 +189,7 @@ static void quit_handler(int sig) - - int main(int argc, char *argv[]) - { -- int o, server_fd = -1; -+ int o, flags, server_fd = -1; - char *endptr, *delim; - int port = 4000; - int usbbus = -1; -@@ -307,8 +307,16 @@ int main(int argc, char *argv[]) - break; - } - -- fcntl(client_fd, F_SETFL, -- (long)fcntl(client_fd, F_GETFL) | O_NONBLOCK); -+ flags = fcntl(client_fd, F_GETFL); -+ if (flags == -1) { -+ perror("fcntl F_GETFL"); -+ break; -+ } -+ flags = fcntl(client_fd, F_SETFL, flags | O_NONBLOCK); -+ if (flags == -1) { -+ perror("fcntl F_SETFL O_NONBLOCK"); -+ break; -+ } - - /* Try to find the specified usb device */ - if (usbvendor != -1) { -diff --git a/usbredirtestclient/usbredirtestclient.c b/usbredirtestclient/usbredirtestclient.c -index a9123da..42b16dc 100644 ---- a/usbredirtestclient/usbredirtestclient.c -+++ b/usbredirtestclient/usbredirtestclient.c -@@ -189,7 +189,7 @@ static void quit_handler(int sig) - - int main(int argc, char *argv[]) - { -- int o; -+ int o, flags; - char *endptr, *server; - struct addrinfo *r, *res, hints; - struct sigaction act; -@@ -265,7 +265,17 @@ int main(int argc, char *argv[]) - exit(1); - } - -- fcntl(client_fd, F_SETFL, (long)fcntl(client_fd, F_GETFL) | O_NONBLOCK); -+ flags = fcntl(client_fd, F_GETFL); -+ if (flags == -1) { -+ perror("fcntl F_GETFL"); -+ exit(1); -+ } -+ flags = fcntl(client_fd, F_SETFL, flags | O_NONBLOCK); -+ if (flags == -1) { -+ perror("fcntl F_SETFL O_NONBLOCK"); -+ exit(1); -+ } -+ - parser = usbredirparser_create(); - if (!parser) { - exit(1); --- -1.8.2.1 - diff --git a/0003-usbredirhost-Fix-coverity-sign_extension-warning.patch b/0003-usbredirhost-Fix-coverity-sign_extension-warning.patch deleted file mode 100644 index aecc9cc..0000000 --- a/0003-usbredirhost-Fix-coverity-sign_extension-warning.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 3f85be6da588d17f272a4b3c9b34bbfb7510f1e7 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Mon, 13 May 2013 10:30:30 +0200 -Subject: [PATCH 3/3] usbredirhost: Fix coverity sign_extension warning - -Coverity does not like uint8_t * int being casted to an uint64_t, change -the int to an unsigned int to make it happy. - -Note that the int in question can never be > 255, so this is not a real issue. - -Signed-off-by: Hans de Goede ---- - usbredirhost/usbredirhost.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c -index da3ef90..09745c2 100644 ---- a/usbredirhost/usbredirhost.c -+++ b/usbredirhost/usbredirhost.c -@@ -1041,7 +1041,8 @@ static int usbredirhost_submit_stream_transfer_unlocked( - static int usbredirhost_start_stream_unlocked(struct usbredirhost *host, - uint8_t ep) - { -- int i, status, count = host->endpoint[EP2I(ep)].transfer_count; -+ unsigned int i, count = host->endpoint[EP2I(ep)].transfer_count; -+ int status; - - /* For out endpoints 1/2 the transfers are a buffer for usb-guest data */ - if (!(ep & LIBUSB_ENDPOINT_IN)) { --- -1.8.2.1 - diff --git a/0004-usbredirhost-Use-libusb_set_auto_detach_kernel_drive.patch b/0004-usbredirhost-Use-libusb_set_auto_detach_kernel_drive.patch deleted file mode 100644 index 01b4242..0000000 --- a/0004-usbredirhost-Use-libusb_set_auto_detach_kernel_drive.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 050f32a35898c8ac8ac47322f21f0ec4928aa065 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Fri, 14 Jun 2013 09:56:20 +0200 -Subject: [PATCH 4/8] usbredirhost: Use libusb_set_auto_detach_kernel_driver - when available - -Signed-off-by: Hans de Goede ---- - usbredirhost/usbredirhost.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c -index 09745c2..0335b37 100644 ---- a/usbredirhost/usbredirhost.c -+++ b/usbredirhost/usbredirhost.c -@@ -499,9 +499,13 @@ static int usbredirhost_claim(struct usbredirhost *host, int initial_claim) - memset(host->alt_setting, 0, MAX_INTERFACES); - - host->claimed = 1; -+#if LIBUSBX_API_VERSION >= 0x01000102 -+ libusb_set_auto_detach_kernel_driver(host->handle, 1); -+#endif - for (i = 0; host->config && i < host->config->bNumInterfaces; i++) { - n = host->config->interface[i].altsetting[0].bInterfaceNumber; - -+#if LIBUSBX_API_VERSION < 0x01000102 - r = libusb_detach_kernel_driver(host->handle, n); - if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND - && r != LIBUSB_ERROR_NOT_SUPPORTED) { -@@ -509,6 +513,7 @@ static int usbredirhost_claim(struct usbredirhost *host, int initial_claim) - n, host->config->bConfigurationValue, libusb_error_name(r)); - return libusb_status_or_error_to_redir_status(host, r); - } -+#endif - - r = libusb_claim_interface(host->handle, n); - if (r < 0) { -@@ -534,6 +539,16 @@ static void usbredirhost_release(struct usbredirhost *host, int attach_drivers) - if (!host->claimed) - return; - -+#if LIBUSBX_API_VERSION >= 0x01000102 -+ /* We want to always do the attach ourselves because: -+ 1) For compound interfaces such as usb-audio we must first release all -+ interfaces before we can attach the driver; -+ 2) When releasing interfaces before calling libusb_set_configuration, -+ we don't want the kernel driver to get attached (our attach_drivers -+ parameter is 0 in this case). */ -+ libusb_set_auto_detach_kernel_driver(host->handle, 0); -+#endif -+ - for (i = 0; host->config && i < host->config->bNumInterfaces; i++) { - n = host->config->interface[i].altsetting[0].bInterfaceNumber; - --- -1.8.3.1 - diff --git a/0005-usbredirparser-Update-header-len-inside-the-usbredir.patch b/0005-usbredirparser-Update-header-len-inside-the-usbredir.patch deleted file mode 100644 index 1081ccf..0000000 --- a/0005-usbredirparser-Update-header-len-inside-the-usbredir.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 931a41c1c92410639a0e76e6fdd07482f06e4578 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Thu, 5 Sep 2013 16:25:13 +0200 -Subject: [PATCH 5/5] usbredirparser: Update header-len inside the - usbredirparser_do_read loop - -If we process the hello packet with the 64 bit id capability bit in the same -loop as other packets (because they were send quickly after one each other), -then we end up reading 48 bytes for the header of the next packets processed -in the same loop, while we should read 64 bytes for them, causing the -sender and receiver to get out of sync. - -Signed-off-by: Hans de Goede ---- - usbredirparser/usbredirparser.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/usbredirparser/usbredirparser.c b/usbredirparser/usbredirparser.c -index b60d3f4..b50ddec 100644 ---- a/usbredirparser/usbredirparser.c -+++ b/usbredirparser/usbredirparser.c -@@ -1011,6 +1011,8 @@ int usbredirparser_do_read(struct usbredirparser *parser_pub) - parser->data = NULL; - if (!r) - return -2; -+ /* header len may change if this was an hello packet */ -+ header_len = usbredirparser_get_header_len(parser_pub); - } - } - } --- -1.8.3.1 - diff --git a/sources b/sources index d646caf..e7ea94e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -1b7ad820be7fd2a0e4ce8261a4389f15 usbredir-0.6.tar.bz2 +bc096f160e4ebb848c3a0f0fbf9500fc usbredir-0.7.tar.bz2 diff --git a/usbredir.spec b/usbredir.spec index f0936ff..dc560d8 100644 --- a/usbredir.spec +++ b/usbredir.spec @@ -1,17 +1,11 @@ Name: usbredir -Version: 0.6 -Release: 5%{?dist} +Version: 0.7 +Release: 1%{?dist} Summary: USB network redirection protocol libraries Group: System Environment/Libraries License: LGPLv2+ URL: http://spice-space.org/page/UsbRedir Source0: http://spice-space.org/download/%{name}/%{name}-%{version}.tar.bz2 -# Some patches from upstream git (drop at next rebase) -Patch1: 0001-usbredirserver-Allow-connections-from-both-ipv6-and-.patch -Patch2: 0002-usbredirserver-testclient-Error-check-fcntl-calls.patch -Patch3: 0003-usbredirhost-Fix-coverity-sign_extension-warning.patch -Patch4: 0004-usbredirhost-Use-libusb_set_auto_detach_kernel_drive.patch -Patch5: 0005-usbredirparser-Update-header-len-inside-the-usbredir.patch BuildRequires: libusb1-devel >= 1.0.9 %description @@ -51,11 +45,6 @@ A simple USB host TCP server, using libusbredirhost. %prep %setup -q -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 %build @@ -89,6 +78,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/libusbredir*.la %changelog +* Wed May 21 2014 Hans de Goede - 0.7-1 +- Update to upstream 0.7 release + * Tue Sep 10 2013 Hans de Goede - 0.6-5 - Use the new libusb autodetach kernel driver functionality - Fix a usbredirparser bug which causes tcp/ip redir to not work (rhbz#1005015)