BIND 10 trac595, updated. d3b169adf97f9c5a4990400e54562d644016fdaf [trac595] 1. Put file-scoped functions in unnamed namespace instead of by using static descriptor. 2. add brackets to the returned value. 3. Avoid using the domain names which may conflict with the current or future domain names.
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Feb 25 06:04:09 UTC 2011
The branch, trac595 has been updated
via d3b169adf97f9c5a4990400e54562d644016fdaf (commit)
from 7de2a6f3f96d466ed24f7d8b24708a30ee679729 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d3b169adf97f9c5a4990400e54562d644016fdaf
Author: zhanglikun <zhanglikun at cnnic.cn>
Date: Fri Feb 25 14:02:16 2011 +0800
[trac595] 1. Put file-scoped functions in unnamed namespace instead of by using static descriptor. 2. add brackets to the returned value. 3. Avoid using the domain names which may conflict with the current or future domain names.
-----------------------------------------------------------------------
Summary of changes:
src/lib/cache/message_entry.cc | 81 +++++++++++++-----------
src/lib/cache/tests/testdata/message_fromWire7 | 33 +++++-----
src/lib/cache/tests/testdata/message_fromWire8 | 39 ++++++------
3 files changed, 79 insertions(+), 74 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/cache/message_entry.cc b/src/lib/cache/message_entry.cc
index e296ed2..5f42ed5 100644
--- a/src/lib/cache/message_entry.cc
+++ b/src/lib/cache/message_entry.cc
@@ -23,6 +23,47 @@
using namespace isc::dns;
using namespace std;
+// Put file scope functions in unnamed namespace.
+namespace {
+
+// Get the deepest owner name of DNAME record for the given query name.
+Name
+getDeepestDNAMEOwner(const Message& message, const Name& query_name) {
+ Name dname = query_name;
+ RRsetIterator rrset_iter = message.beginSection(Message::SECTION_ANSWER);
+ while(rrset_iter != message.endSection(Message::SECTION_ANSWER)) {
+ if ((*rrset_iter)->getType() == RRType::DNAME()) {
+ const Name& rrname = (*rrset_iter)->getName();
+ if (NameComparisonResult::SUBDOMAIN ==
+ dname.compare(rrname).getRelation()) {
+ dname = rrname;
+ }
+ }
+ ++rrset_iter;
+ }
+
+ return (dname);
+}
+
+// Check whether answer section in given message has non-authoritative rrsets.
+bool
+answerHasNonAuthRecord(const Message& message, const Name& query_name) {
+ RRsetIterator rrset_iter = message.beginSection(Message::SECTION_ANSWER);
+ while(rrset_iter != message.endSection(Message::SECTION_ANSWER)) {
+ // Here, only check CNAME is enough. If there is
+ // cname record whose ower name is same with query name, answer
+ // section may has non-authoritative rrsets.
+ if ((*rrset_iter)->getType() == RRType::CNAME() &&
+ (*rrset_iter)->getName() == query_name) {
+ return (true);
+ }
+ ++rrset_iter;
+ }
+ return (false);
+}
+
+} // End of unnamed namespace
+
namespace isc {
namespace cache {
@@ -111,42 +152,6 @@ MessageEntry::genMessage(const time_t& time_now,
}
}
-// Get the deepest owner name of DNAME record for the given query name.
-static Name
-getDeepestDNAMEOwner(const Message& message, const Name& query_name) {
- Name dname = query_name;
- RRsetIterator rrset_iter = message.beginSection(Message::SECTION_ANSWER);
- while(rrset_iter != message.endSection(Message::SECTION_ANSWER)) {
- if ((*rrset_iter)->getType() == RRType::DNAME()) {
- const Name& rrname = (*rrset_iter)->getName();
- if (NameComparisonResult::SUBDOMAIN ==
- dname.compare(rrname).getRelation()) {
- dname = rrname;
- }
- }
- ++rrset_iter;
- }
-
- return dname;
-}
-
-// Check whether answer section in given message has non-authoritative rrsets.
-static bool
-answerHasNonAuthRecord(const Message& message, const Name& query_name) {
- RRsetIterator rrset_iter = message.beginSection(Message::SECTION_ANSWER);
- while(rrset_iter != message.endSection(Message::SECTION_ANSWER)) {
- // Here, only check CNAME is enough. If there is
- // cname record whose ower name is same with query name, answer
- // section may has non-authoritative rrsets.
- if ((*rrset_iter)->getType() == RRType::CNAME() &&
- (*rrset_iter)->getName() == query_name) {
- return true;
- }
- ++rrset_iter;
- }
- return false;
-}
-
RRsetTrustLevel
MessageEntry::getRRsetTrustLevel(const Message& message,
const isc::dns::RRsetPtr& rrset,
@@ -174,9 +179,9 @@ MessageEntry::getRRsetTrustLevel(const Message& message,
if ((type == RRType::CNAME() && name == query_name) ||
(type == RRType::DNAME() &&
name == getDeepestDNAMEOwner(message, query_name))) {
- return RRSET_TRUST_ANSWER_AA;
+ return (RRSET_TRUST_ANSWER_AA);
} else if (answerHasNonAuthRecord(message, query_name)) {
- return RRSET_TRUST_ANSWER_NONAA;
+ return (RRSET_TRUST_ANSWER_NONAA);
}
return (RRSET_TRUST_ANSWER_AA);
diff --git a/src/lib/cache/tests/testdata/message_fromWire7 b/src/lib/cache/tests/testdata/message_fromWire7
index c4f04a7..7b10b5d 100644
--- a/src/lib/cache/tests/testdata/message_fromWire7
+++ b/src/lib/cache/tests/testdata/message_fromWire7
@@ -1,26 +1,27 @@
-# ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1060
+#
+# ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1155
# ;; flags: qr aa rd; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0
# ;; WARNING: recursion requested but not available
#
# ;; QUESTION SECTION:
-# ;test.zlk.cn. IN A
+# ;test.example.com. IN A
#
# ;; ANSWER SECTION:
-# test.zlk.cn. 21600 IN CNAME cname.a.dname.test.zlk.cn.
-# a.dname.test.zlk.cn. 21600 IN DNAME dname.zlk.org.
-# cname.a.dname.test.zlk.cn. 21600 IN CNAME cname.dname.zlk.org.
-# dname.zlk.org. 21600 IN DNAME dname.zlk.com.
-# cname.dname.zlk.org. 21600 IN CNAME cname.dname.zlk.com.
+# test.example.com. 21600 IN CNAME cname.a.dname.example.com.
+# dname.example.com. 21600 IN DNAME dname.example.org.
+# cname.a.dname.example.com. 21600 IN CNAME cname.a.dname.example.org.
+# dname.example.org. 21600 IN DNAME dname.example.org.
+# cname.a.dname.example.org. 21600 IN CNAME cname.a.dname.example.org.
0424 8500
00 01 00 05 00 00 00 00 04 74 65 73
- 74 03 7a 6c 6b 02 63 6e 00 00 01 00 01 c0 0c 00
- 05 00 01 00 00 54 60 00 10 05 63 6e 61 6d 65 01
- 61 05 64 6e 61 6d 65 c0 0c c0 2f 00 27 00 01 00
- 00 54 60 00 0f 05 64 6e 61 6d 65 03 7a 6c 6b 03
- 6f 72 67 00 c0 29 00 05 00 01 00 00 54 60 00 08
- 05 63 6e 61 6d 65 c0 45 c0 45 00 27 00 01 00 00
- 54 60 00 0f 05 64 6e 61 6d 65 03 7a 6c 6b 03 63
- 6f 6d 00 c0 60 00 05 00 01 00 00 54 60 00 08 05
- 63 6e 61 6d 65 c0 74
+ 74 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 00 01
+ 00 01 c0 0c 00 05 00 01 00 00 54 60 00 10 05 63
+ 6e 61 6d 65 01 61 05 64 6e 61 6d 65 c0 11 c0 36
+ 00 27 00 01 00 00 54 60 00 13 05 64 6e 61 6d 65
+ 07 65 78 61 6d 70 6c 65 03 6f 72 67 00 c0 2e 00
+ 05 00 01 00 00 54 60 00 0a 05 63 6e 61 6d 65 01
+ 61 c0 4a c0 4a 00 27 00 01 00 00 54 60 00 13 05
+ 64 6e 61 6d 65 07 65 78 61 6d 70 6c 65 03 6f 72
+ 67 00 c0 69 00 05 00 01 00 00 54 60 00 02 c0 69
diff --git a/src/lib/cache/tests/testdata/message_fromWire8 b/src/lib/cache/tests/testdata/message_fromWire8
index 4a0a9c3..bc9e144 100644
--- a/src/lib/cache/tests/testdata/message_fromWire8
+++ b/src/lib/cache/tests/testdata/message_fromWire8
@@ -1,24 +1,23 @@
-#
-# ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1392
-# ;; flags: qr aa rd; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL:
+# A response includes multiple DNAME and synchronized CNAME records
+# ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 900
+# ;; flags: qr aa rd; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0
# ;; WARNING: recursion requested but not available
-
+#
# ;; QUESTION SECTION:
-# ;a.dname.zlk.cn. IN NS
+# ;a.dname.example.com. IN NS
#
# ;; ANSWER SECTION:
-# dname.zlk.cn. 21600 IN DNAME dname.zlk.org.
-# a.dname.zlk.cn. 21600 IN CNAME a.dname.zlk.org.
-# dname.zlk.org. 21600 IN DNAME dname.zlk.com.
-# a.dname.zlk.org. 21600 IN CNAME a.dname.zlk.com.
-
-0570 8500
-00 01 00 04 00 00 00 00 01 61 05 64
- 6e 61 6d 65 03 7a 6c 6b 02 63 6e 00 00 02 00 01
- c0 0e 00 27 00 01 00 00 54 60 00 0f 05 64 6e 61
- 6d 65 03 7a 6c 6b 03 6f 72 67 00 c0 0c 00 05 00
- 01 00 00 54 60 00 04 01 61 c0 2c c0 2c 00 27 00
- 01 00 00 54 60 00 0f 05 64 6e 61 6d 65 03 7a 6c
- 6b 03 63 6f 6d 00 c0 47 00 05 00 01 00 00 54 60
- 00 04 01 61 c0 57
-
+# dname.example.com. 21600 IN DNAME dname.example.org.
+# a.dname.example.com. 21600 IN CNAME a.dname.example.org.
+# dname.example.org. 21600 IN DNAME dname.example.org.
+# a.dname.example.org. 21600 IN CNAME a.dname.example.org.
+0384 8500
+ 00 01 00 04 00 00 00 00 01 61 05 64
+ 6e 61 6d 65 07 65 78 61 6d 70 6c 65 03 63 6f 6d
+ 00 00 02 00 01 c0 0e 00 27 00 01 00 00 54 60 00
+ 13 05 64 6e 61 6d 65 07 65 78 61 6d 70 6c 65 03
+ 6f 72 67 00 c0 0c 00 05 00 01 00 00 54 60 00 04
+ 01 61 c0 31 c0 31 00 27 00 01 00 00 54 60 00 13
+ 05 64 6e 61 6d 65 07 65 78 61 6d 70 6c 65 03 6f
+ 72 67 00 c0 50 00 05 00 01 00 00 54 60 00 02 c0
+ 50
More information about the bind10-changes
mailing list