Closed emielvanseveren closed 1 year ago
There is no implementation available in std.
Well, does it have to be in std? It seems kind of niche, so wouldn't having it in a crate be enough?
There is no implementation available in std.
Well, does it have to be in std? It seems kind of niche, so wouldn't having it in a crate be enough?
I'm not sure if would consider it niche. Every application running inside a vm that wants to communicate with its host can do this over vsock. This could be very similar to everything that takes tcp sockets. E.g. a http server inside the guest that takes connections over vsock.
Every application running inside a vm that wants to communicate with its host
Which in my experience isn't all that common? At work we have a ton of services running in VMs, very few of them need to talk with the host. The only things that come to mind are wsl2, docker on windows and some vmware guest tools.
Running software in microvms and only there, to the extent that they need specialized communication channels, is not exactly mainstream software, is it?
This could be very similar to everything that takes tcp sockets. E.g. a http server inside the guest that takes connections over vsock.
Alas, sockets in the standard library are not a general BSD socket type. Instead everything is distinct struct type for each socket family + type. Hell, TCP sockets are even split into TcpListener
and TcpStream
.
This might be more appropriate for the socket2
crate, and even that focuses more on tcp/udp/unix sockets than other ones. E.g. netlink, icmp or raw sockets don't have any explicit support there and must be constructed manually.
You're right, I'm closing this for now.
Proposal
Add support for AF_VSOCK which facilitates communication between virtual machines and the host they are running on. see vsock(7). The implementation should be very similar to AF_NETLINK.
More information on vsock programming can be found at: pubs.vmware.com/vsphere-60/topic/com.vmware.ICbase/PDF/ws9_esx60_vmci_sockets.pdf
Problem statement
There is no implementation available in std.
Motivation, use-cases
Solution sketches
socketAddr
(more information in vsock(7)VMADDR_CID_ANY
VMADDR_CID_HOST
VMADDR_CID_LOCAL
VMADDR_CID_LOCAL
VMADDR_CID_HYPERVISOR
get_local_cid()
which is supported through a ioctl on /dev/vsock.Links and related work