Commit 939e65e3 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[5058] CSV lease file loading now emits error log for each invalid row

src/bin/lfc/tests/lfc_controller_unittests.cc
    Fixed test data

src/lib/dhcpsrv/dhcpsrv_messages.mes
    added new error log message DHCPSRV_MEMFILE_LEASE_LOAD_ROW_ERROR

src/lib/dhcpsrv/lease_file_loader.h
    LeaseFileLoader::load() - new emits a error log for each row that
    fails to load
parent 9b19d774
......@@ -407,8 +407,9 @@ TEST_F(LFCControllerTest, launch4) {
string b_3 = "192.0.3.15,dd:de:ba:0d:1b:2e:3e:4f,0a:00:01:04,"
"100,150,7,0,0,,1\n";
// This one should be invalid, no hardware address and state is not declined
string c_1 = "192.0.2.3,,a:11:01:04,"
"200,200,8,1,1,host.example.com,1\n";
"200,200,8,1,1,host.example.com,0\n";
string d_1 = "192.0.2.5,16:17:18:19:1a:bc,,"
"200,200,8,1,1,host.example.com,1\n";
......
......@@ -459,6 +459,12 @@ replaced by those read from the file.
% DHCPSRV_MEMFILE_LEASE_LOAD loading lease %1
A debug message issued when DHCP lease is being loaded from the file to memory.
% DHCPSRV_MEMFILE_LEASE_LOAD_ROW_ERROR discarding row %1, error: %2
An error message issued the the DHCP lease being loaded from the given row of
the lease file fails. The log message should contain the specific reason the
row was discarded. The server will continue loading the remaining data.
This may indicate a corrupt lease file.
% DHCPSRV_MEMFILE_LFC_EXECUTE executing Lease File Cleanup using: %1
An informational message issued when the Memfile lease database backend
starts a new process to perform Lease File Cleanup.
......
......@@ -91,6 +91,10 @@ public:
while (true) {
// Unable to parse the lease.
if (!lease_file.next(lease)) {
LOG_ERROR(dhcpsrv_logger, DHCPSRV_MEMFILE_LEASE_LOAD_ROW_ERROR)
.arg(lease_file.getReads())
.arg(lease_file.getReadMsg());
// A value of 0xFFFFFFFF indicates that we don't return
// until the whole file is parsed, even if errors occur.
// Otherwise, check if we have exceeded the maximum number
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment