MEDIUM: log/balance: support FQDN for UDP log servers
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 9 Nov 2023 15:57:01 +0000 (16:57 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 29 Nov 2023 07:59:27 +0000 (08:59 +0100)
commit2f2cb6d08253f036557036d22df41be155e2f091
treee4c819e04c08ff85330093d28e9bc6e8dc05edee
parentcd994407a9545a8d84e410dc0cc18c30966b70d8
MEDIUM: log/balance: support FQDN for UDP log servers

In previous log backend implementation, we created a pseudo log target
for each declared log server, and we made the log target's address point
to the actual server address to save some time and prevent unecessary
copies.

But this was done without knowing that when FQDN is involved (more broadly
when dns/resolution is involved), the "port" part of server addr should
not be relied upon, and we should explicitly use ->svc_port for that
purpose.

With that in mind and thanks to the previous commit, some changes were
required: we allocate a dedicated addr within the log target when target
is in DGRAM mode. The addr is first initialized with known values and it
is then updated automatically by _srv_set_inetaddr() during runtime.
(the change is atomic so readers don't need to worry about it)

addr from server "log target" (INET/DGRAM mode) is made of the combination
of server's address (lacking the port part) and server's svc_port.
include/haproxy/log.h
src/log.c
src/server.c