This series implements USB over VSOCK sockets, as an alternative to USB over IP. This would allow, for example, a host system to share its USB controller with a VM over VFIO, and then selectively attach to certain specific USB devices exported by the VM over a VSOCK connection. If inter-guest VSOCK were to be implemented in the kernel, or using a program like vsock-bridge[1] or socat[2], USB devices could also be shared between VMs in this way, without having to have a full-on networking setup between those VMs. I've taken different approaches to implement the VSOCK support in each of the usbip client and server. For the server, I added a new program, in.usbipd, that implements an inetd-style interface, taking a socket from its environment. This way, the socket could be a TCP socket, a VSOCK socket, or something else entirely, and the program doesn't have to care. The usbip client, on the other hand, cares about what type of socket it's communicating over, because it records address information for the remote server. Since this meant I had to teach it about VSOCK anyway, to tell it how to find that information for VSOCK sockets, it was easier to just extend the existing program with an option to choose an alternative protocol family than to have it take a socket from its environment. I've tested this series by running in.usbipd in a NixOS VM, and then attaching a device from it to my host system. The following NixOS configuration sets up an in.usbipd service listening on a VSOCK socket: systemd.sockets.usbipd = { wantedBy = [ "sockets.target" ]; listenStreams = [ "vsock::3240" ]; socketConfig.Accept = "yes"; }; systemd.services."usbipd@" = { serviceConfig.ExecStart = "${usbip}/bin/in.usbipd"; serviceConfig.StandardInput = "socket"; serviceConfig.StandardOutput = "socket"; serviceConfig.StandardError = "journal"; }; [1]: https://github.com/stefano-garzarella/vsock-bridge [2]: http://www.dest-unreach.org/socat/ Alyssa Ross (3): usbip: tools: in.usbipd: add usbip: tools: usbip: record protocol usbip: tools: usbip: support vsock(7) connections tools/usb/usbip/libsrc/vhci_driver.c | 26 ++- tools/usb/usbip/src/Makefile.am | 4 +- tools/usb/usbip/src/in.usbipd.c | 326 +++++++++++++++++++++++++++ tools/usb/usbip/src/usbip_attach.c | 54 ++++- tools/usb/usbip/src/usbip_list.c | 43 +++- tools/usb/usbip/src/usbip_network.c | 51 ++++- tools/usb/usbip/src/usbip_network.h | 4 +- 7 files changed, 470 insertions(+), 38 deletions(-) create mode 100644 tools/usb/usbip/src/in.usbipd.c base-commit: 620b74d01b9d4393bef6742bf121908322c2fe0b -- 2.32.0