This patch extends the existing libxcb protocol framework for AF_VSOCK by adding a new protocol name 'vsock':
For example, in order to have X11 clients running in a virtual machine forwarded to the X11 server running in the host, you can set the DISPLAY variable as:
It can be shortened as the following:
'2' is the assigned number for VMADDR_CID_HOST and it's used as a default value when it's not found in the DISPLAY variable. For a port number, it can be any 'unsigned int', but in order to maintain consistency, it's defined the same as the TCP method: 6000 + <display_number>.
See also: https://stefano-garzarella.github.io/posts/2019-11-08-kvmforum-2019-vsock/ https://man7.org/linux/man-pages/man7/vsock.7.html https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/vm_sockets.h