diff mbox series

[1/3,1/3] usbipd: enable SO_KEEPALIVE socket option for accepted connection

Message ID 20250516075204.7950-1-vadimgrn@gmail.com
State Superseded
Headers show
Series [1/3,1/3] usbipd: enable SO_KEEPALIVE socket option for accepted connection | expand

Commit Message

Vadym Hrynchyshyn May 16, 2025, 7:52 a.m. UTC
- If usbip client does not close a TCP/IP connection to a daemon
      gracefully, the daemon will keep this connection open indefinitely.

    - The issue is that the client cannot attach this device again
      until the device will be rebinded on server side by commands:
      usbip unbind -b X-Y
      usbip bind -b X-Y

    - usbip client enables tcp keepalive by calling
      usbip_net_set_keepalive from usbip_net_tcp_connect.
      usbip daemon now enables this socket option too
      for accepted connection.

Signed-off-by: Vadym Hrynchyshyn <vadimgrn@gmail.com>
---
 tools/usb/usbip/src/usbipd.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Shuah Khan May 22, 2025, 10:06 p.m. UTC | #1
On 5/16/25 01:52, Vadym Hrynchyshyn wrote:
>      - If usbip client does not close a TCP/IP connection to a daemon
>        gracefully, the daemon will keep this connection open indefinitely.
> 
>      - The issue is that the client cannot attach this device again
>        until the device will be rebinded on server side by commands:
>        usbip unbind -b X-Y
>        usbip bind -b X-Y
> 
>      - usbip client enables tcp keepalive by calling
>        usbip_net_set_keepalive from usbip_net_tcp_connect.
>        usbip daemon now enables this socket option too
>        for accepted connection.

Please check a few change logs to for the correct format.

> 
> Signed-off-by: Vadym Hrynchyshyn <vadimgrn@gmail.com>
> ---
>   tools/usb/usbip/src/usbipd.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/usb/usbip/src/usbipd.c b/tools/usb/usbip/src/usbipd.c
> index 48398a78e88a..d89633d8f799 100644
> --- a/tools/usb/usbip/src/usbipd.c
> +++ b/tools/usb/usbip/src/usbipd.c
> @@ -119,6 +119,7 @@ static int recv_request_import(int sockfd)
>   	if (found) {
>   		/* should set TCP_NODELAY for usbip */
>   		usbip_net_set_nodelay(sockfd);
> +		usbip_net_set_keepalive(sockfd);
>   
>   		/* export device needs a TCP/IP socket descriptor */
>   		status = usbip_export_device(edev, sockfd);

How did you find these problems - Also this series could use a
cover letter explaining the changes - how these problems are
found

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/usb/usbip/src/usbipd.c b/tools/usb/usbip/src/usbipd.c
index 48398a78e88a..d89633d8f799 100644
--- a/tools/usb/usbip/src/usbipd.c
+++ b/tools/usb/usbip/src/usbipd.c
@@ -119,6 +119,7 @@  static int recv_request_import(int sockfd)
 	if (found) {
 		/* should set TCP_NODELAY for usbip */
 		usbip_net_set_nodelay(sockfd);
+		usbip_net_set_keepalive(sockfd);
 
 		/* export device needs a TCP/IP socket descriptor */
 		status = usbip_export_device(edev, sockfd);