]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: Improve log message sent when server address is updated
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 8 Sep 2020 08:38:40 +0000 (10:38 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 8 Sep 2020 08:44:57 +0000 (10:44 +0200)
When the server address is set for the first time, the log message is a bit ugly
because there is no old ip address to report. Thus in the log, we can see :

  PX/SRV changed its IP from  to A.B.C.D by DNS additional record.

Now, when this happens, "(none)" is reported :

  PX/SRV changed its IP from (none) to A.B.C.D by DNS additional record.

This patch may be backported to 2.2.

src/server.c

index 56ee6a19fb2aa417471177805f4d9a69bf2a720f..ee743e7b99a537912cb5668014f575751c755000 100644 (file)
@@ -3516,6 +3516,9 @@ int update_server_addr(struct server *s, void *ip, int ip_sin_family, const char
                case AF_INET6:
                        inet_ntop(s->addr.ss_family, &((struct sockaddr_in6 *)&s->addr)->sin6_addr, oldip, INET6_ADDRSTRLEN);
                        break;
+               default:
+                       strcpy(oldip, "(none)");
+                       break;
                };
 
                /* copy new IP address in a string */