mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
BUG/MINOR: resolvers: Unlink DNS resolution to set RMAINT on SRV resolution
When a server is set in RMAINT becaues of a SRV resolution failure, the server DNS resolution, if any, must be unlink first. It is mandatory to handle the change in the context of a SRV resolution. This patch must be backported as far as 2.2.
This commit is contained in:
parent
5130c21fbb
commit
bca680ba90
@ -571,13 +571,13 @@ static void resolv_check_response(struct resolv_resolution *res)
|
|||||||
if (srv->srvrq == srvrq && srv->svc_port == item->port &&
|
if (srv->srvrq == srvrq && srv->svc_port == item->port &&
|
||||||
item->data_len == srv->hostname_dn_len &&
|
item->data_len == srv->hostname_dn_len &&
|
||||||
!resolv_hostname_cmp(srv->hostname_dn, item->target, item->data_len)) {
|
!resolv_hostname_cmp(srv->hostname_dn, item->target, item->data_len)) {
|
||||||
|
resolv_unlink_resolution(srv->resolv_requester);
|
||||||
snr_update_srv_status(srv, 1);
|
snr_update_srv_status(srv, 1);
|
||||||
ha_free(&srv->hostname);
|
ha_free(&srv->hostname);
|
||||||
ha_free(&srv->hostname_dn);
|
ha_free(&srv->hostname_dn);
|
||||||
srv->hostname_dn_len = 0;
|
srv->hostname_dn_len = 0;
|
||||||
memset(&srv->addr, 0, sizeof(srv->addr));
|
memset(&srv->addr, 0, sizeof(srv->addr));
|
||||||
srv->svc_port = 0;
|
srv->svc_port = 0;
|
||||||
resolv_unlink_resolution(srv->resolv_requester);
|
|
||||||
}
|
}
|
||||||
HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
|
HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
|
||||||
}
|
}
|
||||||
|
@ -3261,6 +3261,7 @@ int srvrq_resolution_error_cb(struct resolv_requester *requester, int error_code
|
|||||||
for (s = srvrq->proxy->srv; s != NULL; s = s->next) {
|
for (s = srvrq->proxy->srv; s != NULL; s = s->next) {
|
||||||
HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
|
HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
|
||||||
if (s->srvrq == srvrq) {
|
if (s->srvrq == srvrq) {
|
||||||
|
resolv_unlink_resolution(s->resolv_requester);
|
||||||
snr_update_srv_status(s, 1);
|
snr_update_srv_status(s, 1);
|
||||||
free(s->hostname);
|
free(s->hostname);
|
||||||
free(s->hostname_dn);
|
free(s->hostname_dn);
|
||||||
@ -3269,7 +3270,6 @@ int srvrq_resolution_error_cb(struct resolv_requester *requester, int error_code
|
|||||||
s->hostname_dn_len = 0;
|
s->hostname_dn_len = 0;
|
||||||
memset(&s->addr, 0, sizeof(s->addr));
|
memset(&s->addr, 0, sizeof(s->addr));
|
||||||
s->svc_port = 0;
|
s->svc_port = 0;
|
||||||
resolv_unlink_resolution(s->resolv_requester);
|
|
||||||
}
|
}
|
||||||
HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
|
HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user