]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: socket: add zero-terminated ABNS alternative
authorTristan <tristan@mangadex.org>
Mon, 28 Oct 2024 15:23:31 +0000 (16:23 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 29 Oct 2024 11:15:24 +0000 (12:15 +0100)
commit18582ede0592f375c176735ee1384a4b3b8ae145
tree31e7e737d1018fe17e92fe69ebbf4178f4bb0df4
parent43861e32341a95ddf75f4b2134bc5c7da02891a9
MEDIUM: socket: add zero-terminated ABNS alternative

When an abstract unix socket is bound by HAProxy (using "abns@" prefix),
NUL bytes are appended at the end of its path until sun_path is filled
(for a total of 108 characters).

Here we add an alternative to pass only the non-NUL length of that path
to connect/bind calls, such that the effective path of the socket's name
is as humanly written. This may be useful to interconnect with existing
softwares that implement abstract sockets with this logic instead of the
default haproxy one.

This is achieved by implementing the "abnsz" socket prefix (instead of
"abns"), which stands for "zero-terminated ABNS". "abnsz" prefix may be
used anywhere "abns" is. Internally, haproxy uses the custom socket
family (AF_CUST_ABNS vs AF_CUST_ABNSZ) to differentiate default abns
sockets from zero-terminated ones.

Documentation was updated and regtest was added.

Fixes GH issues #977 and #2479

Co-authored-by: Aurelien DARRAGON <adarragon@haproxy.com>
doc/configuration.txt
include/haproxy/tools.h
reg-tests/server/abnsz.vtc [new file with mode: 0644]
src/connection.c
src/sock_unix.c