rust-vmm / vhost-device

'vhost-user' device backends workspace
Apache License 2.0
68 stars 46 forks source link

vsock: how can host vsock server accepting every guest cid? #551

Open ikicha opened 10 months ago

ikicha commented 10 months ago

I'd like to set up vsock server in the host accepting every connection which is acting likesvm_cid=VMADDR_CID_HOST. But for now, it needs to bind to uds-path from specific cid. Is there any way to do that for now? or we need to set up multiple sockets for each?

stefano-garzarella commented 10 months ago

yeah, this is a limitation of firecracker's hybrid vsock approach that we are currently using here. So, with the current implementation we don't have any easy way, but I have something in mind that I want to implement that will allow your use case.

Essentially I want to extend AF_VSOCK, to support SOCK_RAW and allow vhost-device-vsock to enqueue packets in the host vsock stack. This way we can finally remove the Unix socket and applications in the host can use AF_VSOCK as with vhost-vsock. At this point your use case is trivial, just listen on AF_VSOCK(CID_HOST, port) and you'll get connections from any guests.

I'll add an issue in https://gitlab.com/vsock/vsock/-/issues to track this idea, then any help to implement it will be very well accepted :-)

stefano-garzarella commented 10 months ago

I'll add an issue in https://gitlab.com/vsock/vsock/-/issues to track this idea, then any help to implement it will be very well accepted :-)

Dumped the idea here: https://gitlab.com/vsock/vsock/-/issues/12