From 5a4fe5a35d544579586672c46f8afe4114589d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Fri, 4 Oct 2019 08:30:04 +0200 Subject: [PATCH] BUG/MINOR: peers: crash on reload without local peer. When we configure a "peers" section without local peer, this makes haproxy old process crash on reload. Such a configuration file allows to reproduce this issue: global stats socket /tmp/sock1 mode 666 level admin stats timeout 10s peers peers peer localhost 127.0.0.1:1024 This bug was introduced by this commit: "MINOR: cfgparse: Make "peer" lines be parsed as "server" lines" This commit introduced a new condition to detect a "peers" section without local peer. This is a "peers" section with a frontend struct which has no ->id initialized member. Such a "peers" section must be removed. This patch adds this new condition to remove such peers sections without local peer as this was always done before. Must be backported to 2.0. --- src/cfgparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cfgparse.c b/src/cfgparse.c index 6cbcac4f4..05a64a8ef 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -3903,7 +3903,7 @@ out_uri_auth_compat: stop_proxy(curpeers->peers_fe); curpeers->peers_fe = NULL; } - else if (!curpeers->peers_fe) { + else if (!curpeers->peers_fe || !curpeers->peers_fe->id) { ha_warning("Removing incomplete section 'peers %s' (no peer named '%s').\n", curpeers->id, localpeer); }