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)
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
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;
// 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();
}