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.
This commit is contained in:
Frdric Lcaille 2019-01-31 06:48:16 +01:00 committed by Willy Tarreau
parent a9b7796862
commit 04636b7bac

View File

@ -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;