From 31f5ed68d3c19a2c86a2181084f80f175831298d Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 29 Jun 2021 20:52:35 +0200 Subject: [PATCH] BUG/MEDIUM: resolvers: Make 1st server of a template take part to SRV resolution The commit 3406766d5 ("MEDIUM: resolvers: add a ref between servers and srv request or used SRV record") introduced a regression. The first server of a template based on SRV record is no longer resolved. The same bug exists for a normal server based on a SRV record. In fact, the server used during parsing (used as reference when a server-template line is parsed) is never attached to the corresponding srvrq object. Thus with following lines, no resolution is performed because "srvrq->attached_servers" is empty: server-template test 1 _http.domain.tld resolvers dns ... server test1 _http.domain.tld resolvers dns ... This patch should fix the issue #1295 (but not confirmed yet it is the same bug). It must be backported everywhere the above commit is. (cherry picked from commit 81ba74ae5061bc55b3460f01a99371281de8f7f3) Signed-off-by: Christopher Faulet (cherry picked from commit 08736f990ed0387fa9c2340b1520c679fd429921) Signed-off-by: Christopher Faulet --- src/server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/server.c b/src/server.c index e83dd84..da193db 100644 --- a/src/server.c +++ b/src/server.c @@ -2062,6 +2062,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr err_code |= ERR_ALERT | ERR_FATAL; goto out; } + LIST_ADDQ(&newsrv->srvrq->attached_servers, &newsrv->srv_rec_item); } else if (srv_prepare_for_resolution(newsrv, fqdn) == -1) { ha_alert("parsing [%s:%d] : Can't create DNS resolution for server '%s'\n", -- 1.7.10.4