From 5defbb76ea25dba00099234e8b7276cd61a9fcc5 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 29 May 2014 08:04:55 +1000 Subject: [PATCH] 3863. [bug] The "E" flag was missing from the query log as a unintended side effect of code rearrangement to support EDNS EXPIRE. [RT #36117] --- CHANGES | 4 ++++ bin/named/query.c | 8 +++----- bin/tests/system/resolver/ns5/named.conf | 1 + bin/tests/system/resolver/tests.sh | 11 +++++++++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 8745cb4645..f7ee8272b8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +3863. [bug] The "E" flag was missing from the query log as a + unintended side effect of code rearrangement to + support EDNS EXPIRE. [RT #36117] + 3862. [cleanup] Return immediately if we are not going to log the message in ns_client_dumpmessage. diff --git a/bin/named/query.c b/bin/named/query.c index 01ef572044..4f93210492 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -8111,8 +8111,8 @@ log_query(ns_client_t *client, unsigned int flags, unsigned int extflags) { ns_client_log(client, NS_LOGCATEGORY_QUERIES, NS_LOGMODULE_QUERY, level, "query: %s %s %s %s%s%s%s%s%s (%s)", namebuf, classname, typename, WANTRECURSION(client) ? "+" : "-", - (client->signer != NULL) ? "S": "", - (client->opt != NULL) ? "E" : "", + (client->signer != NULL) ? "S" : "", + (client->ednsversion >= 0) ? "E" : "", ((client->attributes & NS_CLIENTATTR_TCP) != 0) ? "T" : "", ((extflags & DNS_MESSAGEEXTFLAG_DO) != 0) ? "D" : "", @@ -8191,8 +8191,6 @@ ns_query_start(ns_client_t *client) { if (!client->view->enablednssec) { message->flags &= ~DNS_MESSAGEFLAG_CD; client->extflags &= ~DNS_MESSAGEEXTFLAG_DO; - if (client->opt != NULL) - client->opt->ttl &= ~DNS_MESSAGEEXTFLAG_DO; } if ((message->flags & DNS_MESSAGEFLAG_RD) != 0) @@ -8304,7 +8302,7 @@ ns_query_start(ns_client_t *client) { /* * Turn on minimal responses for EDNS/UDP bufsize 512 queries. */ - if (client->opt != NULL && client->udpsize <= 512U && + if (client->ednsversion >= 0 && client->udpsize <= 512U && (client->attributes & NS_CLIENTATTR_TCP) == 0) client->query.attributes |= (NS_QUERYATTR_NOAUTHORITY | NS_QUERYATTR_NOADDITIONAL); diff --git a/bin/tests/system/resolver/ns5/named.conf b/bin/tests/system/resolver/ns5/named.conf index af8d073d56..120d0fa481 100644 --- a/bin/tests/system/resolver/ns5/named.conf +++ b/bin/tests/system/resolver/ns5/named.conf @@ -29,6 +29,7 @@ options { listen-on { 10.53.0.5; }; listen-on-v6 { none; }; recursion yes; + querylog yes; }; zone "." { diff --git a/bin/tests/system/resolver/tests.sh b/bin/tests/system/resolver/tests.sh index 075c49d612..324119b142 100755 --- a/bin/tests/system/resolver/tests.sh +++ b/bin/tests/system/resolver/tests.sh @@ -475,5 +475,16 @@ $DIG @10.53.0.5 -p 5300 fetchall.tld any > dig.out.3.${n} || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` +n=`expr $n + 1` +echo "I:check that E was logged on EDNS queries in the query log (${n})" +ret=0 +grep "query: fetchall.tld IN ANY +E" ns5/named.run > /dev/null || ret=1 +$DIG @10.53.0.5 -p 5300 +noedns noedns.fetchall.tld any > dig.out.2.${n} || ret=1 +grep "query: noedns.fetchall.tld IN ANY" ns5/named.run > /dev/null || ret=1 +grep "query: noedns.fetchall.tld IN ANY +E" ns5/named.run > /dev/null && ret=1 +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + + echo "I:exit status: $status" exit $status