Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example to test vsock interface #450

Merged
merged 6 commits into from
Aug 22, 2024
Merged

Conversation

stlankes
Copy link
Contributor

@stlankes stlankes commented Aug 7, 2023

The example show the communication between host and HermitOS by a virtio socket device. See https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-39000010 for a detail description.

The example will be started by following command:

$ sudo qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand -device isa-debug-exit,iobase=0xf4,iosize=0x04 -display none -m 1G -serial stdio -kernel hermit-loader-x86_64 -initrd target/x86_64-unknown-hermit/debug/vsock -device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=3

In this case, the Context IDentifier (CID) is defined as 3. The server is listening on port 9975 (= 0x0x26F7). On the host side, socat can be used to communicate with the server. The following command creates a connection to the server.

$ sudo socat - SOCKET-CONNECT:40:0:x00x00xF7x26x00x00x03x00x00x00x00x00x00x00

Note, 40 is Linux value for AF_VSOCK.

This PR depends on hermit-os/kernel#826

@stlankes stlankes marked this pull request as ready for review August 6, 2024 20:32
@stlankes stlankes changed the title add basic vsock support add example to test vsock interface Aug 6, 2024
In addition, some  clippy warnings are removed.
@stlankes stlankes added this pull request to the merge queue Aug 22, 2024
Merged via the queue into hermit-os:main with commit e6c3d68 Aug 22, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants