]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: cfgparse/peers: fix inconsistent check for missing peer server
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 6 Mar 2025 08:05:23 +0000 (09:05 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 6 Mar 2025 21:05:24 +0000 (22:05 +0100)
commit2560ab892f355e958007b287946f787b578d3131
tree2334be4b361ebe5c73227a362769f6dad7890c78
parent29db5406b4b008e86fef6f2ad63267be77aa3c71
BUG/MINOR: cfgparse/peers: fix inconsistent check for missing peer server

In the "peers" section parser, right after parse_server() is called, we
used to check whether the curpeers->peers_fe->srv pointer was set or not
to know if parse_server() successfuly added a server to the peers proxy,
server that we can then associate to the new peer.

However the check is wrong, as curpeers->peers_fe->srv points to the
last added server, if a server was successfully added before the
failing one, we cannot detect that the last parse_server() didn't
add a server. This is known to cause bug with bad "peer"/"server"
statements.

To fix the issue, we save a pointer on the last known
curpeers->peers_fe->srv before parse_server() is called, and we then
compare the save with the pointer after parse_server(), if the value
didn't change, then parse_server() didn't add a server. This makes
the check consistent in all situations.

It should be backported to all stable versions.
src/cfgparse.c