Commit 19f4d840 authored by Evan Hunt's avatar Evan Hunt

Merge branch '260-queries-with-empty-question-section-return-noerror-v9_12-v9_11' into 'v9_11'

Resolve "Queries with empty question section (and otherwise query message of undetermined RDCLASS) return NOERROR instead of FORMERR"

See merge request !436
parents 7cf35171 f07560a5
Pipeline #2653 failed with stages
in 7 minutes and 7 seconds
4982. [cleanup] Return FORMERR if the question section is empty
and no COOKIE option is present; this restores
older behavior except in the newly specified
COOKIE case. [GL #260]
4981. [bug] Fix race in cmsg buffer usage in socket code.
[GL #180]
......
......@@ -2538,9 +2538,10 @@ client_request(isc_task_t *task, isc_event_t *event) {
}
if (client->message->rdclass == 0) {
if ((client->attributes & NS_CLIENTATTR_WANTCOOKIE) != 0 ||
(client->message->opcode == dns_opcode_query &&
client->message->counts[DNS_SECTION_QUESTION] == 0U)) {
if ((client->attributes & NS_CLIENTATTR_WANTCOOKIE) != 0 &&
client->message->opcode == dns_opcode_query &&
client->message->counts[DNS_SECTION_QUESTION] == 0U)
{
result = dns_message_reply(client->message, ISC_TRUE);
if (result != ISC_R_SUCCESS) {
ns_client_error(client, result);
......
......@@ -54,6 +54,24 @@ do
status=`expr $status + $ret`
done
n=`expr $n + 1`
echo_i "checking RCODE=FORMERR to query without question section and without COOKIE option ($n)"
ret=0
$DIG $DIGOPTS +qr +header-only +nocookie version.bind txt ch @10.53.0.1 > dig.out.test$n
grep COOKIE: dig.out.test$n > /dev/null && ret=1
grep "status: FORMERR" dig.out.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking RCODE=NOERROR to query without question section and with COOKIE option ($n)"
ret=0
$DIG $DIGOPTS +qr +header-only +cookie version.bind txt ch @10.53.0.1 > dig.out.test$n
grep COOKIE: dig.out.test$n > /dev/null || ret=1
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking COOKIE token is returned to empty COOKIE option ($n)"
ret=0
......
......@@ -14,7 +14,7 @@ SYSTEMTESTTOP=..
status=0
echo_i "test name to long"
echo_i "test name too long"
$PERL formerr.pl -a 10.53.0.1 -p ${PORT} nametoolong > nametoolong.out
ans=`grep got: nametoolong.out`
if [ "${ans}" != "got: 000080010000000000000000" ];
......@@ -30,11 +30,12 @@ then
echo_i "failed"; status=`expr $status + 1`;
fi
# this one is now NOERROR
echo_i "no questions"
# this would be NOERROR if it included a COOKIE option,
# but is a FORMERR without one.
echo_i "empty question section (and no COOKIE option)"
$PERL formerr.pl -a 10.53.0.1 -p ${PORT} noquestions > noquestions.out
ans=`grep got: noquestions.out`
if [ "${ans}" != "got: 000080000000000000000000" ];
if [ "${ans}" != "got: 000080010000000000000000" ];
then
echo_i "failed"; status=`expr $status + 1`;
fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment