]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: sock: restore effective UNIX family in sock_get_old_sockets()
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 28 Oct 2024 14:17:10 +0000 (15:17 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 29 Oct 2024 11:14:57 +0000 (12:14 +0100)
commitae64444303fbdd041bf7421fac7119031ecd0f63
tree32c7bfb2b8d4dc090d2704be80f1b085901b4782
parentd24768ab4473ee5867eb01ad56ef7fcac44e1192
MINOR: sock: restore effective UNIX family in sock_get_old_sockets()

When getting sockets from older process in sock_get_old_sockets(), we
leverage getsockname() to fill sockaddr struct from known fd.

However, the kernel doesn't know about our custom UNIX families such
as CUST_ABNS and CUST_ABNSZ which are both based on AF_UNIX real family.

Since haproxy socket API relies on effective family (and not real family)
to recognize the socket type instead of having to guess it by analyzing
the path content, let's restore it right after getsockname() since we
have all the infos needed to deduce the right family.

If the path starts with a NULL byte, we know that it is an abstract sock.
Then we simply check <addrlen> value from getsockname() to know if the
addr makes uses of the whole path space (normal ABNS) or partial path
space (zero ABNS / aka ABNZ) terminated by 0.
src/sock.c