Skip to content

testing/nettest: Test getsockname() of a CAN_RAW socket with a short buffer. - #4176

Merged
acassis merged 1 commit into
apache:masterfrom
casaroli:net-sockname-short-other-up
Nov 28, 2026
Merged

acassis merged 1 commit into
apache:masterfrom
casaroli:net-sockname-short-other-up

Conversation

@casaroli

@casaroli casaroli commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

New case test_can_name_short in cmocka_net_can. getsockname() of a bound CAN_RAW socket writes its address into a buffer of 2 bytes. The call must succeed, the buffer gets the first 2 bytes of the address, the bytes after it do not change, and *addrlen gives the length of the whole address, as on Linux.

Impact

Test only. The case fails with EINVAL until apache/nuttx#22470 merges.

Testing

qemu-armv8a:nsh (flat) with CAN and loopback, CI image, QEMU TCG: the case FAILED (EINVAL) on nuttx master, PASSED with apache/nuttx#22470; the other cases of cmocka_net_can pass on both. Builds with -Werror: qemu-armv8a:nsh, qemu-armv8a:knsh and rv-virt:knetnsh64 (kernel, make import), rv-virt:netnsh64.

…buffer.

Add test_can_name_short to cmocka_net_can.  getsockname() of a bound
CAN_RAW socket writes its address into a buffer of 2 bytes.  The call
must succeed, the buffer gets the first 2 bytes of the address, the
bytes after it do not change, and *addrlen gives the length of the whole
address.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
@casaroli
casaroli marked this pull request as ready for review November 27, 2026 18:47
@acassis
acassis merged commit 0a37af9 into apache:master Nov 28, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants