BUG/MEDIUM: servers: Add srv_addr default placeholder to the state file
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.
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 @@
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 @@
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)) {