]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: server: do not restrict anymore usage of IP address from the state file
authorWilly Tarreau <w@1wt.eu>
Wed, 9 Nov 2016 13:54:53 +0000 (14:54 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 9 Nov 2016 14:33:52 +0000 (15:33 +0100)
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
src/server.c

index 80343a055edb1a0f0ddc5dd8c9e97f3c0c8ff385..c424e5ea230e8860fa995b9bce280c9d27dcbc11 100644 (file)
@@ -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.
index a1deae8e74bd79b9818aab82e1de16e98d954b93..5da95c999495563dca9c76530541cfada566c970 100644 (file)
@@ -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);