HomeFreeBSD

sockets: don't malloc/free sockaddr memory on getpeername/getsockname

Description

sockets: don't malloc/free sockaddr memory on getpeername/getsockname

Just like it was done for accept(2) in cfb1e92912b4, use same approach
for two simplier syscalls that return socket addresses. Although,
these two syscalls aren't performance critical, this change generalizes
some code between 3 syscalls trimming code size.

Following example of accept(2), provide VNET-aware and INVARIANT-checking
wrappers sopeeraddr() and sosockaddr() around protosw methods.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D42694

Details

Provenance
glebiusAuthored on Nov 30 2023, 4:30 PM
Reviewer
tuexen
Differential Revision
D42694: sockets: don't malloc/free sockaddr memory on getpeername/getsockname
Parents
rGcfb1e92912b4: sockets: don't malloc/free sockaddr memory on accept(2)
Branches
Unknown
Tags
Unknown