HomeFreeBSD

tests/netlink: add netlink socket buffer test

Description

tests/netlink: add netlink socket buffer test

With upcoming protocol specific socket buffer for Netlink we need some
additional tests that cover basic socket operations, w/o much of actual
Netlink knowledge. Following tests are performed:

  1. Overflow. If an application keeps sending messages to the kernel,

but doesn't read out the replies, then first the receive buffer shall
fill and after that further messages from applications will be queued
on the send buffer until it is filled. After that socket operations
should block. However, reading from the receive buffer some data should
wake up the taskqueue and the send buffer should start draining again.

  1. Peek & trunc. Check that socket correctly reports amount of readable

data with MSG_PEEK & MSG_TRUNC. This is typical pattern of Netlink apps.

  1. Sizes. Check that zero size read doesn't affect the socket, undersize

read will return one truncated message and the message is removed from
the buffer. Check that large buffer will be filled in one read, without
any boundaries imposed by internal representation of the buffer. Check
that any meaningful read is amended with control data if requested so.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D42525

Details

Provenance
glebiusAuthored on Jan 2 2024, 9:03 PM
Reviewer
melifaro
Differential Revision
D42525: tests/netlink: add netlink socket buffer test
Parents
rG67d9023f07a4: netlink: uninline some KPI functions that work with struct nl_writer
Branches
Unknown
Tags
Unknown