]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: server: fix server_find_by_name() usage during parsing
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 2 Jan 2024 13:39:26 +0000 (14:39 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 2 Jan 2024 14:52:47 +0000 (15:52 +0100)
commitb4db3be86e03ec31055303d46056223bb989472e
treed677ce1a94060d8e95cf001facfac7e7a4c67120
parent9d869b10dea0f4234eb14787f658d6b64a0a4021
BUG/MINOR: server: fix server_find_by_name() usage during parsing

Since below commit, server_find_by_name() now search using
'used_server_id' proxy backend tree :
  4bcfe30414005323a8d4ab986bce92bb736b59df
  OPTIM: server: eb lookup for server_find_by_name()

This introduces a regression if server_find_by_name() is used via
check_config_validity() during post-parsing. Indeed, used_server_id tree
is populated at the same stage so it's possible to not found an existing
server. This can cause incorrect rejection of previously valid
configuration file.

To fix this, servers are now inserted in used_server_id tree during
parsing via parse_server(). This guarantees that server instances can be
retrieved during post parsing.

A known feature which uses server_find_by_name() during post parsing is
attach-srv tcp-rule used for reverse HTTP. Prior to the current fix, a
config was wrongly rejected if the rule was declared before the server
line.

This should not be backported unless the mentionned commit is.
src/cfgparse.c
src/server.c