HomeFreeBSD

socket tests: remove MSG_TRUNC test for unix/seqpacket

Description

socket tests: remove MSG_TRUNC test for unix/seqpacket

The PF_UNIX/SOCK_SEQPACKET was marked as PR_ATOMIC and that made
soreceive_generic() to treat it pretty much as a datagram socket.
However, POSIX says:

The SOCK_SEQPACKET socket type is similar to the SOCK_STREAM type,
and is also connection-oriented. The only difference between these
types is that record boundaries are maintained using the
SOCK_SEQPACKET type. A record can be sent using one or more output
operations and received using one or more input operations, but a
single operation never transfers parts of more than one record.
Record boundaries are visible to the receiver via the MSG_EOR flag
in the received message flags returned by the recvmsg() function. It
is protocol-specific whether a maximum record size is imposed.

What the test was doing is checking if MSG_TRUNC would report the space
required to return up the end of next mbuf record in the socket buffer.
Apparently the test assumed that this boundary is defined by the write(2)
size on the peer socket. This was true in test conditions, but I'm not
sure it would always be true - sbcompress() may merge mbufs. Anyway, the
mbuf boundaries are internal socket buffer implementation, they are not
SOCK_SEQPACKET records. The records need to be explicitly marked with
MSG_EOR by sender, and the test definitely wasn't doing that.

Reviewed by: tuexen, markj
Differential Revision: https://reviews.freebsd.org/D43707

Details

Provenance
glebiusAuthored on Feb 28 2024, 10:32 PM
Reviewer
tuexen
Differential Revision
D43707: socket tests: remove MSG_TRUNC test for unix/seqpacket
Parents
rG706d465dae6a: pf: convert kill/clear state to use netlink
Branches
Unknown
Tags
Unknown