From: Shuah Khan <skhan@linuxfoundation.org>
To: Raul E Rangel <rrangel@chromium.org>,
Valentina Manea <valentina.manea.m@gmail.com>,
Shuah Khan <shuah@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
Hongren Zheng <i@zenithal.me>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] usbip: tools: add --sockfd option to usbip attach
Date: Thu, 12 Nov 2026 15:44:54 -0700 [thread overview]
Message-ID: <f849dfc1-c7ab-4285-b668-b37eb15e37b4@linuxfoundation.org> (raw)
In-Reply-To: <20261021214808.58609-1-rrangel@chromium.org>
On 10/21/26 15:48, Raul E Rangel wrote:
> 'usbip attach' always opens its own TCP connection to --remote. A client
> that reaches the USB/IP server some other way, for example over a UNIX
> domain socket or a channel forwarded by a multiplexed SSH connection,
> therefore has to expose a listening TCP port on the local host just so
> usbip can connect back to it. Any local user can connect to that port
> while it is open.
>
> Add a '--sockfd <fd>' option (short option '-s') that attaches the
> device over an inherited, already-connected stream socket instead.
> '--sockfd' and '--remote' are mutually exclusive. Because sudo closes
> file descriptors >= 3 by default but preserves stdin, the typical
> invocation passes the socket as stdin:
>
> sudo usbip attach --sockfd 0 --busid <busid>
>
> The descriptor must be a connected SOCK_STREAM socket: fstat() must
> report S_ISSOCK, getsockopt(SO_TYPE) must return SOCK_STREAM and
> getpeername() must succeed. Both AF_UNIX and AF_INET/AF_INET6 sockets
> are accepted, since vhci_hcd only requires a SOCK_STREAM socket. For
> AF_INET/AF_INET6 sockets, TCP_NODELAY and SO_KEEPALIVE are set as
> usbip_net_tcp_connect() does.
>
> The connection recorded in /var/run/vhci_hcd/port<N> for 'usbip port'
> uses the numeric peer address and port for AF_INET/AF_INET6 sockets.
> UNIX sockets have no port, so 'unix' and '-' are recorded instead; this
> keeps read_record() working and 'usbip port' shows
> 'usbip://unix:-/<busid>'.
>
> Update doc/usbip.8 and the usage text accordingly.
Does this patch fix a problem or does this add an enhancement?
What doesn't work without this patch?
thanks,
-- Shuah
prev parent reply other threads:[~2026-11-12 22:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 21:48 Raul E Rangel
2026-11-12 22:44 ` Shuah Khan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f849dfc1-c7ab-4285-b668-b37eb15e37b4@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=i@zenithal.me \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rrangel@chromium.org \
--cc=shuah@kernel.org \
--cc=valentina.manea.m@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®