Repository navigation
examples/vsock: add a vsock test client and server - #4045
Merged
Merged
Conversation
xiaoxiang781216
approved these changes
Nov 13, 2026
GUIDINGLI
approved these changes
Nov 13, 2026
CV-Bowen
force-pushed
the
up/P85-examples-vsock
branch
from
November 13, 2026 09:02
d3b0d13 to
ae1552d
Compare
Add "vsock", a test for AF_VSOCK sockets. "-t data" runs a server that echoes what it receives, or a client (with "-c <cid>") that sends "-n" buffers of "-i" bytes to port "-p" and checks the echo. The same source also builds on Linux against <linux/vm_sockets.h>, so a Linux peer can be tested against NuttX. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com> Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
"-t conn" opens and closes "-n" connections in a row, on the server accepting and closing each one, to exercise the vsock connection setup and teardown paths. Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
A NuttX vsock cid set from a cpu name holds the first four bytes of the name. Let "-c" take either a number or such a name, e.g. "-c prox". Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
CV-Bowen
force-pushed
the
up/P85-examples-vsock
branch
from
November 13, 2026 13:28
ae1552d to
98d17e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
There is no tool in nuttx-apps to exercise
AF_VSOCKsockets. Addexamples/vsock:-t data: the server echoes what it receives; the client (-c)sends
-nbuffers of-ibytes and checks the echo. Also buildson Linux against
<linux/vm_sockets.h>to test against a Linuxpeer.
-t conn: open and close-nconnections in a row.first four bytes of the name, so
-c proxworks as well as-c 2020569712.Impact
New example,
CONFIG_EXAMPLES_VSOCK, default n. No other change.Testing
Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
qemu-armv8a:rpserver + qemu-armv8a:rpproxy with apache/nuttx#21818
(vsock over the rptun ivshmem resource table). Overlay on both:
CONFIG_NET,CONFIG_NET_SOCKOPTS,CONFIG_NET_VSOCK,CONFIG_EXAMPLES_VSOCK; rpproxy addsCONFIG_DRIVERS_VHOST+CONFIG_NET_VSOCK_VHOST, rpserver addsCONFIG_DRIVERS_VIRTIO+CONFIG_NET_VSOCK_VIRTIO. Builds with 0 warnings.output
checkpatch passes.