diff --git a/.gitignore b/.gitignore index 3d84488..08a3262 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/usbredir-0.6.tar.bz2 +SOURCES/usbredir-0.7.1.tar.bz2 diff --git a/.usbredir.metadata b/.usbredir.metadata index 4389e0e..8b685aa 100644 --- a/.usbredir.metadata +++ b/.usbredir.metadata @@ -1 +1 @@ -5f931b9c05fc7cefa68bd05f59d28b201661777e SOURCES/usbredir-0.6.tar.bz2 +baa5d8fcdb3246052fbfac86aee750ae8d33c4fd SOURCES/usbredir-0.7.1.tar.bz2 diff --git a/SOURCES/0001-usbredirhost-Fix-Wformat-warning.patch b/SOURCES/0001-usbredirhost-Fix-Wformat-warning.patch new file mode 100644 index 0000000..8d7c849 --- /dev/null +++ b/SOURCES/0001-usbredirhost-Fix-Wformat-warning.patch @@ -0,0 +1,84 @@ +From 086ececd5f7f6bd8668f11d8811bf8badb9d8c5d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= +Date: Tue, 3 Nov 2015 10:35:22 +0100 +Subject: [PATCH] usbredirhost: Fix -Wformat warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use "PRIu64" macro for printf-ing uint64_t variables, avoiding warnings +like: +usbredirhost.c: In function 'usbredirhost_can_write_iso_package': +usbredirhost.c:1023:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("START dropping isoc packets %lu buffer > %lu hi threshold", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + ^ +usbredirhost.c:1023:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("START dropping isoc packets %lu buffer > %lu hi threshold", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + ^ +usbredirhost.c:1028:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("STOP dropping isoc packets %lu buffer < %lu low threshold", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + ^ +usbredirhost.c:1028:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("STOP dropping isoc packets %lu buffer < %lu low threshold", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + ^ +usbredirhost.c: In function 'usbredirhost_set_iso_threshold': +usbredirhost.c:1162:11: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("higher threshold is %lu bytes | lower threshold is %lu bytes", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + ^ +usbredirhost.c:1162:11: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] + DEBUG("higher threshold is %lu bytes | lower threshold is %lu bytes", + ^ +usbredirhost.c:181:57: note: in definition of macro 'DEBUG' + #define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__) + +Signed-off-by: Fabiano FidĂȘncio +--- + usbredirhost/usbredirhost.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c +index adf9c5f..83baa3b 100644 +--- a/usbredirhost/usbredirhost.c ++++ b/usbredirhost/usbredirhost.c +@@ -1020,12 +1020,12 @@ static int usbredirhost_can_write_iso_package(struct usbredirhost *host) + size = host->buffered_output_size_func(host->func_priv); + if (size >= host->iso_threshold.higher) { + if (!host->iso_threshold.dropping) +- DEBUG("START dropping isoc packets %lu buffer > %lu hi threshold", ++ DEBUG("START dropping isoc packets %" PRIu64 " buffer > %" PRIu64 " hi threshold", + size, host->iso_threshold.higher); + host->iso_threshold.dropping = true; + } else if (size < host->iso_threshold.lower) { + if (host->iso_threshold.dropping) +- DEBUG("STOP dropping isoc packets %lu buffer < %lu low threshold", ++ DEBUG("STOP dropping isoc packets %" PRIu64 " buffer < %" PRIu64 " low threshold", + size, host->iso_threshold.lower); + + host->iso_threshold.dropping = false; +@@ -1159,7 +1159,7 @@ static void usbredirhost_set_iso_threshold(struct usbredirhost *host, + uint64_t reference = pkts_per_transfer * transfer_count * max_packetsize; + host->iso_threshold.lower = reference / 2; + host->iso_threshold.higher = reference * 3; +- DEBUG("higher threshold is %lu bytes | lower threshold is %lu bytes", ++ DEBUG("higher threshold is %" PRIu64 " bytes | lower threshold is %" PRIu64 " bytes", + host->iso_threshold.higher, host->iso_threshold.lower); + } + +-- +2.5.5 + diff --git a/SOURCES/0001-usbredirserver-Allow-connections-from-both-ipv6-and-.patch b/SOURCES/0001-usbredirserver-Allow-connections-from-both-ipv6-and-.patch deleted file mode 100644 index 0ccfd06..0000000 --- a/SOURCES/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/SOURCES/0002-usbredirserver-testclient-Error-check-fcntl-calls.patch b/SOURCES/0002-usbredirserver-testclient-Error-check-fcntl-calls.patch deleted file mode 100644 index 2501a35..0000000 --- a/SOURCES/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/SOURCES/0003-usbredirhost-Fix-coverity-sign_extension-warning.patch b/SOURCES/0003-usbredirhost-Fix-coverity-sign_extension-warning.patch deleted file mode 100644 index aecc9cc..0000000 --- a/SOURCES/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/SOURCES/0004-usbredirhost-Use-libusb_set_auto_detach_kernel_drive.patch b/SOURCES/0004-usbredirhost-Use-libusb_set_auto_detach_kernel_drive.patch deleted file mode 100644 index 01b4242..0000000 --- a/SOURCES/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/SOURCES/0005-usbredirparser-Update-header-len-inside-the-usbredir.patch b/SOURCES/0005-usbredirparser-Update-header-len-inside-the-usbredir.patch deleted file mode 100644 index 1081ccf..0000000 --- a/SOURCES/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/SPECS/usbredir.spec b/SPECS/usbredir.spec index 7b4a4fc..929e5c0 100644 --- a/SPECS/usbredir.spec +++ b/SPECS/usbredir.spec @@ -1,17 +1,13 @@ Name: usbredir -Version: 0.6 -Release: 7%{?dist} +Version: 0.7.1 +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 +Patch1: 0001-usbredirhost-Fix-Wformat-warning.patch BuildRequires: libusb1-devel >= 1.0.9 %description @@ -52,10 +48,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 +81,17 @@ rm $RPM_BUILD_ROOT%{_libdir}/libusbredir*.la %changelog +* Wed Jun 8 2016 Victor Toso - 0.7.1-1 +- Rebase to latest upstream: 0.7.1 + Resolves: rhbz#1033101 + +* Mon Feb 29 2016 Victor Toso - 0.6-8 +- Fix migration due lack of capabilities from source host + Resolves: rhbz#1185167 +- New callback to drop isoc packets in order to avoid high memory + consumption in the client + Resolves: rhbz#1312913 + * Fri Jan 24 2014 Daniel Mach - 0.6-7 - Mass rebuild 2014-01-24