🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Murali Krishna Mon, 19 Oct 2026 13:44
net/qrtr: would selftests for AF_QIPCRTR be useful?
#4941
Author: Murali Krishna
Date: Mon, 19 Oct 2026 13:44
63 lines
10803 bytes
Hi Mani,

I am fairly new to kernel development and have been reading net/qrtr to
learn my way around it. I noticed that there are no selftests for the
QRTR socket family anywhere under tools/testing/selftests, while
Documentation/process/maintainer-netdev.rst asks that series come with
tests under tools/testing/selftests/net.

Since AF_QIPCRTR and CONFIG_QRTR_TUN both work on a plain x86_64 machine
with no Qualcomm hardware, I tried writing some, to see whether the idea
holds up. I have a tools/testing/selftests/net/qrtr/ directory with two
programs, modelled on tools/testing/selftests/net/af_unix/:

  qrtr_sock      12 tests for the socket contract -- the ephemeral port
                 range and the CAP_NET_ADMIN boundary described above
                 qrtr_port_assign(), the bind() rule that an address must
                 name the socket's own node, rebinding, EADDRINUSE,
                 auto-bind on send, and local datagram delivery including
                 the source address seen by the receiver.

  qrtr_endpoint  12 tests for frame validation in qrtr_endpoint_post(),
                 by writing crafted frames to /dev/qrtr-tun: length
                 alignment, unknown versions, headers truncated below the
                 v1 and v2 minimums, bad declared sizes, control payloads
                 too small for a struct qrtr_ctrl_pkt, control types sent
                 to an ordinary port, and the legacy control port number.
                 Each frame is malformed in exactly one way, so a failure
                 names the check that regressed.

It is about 590 lines. All 24 tests pass on current net-next, and both
programs skip cleanly when CONFIG_QRTR or /dev/qrtr-tun is unavailable,
so they are harmless on non-Qualcomm configurations.

Writing them corrected two things I had assumed wrongly, which is partly
why I think they may be worth having: that bind() accepts sq_node == 0 as
"any node" (it does not, it requires the socket's own node), and that
rebinding an already bound socket fails (it does not, the socket moves
and releases the old port).

My question before I take this any further: is a test-only series wanted
for net/qrtr at all? The netdev documentation describes selftests as
travelling with a code change, and I could not tell whether a standalone
one is welcome or just churn. If you would rather tests arrived only
alongside functional patches, I am happy to drop this.

If you do think it is useful, would you be willing to look at it? I can
post it as an RFC whenever that suits -- I have not sent a patch now
because net-next is closed.

I should be clear about the limits: it is built and run on x86_64 only,
with no Qualcomm hardware, so nothing beyond the tun endpoint and the
local node is covered, and I have not tried to test the SMD or MHI
transports.

I should also say that I wrote these with the help of an LLM coding
assistant, and a posted patch would carry an Assisted-by tag as
Documentation/process/coding-assistants.rst describes. I have read and
run every test myself and can explain what each one checks and why; I am
not looking to send anything I do not understand.

Thanks for your time,
Murali Krishna
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads