Hi Pieter,
While I'm not sure what may be happening in regards to the
server-template messages that you have pointed out.
I have ran into the unix socket one a couple weeks ago and have been
meaning to send this patch to the mailing list.
What is happening is that currently only AF_INET and AF_INET6 are
checked within the switch statement when dumping the servers state. This
causes the value of srv_addr to be empty and thus a missing field in the
server state file.
This patch adds a default case that sets srv_addr to "-" when not
covered by a socket family.
This should be backported to 1.8
Thanks,
-- Daniel
>From 24f8a74f490435969c04e2bb5387d396b62850c0 Mon Sep 17 00:00:00 2001
From: Daniel Corbett <dcorb...@haproxy.com>
Date: Sat, 19 May 2018 19:43:24 -0400
Subject: [PATCH] BUG/MEDIUM: servers state: Add srv_addr default placeholder
When creating a state file using "show servers state" an empty field is created in the srv_addr column if the server is from the socket family AF_UNIX. This leads to a warning on start up when using "load-server-state-from-file". This patch defaults srv_addr to "-" if the socket family is not covered.
This patch should be backported to 1.8.
---
src/proxy.c | 3 +++
src/server.c | 3 ++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/proxy.c b/src/proxy.c
index 31253f1..6f71b4b 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -1450,6 +1450,9 @@ static int dump_servers_state(struct stream_interface *si, struct chunk *buf)
inet_ntop(srv->addr.ss_family, &((struct sockaddr_in6 *)&srv->addr)->sin6_addr,
srv_addr, INET6_ADDRSTRLEN + 1);
break;
+ default:
+ memcpy(srv_addr, "-\0", 2);
+ break;
}
srv_time_since_last_change = now.tv_sec - srv->last_change;
bk_f_forced_id = px->options & PR_O_FORCED_ID ? 1 : 0;
diff --git a/src/server.c b/src/server.c
index ebac357..277d140 100644
--- a/src/server.c
+++ b/src/server.c
@@ -2936,7 +2936,8 @@ static void srv_update_state(struct server *srv, int version, char **params)
server_recalc_eweight(srv);
/* load server IP address */
- srv->lastaddr = strdup(params[0]);
+ if (strcmp(params[0], "-"))
+ srv->lastaddr = strdup(params[0]);
if (fqdn && srv->hostname) {
if (!strcmp(srv->hostname, fqdn)) {
--
2.7.4