From: Frédéric Lécaille Date: Thu, 31 Jan 2019 05:48:16 +0000 (+0100) Subject: BUG/MEDIUM: peers: Peer addresses parsing broken. X-Git-Tag: v2.0-dev1~98 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04636b7baca1bd03191c30bc173c19fede73c048;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: peers: Peer addresses parsing broken. This bug was introduced by 355b203 commit which prevented the peer addresses to be parsed for the local peer of a "peers" section. When adding "parse_addr" boolean parameter to parse_server(), this commit missed the case where the syntax with "peer" keyword should still be supported in addition to the new syntax with "server"+"bind" keyword. May be backported as fas as 1.5. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index 50f43cde59..5c292f82d2 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -761,8 +761,9 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) } else if (strcmp(args[0], "peer") == 0 || strcmp(args[0], "server") == 0) { /* peer or server definition */ - int local_peer; + int local_peer, peer; + peer = *args[0] == 'p'; local_peer = !strcmp(args[1], localpeer); /* The local peer may have already partially been parsed on a "bind" line. */ if (*args[0] == 'p') { @@ -805,7 +806,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) } /* This initializes curpeer->peers->peers_fe->srv. */ - err_code |= parse_server(file, linenum, args, curpeers->peers_fe, NULL, !local_peer); + err_code |= parse_server(file, linenum, args, curpeers->peers_fe, NULL, peer || !local_peer); if (!curpeers->peers_fe->srv) goto out;