Repository navigation
testing/nettest: Test getsockname() of a CAN_RAW socket with a short buffer. - #4176
Merged
Merged
Conversation
…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>
xiaoxiang781216
approved these changes
Nov 27, 2026
casaroli
marked this pull request as ready for review
November 27, 2026 18:47
acassis
approved these changes
Nov 28, 2026
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
New case
test_can_name_shortincmocka_net_can.getsockname()of a boundCAN_RAWsocket 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*addrlengives the length of the whole address, as on Linux.Impact
Test only. The case fails with
EINVALuntil 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 ofcmocka_net_canpass on both. Builds with-Werror: qemu-armv8a:nsh, qemu-armv8a:knsh and rv-virt:knetnsh64 (kernel,make import), rv-virt:netnsh64.