]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3747] Renamed ignore-client-id to record-client-id and reversed values.
authorMarcin Siodelski <marcin@isc.org>
Tue, 12 May 2015 12:22:25 +0000 (14:22 +0200)
committerMarcin Siodelski <marcin@isc.org>
Tue, 12 May 2015 13:13:46 +0000 (15:13 +0200)
src/bin/dhcp4/dhcp4.spec
src/bin/dhcp4/json_config_parser.cc
src/bin/dhcp4/tests/config_parser_unittest.cc
src/lib/dhcpsrv/subnet.cc
src/lib/dhcpsrv/subnet.h
src/lib/dhcpsrv/tests/subnet_unittest.cc

index 5014d5b015181a071a757d0a1c7c6f70a5f8d65a..6dd86dcf1293a9e03ba26f9a8c5437bd6d55f5a6 100644 (file)
         "item_default": true
       },
 
-      { "item_name": "ignore-client-id",
+      { "item_name": "record-client-id",
         "item_type": "boolean",
         "item_optional": true,
-        "item_default": false
+        "item_default": true
       },
 
       { "item_name": "option-def",
                   "item_default": "0.0.0.0"
                 },
 
-                { "item_name": "ignore-client-id",
+                { "item_name": "record-client-id",
                   "item_type": "boolean",
                   "item_optional": true,
-                  "item_default": false
+                  "item_default": true
                 },
 
                 { "item_name": "pool",
index ce6fbfc8db56c86baafc9b63ff43b200549350c8..c52489112fa79db78dadae2ad0626dbf1ca04d20 100644 (file)
@@ -194,7 +194,7 @@ protected:
             parser = new RelayInfoParser(config_id, relay_info_, Option::V4);
         } else if (config_id.compare("option-data") == 0) {
             parser = new OptionDataListParser(config_id, options_, AF_INET);
-        } else if (config_id.compare("ignore-client-id") == 0) {
+        } else if (config_id.compare("record-client-id") == 0) {
             parser = new BooleanParser(config_id, boolean_values_);
         } else {
             isc_throw(NotImplemented, "unsupported parameter: " << config_id);
@@ -252,26 +252,26 @@ protected:
         Subnet4Ptr subnet4(new Subnet4(addr, len, t1, t2, valid, subnet_id));
         subnet_ = subnet4;
 
-        // ignore-client-id
-        isc::util::OptionalValue<bool> ignore_client_id;
+        // record-client-id
+        isc::util::OptionalValue<bool> record_client_id;
         try {
-            ignore_client_id = boolean_values_->getParam("ignore-client-id");
+            record_client_id = boolean_values_->getParam("record-client-id");
 
         } catch (...) {
             // Ignore because this parameter is optional and it may be specified
             // in the global scope.
         }
 
-        // If the ignore-client-id wasn't specified as a subnet specific parameter
+        // If the record-client-id wasn't specified as a subnet specific parameter
         // check if there is global value specified.
-        if (!ignore_client_id.isSpecified()) {
+        if (!record_client_id.isSpecified()) {
             // If not specified, use false.
-            ignore_client_id.specify(globalContext()->boolean_values_->
-                                     getOptionalParam("ignore-client-id", false));
+            record_client_id.specify(globalContext()->boolean_values_->
+                                     getOptionalParam("record-client-id", true));
         }
 
-        // Set the ignore-client-id value for the subnet.
-        subnet4->setIgnoreClientId(ignore_client_id.get());
+        // Set the record-client-id value for the subnet.
+        subnet4->setRecordClientId(record_client_id.get());
 
         // next-server
         try {
@@ -397,7 +397,7 @@ namespace dhcp {
         parser = new BooleanParser(config_id, globalContext()->boolean_values_);
     } else if (config_id.compare("dhcp-ddns") == 0) {
         parser = new D2ClientConfigParser(config_id);
-    } else if (config_id.compare("ignore-client-id") == 0) {
+    } else if (config_id.compare("record-client-id") == 0) {
         parser = new BooleanParser(config_id, globalContext()->boolean_values_);
     } else {
         isc_throw(DhcpConfigError,
index 84a96d809b31b911e81cff97e1b70506aee1182f..96dd7346d3bb54c518e0f0ea05b84a3781c75790 100644 (file)
@@ -1102,9 +1102,9 @@ TEST_F(Dhcp4ParserTest, echoClientId) {
     CfgMgr::instance().echoClientId(true);
 }
 
-// This test checks that the global ignore-client-id parameter is optional
+// This test checks that the global record-client-id parameter is optional
 // and that values under the subnet are used.
-TEST_F(Dhcp4ParserTest, ignoreClientIdNoGlobal) {
+TEST_F(Dhcp4ParserTest, recordClientIdNoGlobal) {
     ConstElementPtr status;
 
     std::string config = "{ " + genIfaceConfig() + "," +
@@ -1112,12 +1112,12 @@ TEST_F(Dhcp4ParserTest, ignoreClientIdNoGlobal) {
         "\"renew-timer\": 1000, "
         "\"subnet4\": [ "
         "{"
-        "    \"ignore-client-id\": true,"
+        "    \"record-client-id\": true,"
         "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
         "    \"subnet\": \"192.0.2.0/24\""
         "},"
         "{"
-        "    \"ignore-client-id\": false,"
+        "    \"record-client-id\": false,"
         "    \"pools\": [ { \"pool\": \"192.0.3.1 - 192.0.3.100\" } ],"
         "    \"subnet\": \"192.0.3.0/24\""
         "} ],"
@@ -1130,26 +1130,26 @@ TEST_F(Dhcp4ParserTest, ignoreClientIdNoGlobal) {
     CfgSubnets4Ptr cfg = CfgMgr::instance().getStagingCfg()->getCfgSubnets4();
     Subnet4Ptr subnet1 = cfg->selectSubnet(IOAddress("192.0.2.1"));
     ASSERT_TRUE(subnet1);
-    EXPECT_TRUE(subnet1->getIgnoreClientId());
+    EXPECT_TRUE(subnet1->getRecordClientId());
 
     Subnet4Ptr subnet2 = cfg->selectSubnet(IOAddress("192.0.3.1"));
     ASSERT_TRUE(subnet2);
-    EXPECT_FALSE(subnet2->getIgnoreClientId());
+    EXPECT_FALSE(subnet2->getRecordClientId());
 }
 
-// This test checks that the global ignore-client-id parameter is used
+// This test checks that the global record-client-id parameter is used
 // when there is no such parameter under subnet and that the parameter
 // specified for a subnet overrides the global setting.
-TEST_F(Dhcp4ParserTest, ignoreClientIdGlobal) {
+TEST_F(Dhcp4ParserTest, recordClientIdGlobal) {
     ConstElementPtr status;
 
     std::string config = "{ " + genIfaceConfig() + "," +
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
-        "\"ignore-client-id\": true,"
+        "\"record-client-id\": true,"
         "\"subnet4\": [ "
         "{"
-        "    \"ignore-client-id\": false,"
+        "    \"record-client-id\": false,"
         "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
         "    \"subnet\": \"192.0.2.0/24\""
         "},"
@@ -1166,11 +1166,11 @@ TEST_F(Dhcp4ParserTest, ignoreClientIdGlobal) {
     CfgSubnets4Ptr cfg = CfgMgr::instance().getStagingCfg()->getCfgSubnets4();
     Subnet4Ptr subnet1 = cfg->selectSubnet(IOAddress("192.0.2.1"));
     ASSERT_TRUE(subnet1);
-    EXPECT_FALSE(subnet1->getIgnoreClientId());
+    EXPECT_FALSE(subnet1->getRecordClientId());
 
     Subnet4Ptr subnet2 = cfg->selectSubnet(IOAddress("192.0.3.1"));
     ASSERT_TRUE(subnet2);
-    EXPECT_TRUE(subnet2->getIgnoreClientId());
+    EXPECT_TRUE(subnet2->getRecordClientId());
 }
 
 // This test checks if it is possible to override global values
index f92d8ea9218ef72e64ac7b37598613af4336082e..aeff33831b0ed2680b6dacad51e60d3721724cf5 100644 (file)
@@ -180,7 +180,7 @@ Subnet4::Subnet4(const isc::asiolink::IOAddress& prefix, uint8_t length,
                  const Triplet<uint32_t>& valid_lifetime,
                  const SubnetID id)
     : Subnet(prefix, length, t1, t2, valid_lifetime, RelayInfo(IOAddress("0.0.0.0")), id),
-      siaddr_(IOAddress("0.0.0.0")), ignore_client_id_(false) {
+      siaddr_(IOAddress("0.0.0.0")), record_client_id_(true) {
     if (!prefix.isV4()) {
         isc_throw(BadValue, "Non IPv4 prefix " << prefix.toText()
                   << " specified in subnet4");
index 87dedd6fd322d62b87a526352affd088f1ad53c3..14723ba063c5b26f858e8d36ee1c000077114aeb 100644 (file)
@@ -543,20 +543,20 @@ public:
     isc::asiolink::IOAddress getSiaddr() const;
 
     /// @brief Sets the flag indicating if the client identifier should be
-    /// ignored in the client's message.
+    /// recorded in the lease database.
     ///
     /// @param ignore If this value is true, the client identifiers are ignored
     /// in the messages from the clients for this subnet.
-    void setIgnoreClientId(const bool ignore) {
-        ignore_client_id_ = ignore;
+    void setRecordClientId(const bool record) {
+        record_client_id_ = record;
     }
 
     /// @brief Returns the flag indicating if the client identifiers should
-    /// be ignored for this subnet.
+    /// be recorded in the lease database.
     ///
-    /// @return true if client identifiers should be ignored, false otherwise.
-    bool getIgnoreClientId() const {
-        return (ignore_client_id_);
+    /// @return true if client identifiers should be recorded, false otherwise.
+    bool getRecordClientId() const {
+        return (record_client_id_);
     }
 
 private:
@@ -578,8 +578,8 @@ private:
     /// @brief siaddr value for this subnet
     isc::asiolink::IOAddress siaddr_;
 
-    /// @brief Should server ignore client identifiers.
-    bool ignore_client_id_;
+    /// @brief Should server record client identifiers.
+    bool record_client_id_;
 };
 
 /// @brief A pointer to a @c Subnet4 object
index 3f879daa2e9457a7d9d620b906494e0cb2d2663a..a153209c4a3c38f51df847b90e65d34c9cf1409c 100644 (file)
@@ -116,20 +116,20 @@ TEST(Subnet4Test, siaddr) {
         BadValue);
 }
 
-// Checks if the ignore-client-id flag can be set and retrieved.
-TEST(Subnet4Test, ignoreClientId) {
+// Checks if the record-client-id flag can be set and retrieved.
+TEST(Subnet4Test, recordClientId) {
     Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000);
 
-    // By default the flag should be set to false.
-    EXPECT_FALSE(subnet.getIgnoreClientId());
+    // By default the flag should be set to true.
+    EXPECT_TRUE(subnet.getRecordClientId());
 
     // Modify it and retrieve.
-    subnet.setIgnoreClientId(true);
-    EXPECT_TRUE(subnet.getIgnoreClientId());
+    subnet.setRecordClientId(false);
+    EXPECT_FALSE(subnet.getRecordClientId());
 
     // Modify again.
-    subnet.setIgnoreClientId(false);
-    EXPECT_FALSE(subnet.getIgnoreClientId());
+    subnet.setRecordClientId(true);
+    EXPECT_TRUE(subnet.getRecordClientId());
 }
 
 TEST(Subnet4Test, Pool4InSubnet4) {