+4149. [bug] Fixed a race condition in the getaddrinfo()
+ implementation in libirs, which caused the delv
+ utility to crash with an assertion failure when using
+ the '@server' syntax with a hostname argument.
+ [RT #39899]
+
4148. [bug] Fix a bug when printing zone names with '/' character
in XML and JSON statistics output. [RT #39873]
#include <isc/sockaddr.h>
#include <isc/string.h>
#include <isc/util.h>
+#include <isc/mutex.h>
#include <dns/client.h>
#include <dns/fixedname.h>
int ai_port;
isc_appctx_t *actx;
dns_client_t *dnsclient;
+ isc_mutex_t list_lock;
ISC_LIST(struct gai_resstate) resstates;
unsigned int activestates;
} gai_statehead_t;
* and have any answer, we can stop now by canceling the
* others.
*/
+ LOCK(&resstate->head->list_lock);
if (resstate == ISC_LIST_HEAD(resstate->head->resstates)) {
if ((resstate->trans4 != NULL &&
resstate->trans4->ai_sentinel.ai_next != NULL) ||
resstate, link);
}
}
+ UNLOCK(&resstate->head->list_lock);
}
}
head.ai_port = port;
head.actx = actx;
head.dnsclient = client;
+ result = isc_mutex_init(&head.list_lock);
+ if (result != ISC_R_SUCCESS) {
+ return (EAI_FAIL);
+ }
+
ISC_LIST_INIT(head.resstates);
result = make_resstates(mctx, hostname, &head, conf);
- if (result != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS) {
+ DESTROYLOCK(&head.list_lock);
return (EAI_FAIL);
+ }
+ LOCK(&head.list_lock);
for (resstate = ISC_LIST_HEAD(head.resstates);
resstate != NULL; resstate = ISC_LIST_NEXT(resstate, link)) {
if (resstate->trans4 != NULL) {
resstate->trans6->is_inprogress= ISC_FALSE;
}
}
+ UNLOCK(&head.list_lock);
+
if (!all_fail) {
/* Start all the events */
isc_app_ctxrun(actx);
irs_context_destroy(&irsctx);
#endif
+ DESTROYLOCK(&head.list_lock);
return (error);
}