BUG/MEDIUM: resolve: fix init resolving for ring and peers section.
Reported github issue #759 shows there is no name resolving
on server lines for ring and peers sections.
This patch introduce the resolving for those lines.
This patch adds boolean a parameter to parse_server function to specify
if we want the function to perform an initial name resolving using libc.
This boolean is forced to true in case of peers or ring section.
The boolean is kept to false in case of classic servers (from
backend/listen)
This patch should be backported in branches where peers sections
support 'server' lines.
(cherry picked from commit d3db3846c5d2f3a2a27a6055d28d146838b7189d)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit de103017907a09d257fb0d3d75cc1dcef8588ada)
[wt: dropped ring changes for 2.1]
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 9fd9128f1554fd42a7b27e5a4e65afa92e67c05f)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 88d4cf3..6f453b5 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -713,7 +713,7 @@
err_code |= ERR_ALERT | ERR_ABORT;
goto out;
}
- err_code |= parse_server(file, linenum, args, curpeers->peers_fe, NULL, 0, 1);
+ err_code |= parse_server(file, linenum, args, curpeers->peers_fe, NULL, 0, 1, 1);
}
else if (strcmp(args[0], "peers") == 0) { /* new peers section */
/* Initialize these static variables when entering a new "peers" section*/
@@ -811,7 +811,7 @@
* The server address is parsed only if we are parsing a "peer" line,
* or if we are parsing a "server" line and the current peer is not the local one.
*/
- err_code |= parse_server(file, linenum, args, curpeers->peers_fe, NULL, peer || !local_peer, 1);
+ err_code |= parse_server(file, linenum, args, curpeers->peers_fe, NULL, peer || !local_peer, 1, 1);
if (!curpeers->peers_fe->srv) {
/* Remove the newly allocated peer. */
if (newpeer != curpeers->local) {