BIND 10 trac2317, updated. 5477d36770d789ce36b2a74acedf64cf63e79460 [2317] Check for duplicated option definitions.
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jan 9 18:45:26 UTC 2013
The branch, trac2317 has been updated
via 5477d36770d789ce36b2a74acedf64cf63e79460 (commit)
from 905a40f2a1c627edd9bbaf26166311ba7e623d0e (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 5477d36770d789ce36b2a74acedf64cf63e79460
Author: Marcin Siodelski <marcin at isc.org>
Date: Wed Jan 9 19:45:18 2013 +0100
[2317] Check for duplicated option definitions.
-----------------------------------------------------------------------
Summary of changes:
src/bin/dhcp4/tests/config_parser_unittest.cc | 37 +++++++++++++++++++++++++
1 file changed, 37 insertions(+)
-----------------------------------------------------------------------
diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc
index 5a3d078..7201ec3 100644
--- a/src/bin/dhcp4/tests/config_parser_unittest.cc
+++ b/src/bin/dhcp4/tests/config_parser_unittest.cc
@@ -578,6 +578,43 @@ TEST_F(Dhcp4ParserTest, optionDefMultiple) {
EXPECT_FALSE(def2->getArrayType());
}
+// The goal of this test is to verify that the duplicated option
+// definition is not accepted.
+TEST_F(Dhcp4ParserTest, optionDefDuplicate) {
+
+ // Configuration string. Both option definitions have
+ // the same code and belong to the same option space.
+ // This configuration should not be accepted.
+ std::string config =
+ "{ \"option-def\": [ {"
+ " \"name\": \"foo\","
+ " \"code\": 100,"
+ " \"type\": \"uint32\","
+ " \"array\": False,"
+ " \"record-types\": \"\","
+ " \"space\": \"isc\""
+ " },"
+ " {"
+ " \"name\": \"foo-2\","
+ " \"code\": 100,"
+ " \"type\": \"ipv4-address\","
+ " \"array\": False,"
+ " \"record-types\": \"\","
+ " \"space\": \"isc\""
+ " } ]"
+ "}";
+ ElementPtr json = Element::fromJSON(config);
+
+ // Make sure that the option definition does not exist yet.
+ ASSERT_FALSE(CfgMgr::instance().getOptionDef("isc", 100));
+
+ // Use the configuration string to create new option definitions.
+ ConstElementPtr status;
+ EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
+ ASSERT_TRUE(status);
+ checkResult(status, 1);
+}
+
// The goal of this test is to verify that the option definition
// comprising an array of uint32 values can be created.
TEST_F(Dhcp4ParserTest, optionDefArray) {
More information about the bind10-changes
mailing list