summaryrefslogtreecommitdiff
path: root/bin/named/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/named/client.c')
-rw-r--r--bin/named/client.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/bin/named/client.c b/bin/named/client.c
index f66ceda83d50..de2d596c8832 100644
--- a/bin/named/client.c
+++ b/bin/named/client.c
@@ -15,8 +15,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id$ */
-
#include <config.h>
#include <isc/formatcheck.h>
@@ -25,6 +23,7 @@
#include <isc/platform.h>
#include <isc/print.h>
#include <isc/queue.h>
+#include <isc/random.h>
#include <isc/stats.h>
#include <isc/stdio.h>
#include <isc/string.h>
@@ -113,6 +112,7 @@
*/
#endif
+
/*% nameserver client manager structure */
struct ns_clientmgr {
/* Unlocked. */
@@ -328,12 +328,12 @@ exit_check(ns_client_t *client) {
* We are trying to abort request processing.
*/
if (client->nsends > 0) {
- isc_socket_t *socket;
+ isc_socket_t *sock;
if (TCP_CLIENT(client))
- socket = client->tcpsocket;
+ sock = client->tcpsocket;
else
- socket = client->udpsocket;
- isc_socket_cancel(socket, client->task,
+ sock = client->udpsocket;
+ isc_socket_cancel(sock, client->task,
ISC_SOCKCANCEL_SEND);
}
@@ -828,16 +828,16 @@ client_sendpkg(ns_client_t *client, isc_buffer_t *buffer) {
isc_result_t result;
isc_region_t r;
isc_sockaddr_t *address;
- isc_socket_t *socket;
+ isc_socket_t *sock;
isc_netaddr_t netaddr;
int match;
unsigned int sockflags = ISC_SOCKFLAG_IMMEDIATE;
if (TCP_CLIENT(client)) {
- socket = client->tcpsocket;
+ sock = client->tcpsocket;
address = NULL;
} else {
- socket = client->udpsocket;
+ sock = client->udpsocket;
address = &client->peeraddr;
isc_netaddr_fromsockaddr(&netaddr, &client->peeraddr);
@@ -861,7 +861,7 @@ client_sendpkg(ns_client_t *client, isc_buffer_t *buffer) {
CTRACE("sendto");
- result = isc_socket_sendto2(socket, &r, client->task,
+ result = isc_socket_sendto2(sock, &r, client->task,
address, pktinfo,
client->sendevent, sockflags);
if (result == ISC_R_SUCCESS || result == ISC_R_INPROGRESS) {
@@ -1171,10 +1171,15 @@ ns_client_error(ns_client_t *client, isc_result_t result) {
isc_boolean_t wouldlog;
char log_buf[DNS_RRL_LOG_BUF_LEN];
dns_rrl_result_t rrl_result;
+ int loglevel;
INSIST(rcode != dns_rcode_noerror &&
rcode != dns_rcode_nxdomain);
- wouldlog = isc_log_wouldlog(ns_g_lctx, DNS_RRL_LOG_DROP);
+ if (ns_g_server->log_queries)
+ loglevel = DNS_RRL_LOG_DROP;
+ else
+ loglevel = ISC_LOG_DEBUG(1);
+ wouldlog = isc_log_wouldlog(ns_g_lctx, loglevel);
rrl_result = dns_rrl(client->view, &client->peeraddr,
TCP_CLIENT(client),
dns_rdataclass_in, dns_rdatatype_none,
@@ -1191,7 +1196,7 @@ ns_client_error(ns_client_t *client, isc_result_t result) {
ns_client_log(client,
NS_LOGCATEGORY_QUERY_EERRORS,
NS_LOGMODULE_CLIENT,
- DNS_RRL_LOG_DROP,
+ loglevel,
"%s", log_buf);
}
/*
@@ -1646,7 +1651,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
}
if (TCP_CLIENT(client))
isc_stats_increment(ns_g_server->nsstats,
- dns_nsstatscounter_tcp);
+ dns_nsstatscounter_requesttcp);
/*
* It's a request. Parse it.
@@ -1657,6 +1662,13 @@ client_request(isc_task_t *task, isc_event_t *event) {
* Parsing the request failed. Send a response
* (typically FORMERR or SERVFAIL).
*/
+ if (result == DNS_R_OPTERR)
+ (void)client_addopt(client);
+
+ ns_client_log(client, NS_LOGCATEGORY_CLIENT,
+ NS_LOGMODULE_CLIENT, ISC_LOG_WARNING,
+ "message parsing failed: %s",
+ isc_result_totext(result));
ns_client_error(client, result);
goto cleanup;
}
@@ -2777,7 +2789,7 @@ void
ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
isc_logmodule_t *module, int level, const char *fmt, va_list ap)
{
- char msgbuf[2048];
+ char msgbuf[4096];
char peerbuf[ISC_SOCKADDR_FORMATSIZE];
char signerbuf[DNS_NAME_FORMATSIZE], qnamebuf[DNS_NAME_FORMATSIZE];
const char *viewname = "";