From fb38956bef32ab69dc503a921a91798d7c8663d2 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 11 Dec 2019 15:43:45 +0100 Subject: [PATCH] BUG/MINOR: server: make "agent-addr" work on default-server line As reported in issue #408, "agent-addr" doesn't work on default-server lines. This is due to the transcription of the old "addr" option in commit 6e5e0d8f9e ("MINOR: server: Make 'default-server' support 'addr' keyword.") which correctly assigns it to the check.addr and agent.addr fields, but which also copies the default check.addr into both the check's and the agent's addr fields. Thus the default agent's address is never used. This fix makes sure to copy the check from the check and the agent from the agent. However it's worth noting that if "addr" is specified on the server line, it will still overwrite both the check and the agent's addresses. This must be backported as far as 1.8. (cherry picked from commit 2444108f16868ccde928d97ffa3db847ddad89fb) Signed-off-by: Willy Tarreau (cherry picked from commit 3834754e654fa41491916a2e23c5fbe9b4ba5d82) Signed-off-by: Willy Tarreau --- src/server.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server.c b/src/server.c index 236d6baea..064d37409 100644 --- a/src/server.c +++ b/src/server.c @@ -1732,7 +1732,8 @@ static void srv_settings_cpy(struct server *srv, struct server *src, int srv_tmp srv->cklen = src->cklen; } srv->use_ssl = src->use_ssl; - srv->check.addr = srv->agent.addr = src->check.addr; + srv->check.addr = src->check.addr; + srv->agent.addr = src->agent.addr; srv->check.use_ssl = src->check.use_ssl; srv->check.port = src->check.port; srv->check.sni = src->check.sni;