diff options
Diffstat (limited to 'bin/named/client.c')
| -rw-r--r-- | bin/named/client.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/bin/named/client.c b/bin/named/client.c index aed3b178133c..f66ceda83d50 100644 --- a/bin/named/client.c +++ b/bin/named/client.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -532,6 +532,17 @@ exit_check(ns_client_t *client) { INSIST(client->recursionquota == NULL); INSIST(!ISC_QLINK_LINKED(client, ilink)); + if (manager != NULL) { + LOCK(&manager->listlock); + ISC_LIST_UNLINK(manager->clients, client, link); + LOCK(&manager->lock); + if (manager->exiting && + ISC_LIST_EMPTY(manager->clients)) + destroy_manager = ISC_TRUE; + UNLOCK(&manager->lock); + UNLOCK(&manager->listlock); + } + ns_query_free(client); isc_mem_put(client->mctx, client->recvbuf, RECV_BUFFER_SIZE); isc_event_free((isc_event_t **)&client->sendevent); @@ -549,16 +560,6 @@ exit_check(ns_client_t *client) { } dns_message_destroy(&client->message); - if (manager != NULL) { - LOCK(&manager->listlock); - ISC_LIST_UNLINK(manager->clients, client, link); - LOCK(&manager->lock); - if (manager->exiting && - ISC_LIST_EMPTY(manager->clients)) - destroy_manager = ISC_TRUE; - UNLOCK(&manager->lock); - UNLOCK(&manager->listlock); - } /* * Detaching the task must be done after unlinking from @@ -579,6 +580,13 @@ exit_check(ns_client_t *client) { isc_mem_stats(client->mctx, stderr); INSIST(0); } + + /* + * Destroy the fetchlock mutex that was created in + * ns_query_init(). + */ + DESTROYLOCK(&client->query.fetchlock); + isc_mem_putanddetach(&client->mctx, client, sizeof(*client)); } @@ -1283,7 +1291,6 @@ client_addopt(ns_client_t *client) { (ns_g_server->server_id != NULL || ns_g_server->server_usehostname)) { if (ns_g_server->server_usehostname) { - isc_result_t result; result = ns_os_gethostname(nsid, sizeof(nsid)); if (result != ISC_R_SUCCESS) { goto no_nsid; @@ -1677,8 +1684,18 @@ client_request(isc_task_t *task, isc_event_t *event) { /* * Deal with EDNS. */ - opt = dns_message_getopt(client->message); + if (ns_g_noedns) + opt = NULL; + else + opt = dns_message_getopt(client->message); if (opt != NULL) { + /* + * Are we dropping all EDNS queries? + */ + if (ns_g_dropedns) { + ns_client_next(client, ISC_R_SUCCESS); + goto cleanup; + } result = process_opt(client, opt); if (result != ISC_R_SUCCESS) goto cleanup; |
