When a DNS resolution error is detected, in snr_resolution_error_cb(), the
server address must be reset only if the server status has changed. It this
case, it means the server is set to RMAINT. Thus the server address may by
reset.
This patch fixes a bug introduced by commit
d127ffa9f ("BUG/MEDIUM:
resolvers: Reset address for unresolved servers"). It must be backported as
far as 2.0.
(cherry picked from commit
5130c21fbb806a28ab4e535b700df872a80798d8)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit
7c9201e08f03367db74f2fca795cb1eb35d14554)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit
06623af1dc7088a2f48a3aeb53e252edfea66ec6)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
if (!s)
return 1;
HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
- snr_update_srv_status(s, 1);
- memset(&s->addr, 0, sizeof(s->addr));
+ if (!snr_update_srv_status(s, 1))
+ memset(&s->addr, 0, sizeof(s->addr));
HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
return 1;
}