static unsigned int udp_retries = 3;
static dns_rdataclass_t defaultclass = dns_rdataclass_in;
static dns_rdataclass_t zoneclass = dns_rdataclass_none;
+static isc_mutex_t answer_lock;
static dns_message_t *answer = NULL;
static uint32_t default_ttl = 0;
static bool default_ttl_set = false;
} else if (keyfile != NULL) {
setup_keyfile(gmctx, glctx);
}
+
+ isc_mutex_init(&answer_lock);
}
static int
return (STATUS_MORE);
}
if (strcasecmp(word, "answer") == 0) {
+ LOCK(&answer_lock);
if (answer != NULL) {
show_message(stdout, answer, "Answer:");
}
+ UNLOCK(&answer_lock);
return (STATUS_MORE);
}
if (strcasecmp(word, "key") == 0) {
return;
}
+ LOCK(&answer_lock);
result = dns_message_create(gmctx, DNS_MESSAGE_INTENTPARSE, &answer);
check_result(result, "dns_message_create");
result = dns_request_getresponse(request, answer,
if (debugging) {
show_message(stderr, answer, "\nReply from update query:");
}
+ UNLOCK(&answer_lock);
done:
dns_request_destroy(&request);
ddebug("start_update()");
+ LOCK(&answer_lock);
if (answer != NULL) {
dns_message_destroy(&answer);
}
+ UNLOCK(&answer_lock);
/*
* If we have both the zone and the servers we have enough information
cleanup(void) {
ddebug("cleanup()");
+ LOCK(&answer_lock);
if (answer != NULL) {
dns_message_destroy(&answer);
}
+ UNLOCK(&answer_lock);
#ifdef GSSAPI
if (tsigkey != NULL) {
isc_mem_stats(gmctx, stderr);
}
isc_mem_destroy(&gmctx);
+
+ isc_mutex_destroy(&answer_lock);
}
static void