From 11408b4728390af435957b52e709200612000288 Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Mon, 23 Oct 2017 21:49:34 +0200 Subject: [PATCH] [5341] Default lfc-interval is now set to 3600. --- doc/guide/dhcp4-srv.xml | 4 ++-- doc/guide/dhcp6-srv.xml | 4 ++-- src/bin/keactrl/kea-dhcp4.conf.pre | 3 ++- src/bin/keactrl/kea-dhcp6.conf.pre | 3 ++- src/lib/dhcpsrv/memfile_lease_mgr.cc | 4 ++-- src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc | 6 +++++- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/doc/guide/dhcp4-srv.xml b/doc/guide/dhcp4-srv.xml index 20e4c60024..73040cd179 100644 --- a/doc/guide/dhcp4-srv.xml +++ b/doc/guide/dhcp4-srv.xml @@ -352,8 +352,8 @@ be followed by a comma and another object definition. removes redundant (historical) information from the lease file and effectively reduces the lease file size. The cleanup process is described in more detailed fashion further in this section. The default value of the - lfc-interval is 0, which disables - the LFC. + lfc-interval is 3600. A value of 0 + disables the LFC. diff --git a/doc/guide/dhcp6-srv.xml b/doc/guide/dhcp6-srv.xml index 66da042a07..d63654dc1b 100644 --- a/doc/guide/dhcp6-srv.xml +++ b/doc/guide/dhcp6-srv.xml @@ -347,8 +347,8 @@ be followed by a comma and another object definition. removes redundant (historical) information from the lease file and effectively reduces the lease file size. The cleanup process is described in more detailed fashion further in this section. The default value of the - lfc-interval is 0, which disables - the LFC. + lfc-interval is 3600. A value of 0 + disables the LFC. diff --git a/src/bin/keactrl/kea-dhcp4.conf.pre b/src/bin/keactrl/kea-dhcp4.conf.pre index 191c37d669..d75a6e294a 100644 --- a/src/bin/keactrl/kea-dhcp4.conf.pre +++ b/src/bin/keactrl/kea-dhcp4.conf.pre @@ -61,7 +61,8 @@ "lease-database": { // Memfile is the simplest and easiest backend to use. It's a in-memory // C++ database that stores its state in CSV file. - "type": "memfile" + "type": "memfile", + "lfc-interval": 3600 }, // Kea allows storing host reservations in a database. If your network is diff --git a/src/bin/keactrl/kea-dhcp6.conf.pre b/src/bin/keactrl/kea-dhcp6.conf.pre index 3648bda68f..3b978e8e2d 100644 --- a/src/bin/keactrl/kea-dhcp6.conf.pre +++ b/src/bin/keactrl/kea-dhcp6.conf.pre @@ -53,7 +53,8 @@ // There are dedicated examples for each backend. See Section 8.2.2 "Lease // Storage" for details. "lease-database": { - "type": "memfile" + "type": "memfile", + "lfc-interval": 3600 }, // Kea allows storing host reservations in a database. If your network is diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index 1834365968..cb58084c54 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -1219,11 +1219,11 @@ Memfile_LeaseMgr::lfcCallback() { void Memfile_LeaseMgr::lfcSetup(bool conversion_needed) { - std::string lfc_interval_str = "0"; + std::string lfc_interval_str = "3600"; try { lfc_interval_str = conn_.getParameter("lfc-interval"); } catch (const std::exception&) { - // Ignore and default to 0. + // Ignore and default to 3600. } uint32_t lfc_interval = 0; diff --git a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc index 8471ff7ed8..b4eafa44b0 100644 --- a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc @@ -188,7 +188,8 @@ public: std::ostringstream s; s << "type=memfile " << (u == V4 ? "universe=4 " : "universe=6 ") << "name=" - << getLeaseFilePath(u == V4 ? "leasefile4_0.csv" : "leasefile6_0.csv"); + << getLeaseFilePath(u == V4 ? "leasefile4_0.csv" : "leasefile6_0.csv") + << " lfc-interval=0"; return (s.str()); } @@ -426,6 +427,7 @@ TEST_F(MemfileLeaseMgrTest, persistLeases) { DatabaseConnection::ParameterMap pmap; pmap["universe"] = "4"; + pmap["lfc-interval"] = "0"; // Specify the names of the lease files. Leases will be written. pmap["name"] = getLeaseFilePath("leasefile4_1.csv"); boost::scoped_ptr lease_mgr(new Memfile_LeaseMgr(pmap)); @@ -1633,6 +1635,7 @@ TEST_F(MemfileLeaseMgrTest, lease4ContainerIndexUpdate) { pmap["universe"] = "4"; pmap["name"] = leasefile; pmap["persist"] = "true"; + pmap["lfc-interval"] = "0"; srand(seed); @@ -1772,6 +1775,7 @@ TEST_F(MemfileLeaseMgrTest, lease6ContainerIndexUpdate) { pmap["universe"] = "6"; pmap["name"] = leasefile; pmap["persist"] = "true"; + pmap["lfc-interval"] = "0"; srand(seed); -- 2.47.2