HomeFreeBSD

sockets: don't malloc/free sockaddr memory on accept(2)

Description

sockets: don't malloc/free sockaddr memory on accept(2)

Let the accept functions provide stack memory for protocols to fill it in.
Generic code should provide sockaddr_storage, specialized code may provide
smaller structure.

While rewriting accept(2) make 'addrlen' a true in/out parameter, reporting
required length in case if provided length was insufficient. Our manual
page accept(2) and POSIX don't explicitly require that, but one can read
the text as they do. Linux also does that. Update tests accordingly.

Reviewed by: rscheff, tuexen, zlei, dchagin
Differential Revision: https://reviews.freebsd.org/D42635

Details

Provenance
glebiusAuthored on Nov 30 2023, 4:30 PM
Reviewer
rscheff
Differential Revision
D42635: sockets: don't malloc/free sockaddr memory on accept(2)
Parents
rG34c45bc6a394: tcp: enable LRD by default
Branches
Unknown
Tags
Unknown