]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5682] Added two missing log messages trac5682
authorTomek Mrugalski <tomasz@isc.org>
Mon, 30 Jul 2018 17:02:47 +0000 (19:02 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Mon, 30 Jul 2018 17:05:19 +0000 (19:05 +0200)
src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc
src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/sanity_checker.cc

index 1a09a5b2a13861c760fb47476f6861d6453479ad..c5f81a4796ee3d66e2113b20db790bbd4478bb5f 100644 (file)
@@ -3523,6 +3523,8 @@ TEST_F(LeaseCmdsTest, Lease6WipeNoLeasesAll) {
     testCommand(cmd, CONTROL_RESULT_EMPTY, exp_rsp);
 }
 
+// Checks that an attempt to update a lease (set incorrect subnet-id)
+// will fail.
 TEST_F(LeaseCmdsTest, brokenUpdate) {
 
     // Initialize lease manager (false = v4, false = don't add leases)
index 4b4661444b51957a9e81e71fc9fbaad26ee7df97..199381e6cc08f9737786857d183f3304f18d2b62 100644 (file)
@@ -431,10 +431,23 @@ should be of the form 'keyword=value keyword=value...' is included in
 the message.
 
 % DHCPSRV_LEASE_SANITY_FAIL The lease %1 with subnet-id %2 failed subnet-id checks.
+This warning message is printed when the lease being loaded does not match the
+configuration. Due to lease-checks value, the lease will be loaded, but
+it will most likely be unused by Kea, as there is no subnet that matches
+the IP address associated with the lease.
 
-% DHCPSRV_LEASE_SANITY_FIXED The lease %1 with subnet-id %2 failed subnet-id checks, but was correced to subnet-id %3.
+% DHCPSRV_LEASE_SANITY_FIXED The lease %1 with subnet-id %2 failed subnet-id checks, but was corrected to subnet-id %3.
+This informational message is printed when a lease was loaded, but had
+incorrect subnet-id value. The lease-checks parameter was set to a value
+that told Kea to try to correct the problem. There is a matching subnet,
+so Kea updated subnet-id and loaded the lease successfully.
 
 % DHCPSRV_LEASE_SANITY_FAIL_DISCARD The lease %1 with subnet-id %2 failed subnet-id checks and was dropped.
+This warning message is printed when a lease was loaded, but Kea was told
+(by setting lease-checks parameter) to discard leases with inconsistent
+data. The lease was discarded, because either there is no subnet configured
+with matching subnet-id or the address of the lease does not belong to the
+subnet.
 
 % DHCPSRV_MEMFILE_ADD_ADDR4 adding IPv4 lease with address %1
 A debug message issued when the server is about to add an IPv4 lease
index 478acbf6acf604b4b06e96213bad7aaaaefab67a..1de927c875f8b3e59dfe6325aae93d6d8dd5e9d7 100644 (file)
@@ -78,9 +78,11 @@ void SanityChecker::checkLeaseInternal(LeasePtrType& lease, const CfgConsistency
                 LOG_INFO(dhcpsrv_logger, DHCPSRV_LEASE_SANITY_FIXED)
                     .arg(lease->addr_.toText()).arg(lease->subnet_id_).arg(id);
                 lease->subnet_id_ = id;
+            } else {
+                // If not, return the lease as is.
+                LOG_WARN(dhcpsrv_logger, DHCPSRV_LEASE_SANITY_FAIL)
+                    .arg(lease->addr_.toText()).arg(lease->subnet_id_);
             }
-
-            // If not, return the lease as is.
         }
         break;
 
@@ -89,12 +91,14 @@ void SanityChecker::checkLeaseInternal(LeasePtrType& lease, const CfgConsistency
 
             // If there is a better subnet, use it.
             if (id != 0) {
-                LOG_INFO(dhcpsrv_logger, DHCPSRV_LEASE_SANITY_FAIL_DISCARD)
-                    .arg(lease->addr_.toText()).arg(lease->subnet_id_);
+                LOG_INFO(dhcpsrv_logger, DHCPSRV_LEASE_SANITY_FIXED)
+                    .arg(lease->addr_.toText()).arg(lease->subnet_id_).arg(id);
                 lease->subnet_id_ = id;
                 break;
             } else {
                 // If not, delete the lease.
+                LOG_INFO(dhcpsrv_logger, DHCPSRV_LEASE_SANITY_FAIL_DISCARD)
+                    .arg(lease->addr_.toText()).arg(lease->subnet_id_);
                 lease.reset();
             }