return;
}
+ const Opcode opcode = message.getOpcode();
+ stats_attrs.setRequestOpCode(opcode);
+
try {
// Parse the message.
message.fromWire(request_buffer);
return;
}
- const Opcode opcode = message.getOpcode();
bool send_answer = true;
try {
// note: This can only be reliable after TSIG check succeeds.
}
// note: This can only be reliable after TSIG check succeeds.
- stats_attrs.setRequestOpCode(opcode);
-
if (opcode == Opcode::NOTIFY()) {
send_answer = impl_->processNotify(io_message, message, buffer,
tsig_context, stats_attrs);
<!-- ### STATISTICS DATA PLACEHOLDER ### -->
- <note><para>
- DNS parameters (e.g. opcode) in the request message will not be
- considered if <command>b10-auth</command> failed to parse message,
- including but not limited to the following circumstance:
- <itemizedlist>
- <listitem><para>
- EDNS version of a message is unknown to
- <command>b10-auth</command>.
- </para></listitem>
- <listitem><para>
- TSIG signature verification fails.
- </para></listitem>
- </itemizedlist>
- </para></note>
-
</refsect1>
<refsect1>
// OPCODE
const boost::optional<isc::dns::Opcode>& opcode =
msgattrs.getRequestOpCode();
- // Increment opcode counter only if the opcode exists.
+ // Increment opcode counter only if the opcode exists; it can happen if
+ // short message which does not contain DNS header received.
if (opcode) {
server_msg_counter_.inc(opcode_to_msgcounter[opcode.get().getCode()]);
}
const boost::optional<isc::dns::Opcode>& opcode =
msgattrs.getRequestOpCode();
- if (opcode && opcode.get() == Opcode::QUERY()) {
+ if (!opcode) {
+ isc_throw(isc::Unexpected, "Opcode of the request is empty while it is"
+ " responded");
+ }
+ if (!msgattrs.getRequestSigBadSig() &&
+ opcode.get() == Opcode::QUERY())
+ {
// compound attributes
const unsigned int answer_rrs =
response.getRRCount(Message::SECTION_ANSWER);
/// \param msgattrs DNS message attributes.
/// \param response DNS response message.
/// \param done DNS response was sent to the client.
- /// \throw None
+ /// \throw isc::Unexpected Internal condition check failed.
void inc(const MessageAttributes& msgattrs,
const isc::dns::Message& response, const bool done);
// Query with a broken question
TEST_F(AuthSrvTest, shortQuestion) {
shortQuestion();
- checkAllRcodeCountersZeroExcept(Rcode::FORMERR(), 1);
+ ConstElementPtr stats_after = server.getStatistics()->get("zones")->
+ get("_SERVER_");
+ std::map<std::string, int> expect;
+ expect["request.v4"] = 1;
+ expect["request.udp"] = 1;
+ expect["opcode.query"] = 1;
+ expect["responses"] = 1;
+ expect["rcode.formerr"] = 1;
+ expect["qrynoauthans"] = 1;
+ checkStatisticsCounters(stats_after, expect);
}
// Query with a broken answer section
TEST_F(AuthSrvTest, shortAnswer) {
shortAnswer();
- checkAllRcodeCountersZeroExcept(Rcode::FORMERR(), 1);
+ ConstElementPtr stats_after = server.getStatistics()->get("zones")->
+ get("_SERVER_");
+ std::map<std::string, int> expect;
+ expect["request.v4"] = 1;
+ expect["request.udp"] = 1;
+ expect["opcode.query"] = 1;
+ expect["responses"] = 1;
+ expect["rcode.formerr"] = 1;
+ expect["qrynoauthans"] = 1;
+ checkStatisticsCounters(stats_after, expect);
}
// Query with unsupported version of EDNS.
expect["request.v4"] = 1;
expect["request.badednsver"] = 1;
expect["request.udp"] = 1;
+ expect["opcode.query"] = 1;
expect["responses"] = 1;
expect["rcode.badvers"] = 1;
+ expect["qrynoauthans"] = 1;
checkStatisticsCounters(stats_after, expect);
}