]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5288] Minor changes after review
authorTomek Mrugalski <tomasz@isc.org>
Tue, 4 Jul 2017 15:10:47 +0000 (17:10 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Tue, 4 Jul 2017 15:10:47 +0000 (17:10 +0200)
doc/examples/kea4/multiple-options.json
src/bin/dhcp4/tests/config_parser_unittest.cc
src/lib/dhcpsrv/tests/pool_unittest.cc

index c417365b69dfb4ff0a3aab0cedf6c66002d2fb93..b287b62f276f9ede402fd4932c72518db4518bb1 100644 (file)
             "data": "0xf0"
          }
        ],
-       "pools": [ {
-         "pool":  "192.0.2.10 - 192.0.2.200",
-         "option-data": [
-            {
-                "name": "domain-name-servers",
-                "data": "192.0.2.3, 192.0.2.4"
-            }
-         ]
-       } ]
+
+        // Now we define pools. There are two pools here.
+        "pools": [ {
+            // This is the first pool. Nothing spectacular here, just a range
+            // of addresses.
+           "pool": "192.0.2.10 - 192.0.2.100"
+
+        }, {
+            // This second pool is more interesting. Anyone who gets an
+            // address from this pool will also get this specific option
+            // value if asks for DNS servers configuration. This value,
+            // being more specific, overrides any values that were specified
+            // on either global or subnet scope.
+            "pool":  "192.0.2.101 - 192.0.2.200",
+            "option-data": [
+                {
+                    "name": "domain-name-servers",
+                    "data": "192.0.2.3, 192.0.2.4"
+                }
+            ]
+        } ]
     } ]
 },
 
index 3dc3bc8e1b5d85be9e3376f4b23dd1f7a70924b3..71c51017e5acd201cff8e07a1c1723c878e17ee3 100644 (file)
@@ -2809,6 +2809,8 @@ TEST_F(Dhcp4ParserTest, optionDataSinglePool) {
     testOption(*range.first, 23, foo2_expected, sizeof(foo2_expected));
 }
 
+// This test verifies that it's possible to define different options in
+// different pools and those options are not confused.
 TEST_F(Dhcp4ParserTest, optionDataMultiplePools) {
     ConstElementPtr x;
     string config = "{ " + genIfaceConfig() + ","
index 8da257fe592631c6dfde2e4d9852b22612879e86..5447e991563cf8e1044353f58a447f05f30996ea 100644 (file)
@@ -135,7 +135,7 @@ TEST(Pool4Test, addOptions) {
     // Add 7 options to another option space. The option codes partially overlap
     // with option codes that we have added to dhcp4 option space.
     for (uint16_t code = 105; code < 112; ++code) {
-        OptionPtr option(new Option(Option::V6, code, OptionBuffer(10, 0xFF)));
+        OptionPtr option(new Option(Option::V4, code, OptionBuffer(10, 0xFF)));
         ASSERT_NO_THROW(pool->getCfgOption()->add(option, false, "isc"));
     }