]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: sock_inet: implement sock_inet_bind_receiver()
authorWilly Tarreau <w@1wt.eu>
Tue, 1 Sep 2020 12:18:04 +0000 (14:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Sep 2020 20:08:07 +0000 (22:08 +0200)
commitd69ce1ffbc3cb4397cf4c5e6572f65f25fd2d13b
tree121da56281e13e9045a1adab2437aaf661844311
parent3e5c7ab7ce3bf70378b8bb0ed2f7856b83e0cd71
MEDIUM: sock_inet: implement sock_inet_bind_receiver()

This function collects all the receiver-specific code from both
tcp_bind_listener() and udp_bind_listener() in order to provide a more
generic AF_INET/AF_INET6 socket binding function. For now the API is
not very elegant because some info are still missing from the receiver
while there's no ideal place to fill them except when calling ->listen()
at the protocol level. It looks like some polishing code is needed in
check_config_validity() or somewhere around this in order to finalize
the receivers' setup. The main issue is that listeners and receivers
are created *before* bind_conf options are parsed and that there's no
finishing step to resolve some of them.

The function currently sets up a receiver and subscribes it to the
poller. In an ideal world we wouldn't subscribe it but let the caller
do it after having finished to configure the L4 stuff. The problem is
that the caller would then need to perform an fd_insert() call and to
possibly set the exported flag on the FD while it's not its job. Maybe
an improvement could be to have a separate sock_start_receiver() call
in sock.c.

For now the function is not used but it will soon be. It's already
referenced as tcp and udp's ->bind().
include/haproxy/sock_inet.h
src/proto_tcp.c
src/proto_udp.c
src/sock_inet.c