#include <dns/dnstap.h>
#include <dns/cache.h>
#include <dns/edns.h>
+#include <dns/enumclass.h>
#include <dns/events.h>
#include <dns/message.h>
#include <dns/peer.h>
goto cleanup;
}
- if (client->message->rdclass == 0) {
+ char classbuf[DNS_RDATACLASS_FORMATSIZE];
+ switch (client->message->rdclass) {
+ case dns_rdataclass_reserved0:
if ((client->attributes & NS_CLIENTATTR_WANTCOOKIE) != 0 &&
client->message->opcode == dns_opcode_query &&
client->message->counts[DNS_SECTION_QUESTION] == 0U)
"message class could not be determined");
ns_client_error(client, notimp ? DNS_R_NOTIMP : DNS_R_FORMERR);
goto cleanup;
+ case dns_rdataclass_in:
+ break;
+ case dns_rdataclass_chaos:
+ break;
+ case dns_rdataclass_hs:
+ break;
+ case dns_rdataclass_none:
+ if (client->message->opcode != dns_opcode_update) {
+ ns_client_dumpmessage(client,
+ "message class NONE can be only "
+ "used in DNS updates");
+ ns_client_error(client, DNS_R_FORMERR);
+ return;
+ }
+ break;
+ case dns_rdataclass_any:
+ /*
+ * Required for TKEY negotiation.
+ */
+ if (client->message->tkey == 0) {
+ ns_client_dumpmessage(client,
+ "message class ANY can be only "
+ "used for TKEY negotiation");
+ ns_client_error(client, DNS_R_FORMERR);
+ return;
+ }
+ break;
+ default:
+ dns_rdataclass_format(client->message->rdclass, classbuf,
+ sizeof(classbuf));
+ ns_client_dumpmessage(client, NULL);
+ ns_client_log(client, NS_LOGCATEGORY_CLIENT,
+ NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(1),
+ "message class could not be determined");
+ ns_client_dumpmessage(client, "message class could not be "
+ "determined");
+ ns_client_error(client, DNS_R_NOTIMP);
+ goto cleanup;
}
/*
ns_client_log(client, NS_LOGCATEGORY_CLIENT,
NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(1),
"no matching view in class '%s'", classname);
- ns_client_dumpmessage(client, "no matching view in class");
+ ns_client_dumpmessage(client, NULL);
ns_client_error(client, notimp ? DNS_R_NOTIMP : DNS_R_REFUSED);
goto cleanup;
}
int len = 1024;
isc_result_t result;
- if (!isc_log_wouldlog(ns_g_lctx, ISC_LOG_DEBUG(1)))
+ if (!isc_log_wouldlog(ns_g_lctx, ISC_LOG_DEBUG(1)) || reason == NULL) {
return;
+ }
/*
* Note that these are multiline debug messages. We want a newline
for i in 1 2
do
ret=0
- $DIG +short $DIGOPTS @10.53.0.1 a$i.example a class10 > dig.out || ret=1
- echo '\# 4 0A000001' | $DIFF - dig.out || ret=1
+ $DIG $DIGOPTS @10.53.0.1 a$i.example a class10 > dig.out || ret=1
+ grep -q "NOTIMP" dig.out || ret=1
if [ $ret != 0 ]
then
echo_i "#$i failed"
for i in 1 2 3 4
do
ret=0
- $DIG +short $DIGOPTS @10.53.0.1 txt$i.example txt class10 > dig.out || ret=1
- echo '"hello"' | $DIFF - dig.out || ret=1
+ $DIG $DIGOPTS @10.53.0.1 txt$i.example txt class10 > dig.out || ret=1
+ grep -q "NOTIMP" dig.out || ret=1
if [ $ret != 0 ]
then
echo_i "#$i failed"
for i in 1 2
do
ret=0
- $DIG +short $DIGOPTS @10.53.0.1 unk$i.example type123 class10 > dig.out || ret=1
- echo '\# 1 00' | $DIFF - dig.out || ret=1
+ $DIG $DIGOPTS @10.53.0.1 unk$i.example type123 class10 > dig.out || ret=1
+ grep -q "NOTIMP" dig.out || ret=1
if [ $ret != 0 ]
then
echo_i "#$i failed"