Commit 2603bb09 authored by Evan Hunt's avatar Evan Hunt
Browse files

- added a test for a query on DNAME at a zone cut

- corrected behavior of test data source with regard to the REFERRAL flag


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1491 e5f2f494-b856-4b98-b285-d166d9295462
parent 85ced3ae
......@@ -604,31 +604,6 @@ TEST_F(DataSrcTest, ANYZonecut) {
// delegation
readAndProcessQuery("testdata/q_subzone_any");
headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
RRsetIterator rit = msg.beginSection(Section::AUTHORITY());
RRsetPtr rrset = *rit;
EXPECT_EQ(Name("subzone.example.com."), rrset->getName());
EXPECT_EQ(RRType::NS(), rrset->getType());
EXPECT_EQ(RRClass::IN(), rrset->getClass());
RdataIteratorPtr it = rrset->getRdataIterator();
it->first();
EXPECT_EQ("ns1.subzone.example.com.", it->getCurrent().toText());
it->next();
EXPECT_FALSE(it->isLast());
rit = msg.beginSection(Section::ADDITIONAL());
rrset = *rit;
EXPECT_EQ(Name("ns1.subzone.example.com"), rrset->getName());
EXPECT_EQ(RRType::A(), rrset->getType());
EXPECT_EQ(RRClass::IN(), rrset->getClass());
it = rrset->getRdataIterator();
it->first();
EXPECT_EQ("192.0.2.1", it->getCurrent().toText());
it->next();
EXPECT_TRUE(it->isLast());
}
TEST_F(DataSrcTest, NSECZonecut) {
......@@ -659,6 +634,35 @@ TEST_F(DataSrcTest, NSECZonecut) {
EXPECT_TRUE(it->isLast());
}
TEST_F(DataSrcTest, DNAMEZonecut) {
readAndProcessQuery("testdata/q_subzone_dname");
headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
RRsetIterator rit = msg.beginSection(Section::AUTHORITY());
RRsetPtr rrset = *rit;
EXPECT_EQ(Name("subzone.example.com."), rrset->getName());
EXPECT_EQ(RRType::NS(), rrset->getType());
EXPECT_EQ(RRClass::IN(), rrset->getClass());
RdataIteratorPtr it = rrset->getRdataIterator();
it->first();
EXPECT_EQ("ns1.subzone.example.com.", it->getCurrent().toText());
it->next();
EXPECT_FALSE(it->isLast());
rit = msg.beginSection(Section::ADDITIONAL());
rrset = *rit;
EXPECT_EQ(Name("ns1.subzone.example.com"), rrset->getName());
EXPECT_EQ(RRType::A(), rrset->getType());
EXPECT_EQ(RRClass::IN(), rrset->getClass());
it = rrset->getRdataIterator();
it->first();
EXPECT_EQ("192.0.2.1", it->getCurrent().toText());
it->next();
EXPECT_TRUE(it->isLast());
}
TEST_F(DataSrcTest, DS) {
readAndProcessQuery("testdata/q_subzone_ds");
......
......@@ -485,19 +485,16 @@ TestDataSrc::findRecords(const Name& name, const RRType& rdtype,
target.addRRset(sql1_ns);
flags |= REFERRAL;
} else if (name == sql1) {
flags |= REFERRAL;
if (any) {
target.addRRset(sql1_ns);
target.addRRset(sql1_nsec);
flags |= REFERRAL;
} else if (rdtype == RRType::NS()) {
target.addRRset(sql1_ns);
flags |= REFERRAL;
} else if (rdtype == RRType::SOA()) {
target.addRRset(sql1_soa);
flags |= REFERRAL;
} else if (rdtype == RRType::NSEC()) {
target.addRRset(sql1_nsec);
flags |= REFERRAL;
} else {
flags |= TYPE_NOT_FOUND;
}
......@@ -509,7 +506,6 @@ TestDataSrc::findRecords(const Name& name, const RRType& rdtype,
target.addRRset(www_sql1_a);
} else if (rdtype == RRType::NSEC()) {
target.addRRset(www_sql1_nsec);
flags |= REFERRAL;
} else {
flags |= TYPE_NOT_FOUND;
}
......@@ -521,20 +517,17 @@ TestDataSrc::findRecords(const Name& name, const RRType& rdtype,
target.addRRset(example_ns);
flags |= REFERRAL;
} else if (name == example) {
flags |= REFERRAL;
if (any) {
target.addRRset(example_ns);
target.addRRset(example_soa);
target.addRRset(example_nsec);
flags |= REFERRAL;
} else if (rdtype == RRType::NS()) {
target.addRRset(example_ns);
flags |= REFERRAL;
} else if (rdtype == RRType::SOA()) {
target.addRRset(example_soa);
flags |= REFERRAL;
} else if (rdtype == RRType::NSEC()) {
target.addRRset(example_nsec);
flags |= REFERRAL;
} else {
flags |= TYPE_NOT_FOUND;
}
......@@ -544,20 +537,17 @@ TestDataSrc::findRecords(const Name& name, const RRType& rdtype,
target.addRRset(sql1_ds_nsec);
flags |= REFERRAL;
} else if (name == sql1) {
flags |= REFERRAL;
if (any) {
target.addRRset(sql1_ns);
target.addRRset(sql1_ds);
target.addRRset(sql1_ds_nsec);
flags |= REFERRAL;
} else if (rdtype == RRType::DS()) {
target.addRRset(sql1_ds);
flags |= REFERRAL;
} else if (rdtype == RRType::NS()) {
target.addRRset(sql1_ns);
flags |= REFERRAL;
} else if (rdtype == RRType::NSEC()) {
target.addRRset(sql1_ds_nsec);
flags |= REFERRAL;
} else {
flags |= TYPE_NOT_FOUND;
}
......@@ -566,19 +556,16 @@ TestDataSrc::findRecords(const Name& name, const RRType& rdtype,
target.addRRset(subzone_ds);
flags |= REFERRAL;
} else if (name == subzone) {
flags |= REFERRAL;
if (any) {
target.addRRset(subzone_ns);
target.addRRset(subzone_nsec);
flags |= REFERRAL;
} else if (rdtype == RRType::NS()) {
target.addRRset(subzone_ns);
flags |= REFERRAL;
} else if (rdtype == RRType::DS()) {
target.addRRset(subzone_ds);
flags |= REFERRAL;
} else if (rdtype == RRType::NSEC()) {
target.addRRset(subzone_nsec);
flags |= REFERRAL;
} else {
flags |= TYPE_NOT_FOUND;
}
......@@ -652,7 +639,6 @@ TestDataSrc::findRecords(const Name& name, const RRType& rdtype,
target.addRRset(www_a);
} else if (rdtype == RRType::NSEC()) {
target.addRRset(www_nsec);
flags |= REFERRAL;
} else {
flags |= TYPE_NOT_FOUND;
}
......@@ -684,16 +670,14 @@ TestDataSrc::findRecords(const Name& name, const RRType& rdtype,
}
}
} else if (name == dname) {
flags |= REFERRAL;
if (any) {
target.addRRset(dname_dname);
target.addRRset(dname_nsec);
flags |= REFERRAL;
} else if (rdtype == RRType::DNAME()) {
target.addRRset(dname_dname);
flags |= REFERRAL;
} else if (rdtype == RRType::NSEC()) {
target.addRRset(dns01_nsec);
flags |= REFERRAL;
} else {
flags |= TYPE_NOT_FOUND;
}
......
# subzone.example.com/DNAME (DNAME query at zone cut)
14 f0 01 00 00 01 00 00 00 00 00 00 07 73 75 62
7a 6f 6e 65 07 65 78 61 6d 70 6c 65 03 63 6f 6d
00 00 27 00 01
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