BUG/MINOR: server: Crash when setting FQDN via CLI.
This patch ensures that a DNS resolution may be launched before setting a server FQDN via the CLI. Especially, it checks that resolvers was set. A LEVEL 4 reg testing file is provided. Thanks to Lukas Tribus for having reported this issue. Must be backported to 1.8.
This commit is contained in:
parent
7755f9f2be
commit
5afb3cfbcc
|
@ -0,0 +1,29 @@
|
||||||
|
varnishtest "Set server FQDN via CLI crash"
|
||||||
|
|
||||||
|
feature ignore_unknown_macro
|
||||||
|
|
||||||
|
# Do nothing. Is there only to create s1_* macros
|
||||||
|
server s1 {
|
||||||
|
} -start
|
||||||
|
|
||||||
|
haproxy h1 -conf {
|
||||||
|
defaults
|
||||||
|
mode http
|
||||||
|
timeout connect 1s
|
||||||
|
timeout client 1s
|
||||||
|
timeout server 1s
|
||||||
|
|
||||||
|
frontend myfrontend
|
||||||
|
bind "fd@${my_fe}"
|
||||||
|
default_backend test
|
||||||
|
|
||||||
|
backend test
|
||||||
|
server www1 ${s1_addr}:${s1_port}
|
||||||
|
} -start
|
||||||
|
|
||||||
|
haproxy h1 -cli {
|
||||||
|
send "set server test/www1 fqdn foo.fqdn"
|
||||||
|
expect ~ "could not update test/www1 FQDN by 'stats socket command'"
|
||||||
|
send "show servers state test"
|
||||||
|
expect ~ "test 1 www1 ${s1_addr} .* - ${s1_port}"
|
||||||
|
} -wait
|
|
@ -3980,6 +3980,10 @@ int srv_set_fqdn(struct server *srv, const char *hostname, int dns_locked)
|
||||||
char *hostname_dn;
|
char *hostname_dn;
|
||||||
int hostname_len, hostname_dn_len;
|
int hostname_len, hostname_dn_len;
|
||||||
|
|
||||||
|
/* Note that the server lock is already held. */
|
||||||
|
if (!srv->resolvers)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (!dns_locked)
|
if (!dns_locked)
|
||||||
HA_SPIN_LOCK(DNS_LOCK, &srv->resolvers->lock);
|
HA_SPIN_LOCK(DNS_LOCK, &srv->resolvers->lock);
|
||||||
/* run time DNS resolution was not active for this server
|
/* run time DNS resolution was not active for this server
|
||||||
|
|
Loading…
Reference in New Issue