Message ID | 20250523090802.17987-2-vadimgrn@gmail.com |
---|---|
State | New |
Headers | show |
Series | [v2,1/3] usbipd: enable SO_KEEPALIVE socket option for accepted connection | expand |
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);
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(+)