From: Christopher Faulet Date: Tue, 15 Jun 2021 09:37:40 +0000 (+0200) Subject: BUG/MINOR: server: Forbid to set fqdn on the CLI if SRV resolution is enabled X-Git-Tag: v2.5-dev1~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a386e7882378a4bd3afdd2915fefe4bcc9fa286d;p=thirdparty%2Fhaproxy.git BUG/MINOR: server: Forbid to set fqdn on the CLI if SRV resolution is enabled If a server is configured to rely on a SRV resolution, we must forbid to change its fqdn on the CLI. Indeed, in this case, the server retrieves its fqdn from the SRV resolution. If the fqdn is changed via the CLI, this conflicts with the SRV resolution and leaves the server in an undefined state. Most of time, the SRV resolution remains enabled with no effect on the server (no update). Some time the A/AAAA resolution for the new fqdn is not enabled at all. It depends on the server state and resolver state when the CLI command is executed. This patch must be backported as far as 2.0 (maybe to 1.8 too ?) after some observation period. --- diff --git a/src/server.c b/src/server.c index 471139bbaa..480cc493eb 100644 --- a/src/server.c +++ b/src/server.c @@ -4040,6 +4040,10 @@ static int cli_parse_set_server(char **args, char *payload, struct appctx *appct cli_err(appctx, "set server / fqdn requires a FQDN.\n"); goto out_unlock; } + if (sv->srvrq) { + cli_err(appctx, "set server / fqdn failed because SRV resolution is configured.\n"); + goto out_unlock; + } /* ensure runtime resolver will process this new fqdn */ if (sv->flags & SRV_F_NO_RESOLUTION) { sv->flags &= ~SRV_F_NO_RESOLUTION;