From e5a60688a4f8d767e56e78e74481c7eef9ed47d5 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 9 Nov 2016 14:54:53 +0100 Subject: [PATCH] MEDIUM: server: do not restrict anymore usage of IP address from the state file Now that it is possible to decide whether we prefer to use libc or the state file to resolve the server's IP address and it is possible to change a server's IP address at run time on the CLI, let's not restrict the reuse of the address from the state file anymore to the DNS only. The impact is that by default the state file will be considered first (which matches its purpose) and only then the libc. This way any address change performed at run time over the CLI will be preserved regardless of DNS usage or not. --- doc/configuration.txt | 8 +++++--- src/server.c | 6 ++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 80343a055..c424e5ea2 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -4550,9 +4550,11 @@ load-server-state-from-file { global | local | none } none don't load any stat for this backend Notes: - - server's IP address is not updated unless DNS resolution is enabled on - the server. It means that if a server IP address has been changed using - the stat socket, this information won't be re-applied after reloading. + - server's IP address is preserved across reloads by default, but the + order can be changed thanks to the server's "init-addr" setting. This + means that an IP address change performed on the CLI at run time will + be preserved, and that any change to the local resolver (eg: /etc/hosts) + will possibly not have any effect if the state file is in use. - server's weight is applied from previous running process unless it has has changed between previous and new configuration files. diff --git a/src/server.c b/src/server.c index a1deae8e7..5da95c999 100644 --- a/src/server.c +++ b/src/server.c @@ -2333,10 +2333,8 @@ static void srv_update_state(struct server *srv, int version, char **params) } server_recalc_eweight(srv); - /* load server IP only if DNS resolution is used on the server */ - if (srv->resolution) { - srv->lastaddr = strdup(params[0]); - } + /* load server IP address */ + srv->lastaddr = strdup(params[0]); break; default: chunk_appendf(msg, ", version '%d' not supported", version);