Commit 681b1839 authored by chenzhengzhang's avatar chenzhengzhang
Browse files

[trac699] Look up additional data for ANY type query

parent b5c567f9
...@@ -210,6 +210,8 @@ Query::process() const { ...@@ -210,6 +210,8 @@ Query::process() const {
// into answer section. // into answer section.
BOOST_FOREACH(RRsetPtr rrset, *target) { BOOST_FOREACH(RRsetPtr rrset, *target) {
response_.addRRset(Message::SECTION_ANSWER, rrset); response_.addRRset(Message::SECTION_ANSWER, rrset);
// Handle additional for answer section
getAdditional(*result.zone, *rrset.get());
} }
} else { } else {
response_.addRRset(Message::SECTION_ANSWER, response_.addRRset(Message::SECTION_ANSWER,
......
...@@ -341,12 +341,20 @@ TEST_F(QueryTest, apexAnyMatch) { ...@@ -341,12 +341,20 @@ TEST_F(QueryTest, apexAnyMatch) {
// in the answer section from the additional. // in the answer section from the additional.
EXPECT_NO_THROW(Query(memory_datasrc, Name("example.com"), EXPECT_NO_THROW(Query(memory_datasrc, Name("example.com"),
RRType::ANY(), response).process()); RRType::ANY(), response).process());
responseCheck(response, Rcode::NOERROR(), AA_FLAG, 4, 0, 0, responseCheck(response, Rcode::NOERROR(), AA_FLAG, 4, 0, 3,
"example.com. 3600 IN SOA . . 0 0 0 0 0\n" "example.com. 3600 IN SOA . . 0 0 0 0 0\n"
"example.com. 3600 IN NS glue.delegation.example.com.\n" "example.com. 3600 IN NS glue.delegation.example.com.\n"
"example.com. 3600 IN NS noglue.example.com.\n" "example.com. 3600 IN NS noglue.example.com.\n"
"example.com. 3600 IN NS example.net.\n", "example.com. 3600 IN NS example.net.\n",
NULL, NULL, mock_zone->getOrigin()); NULL, ns_addrs_txt, mock_zone->getOrigin());
}
TEST_F(QueryTest, mxANYMatch) {
EXPECT_NO_THROW(Query(memory_datasrc, Name("mx.example.com"),
RRType::ANY(), response).process());
responseCheck(response, Rcode::NOERROR(), AA_FLAG, 3, 3, 4,
mx_txt, zone_ns_txt,
(string(ns_addrs_txt) + string(www_a_txt)).c_str());
} }
TEST_F(QueryTest, glueANYMatch) { TEST_F(QueryTest, glueANYMatch) {
......
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