diff --git a/src/lib/dhcpsrv/cfgmgr.cc b/src/lib/dhcpsrv/cfgmgr.cc index c457fb7bde..ef156dd22c 100644 --- a/src/lib/dhcpsrv/cfgmgr.cc +++ b/src/lib/dhcpsrv/cfgmgr.cc @@ -197,6 +197,7 @@ CfgMgr::mergeIntoCurrentCfg(const uint32_t seq) { // First we need to remove statistics. getCurrentCfg()->removeStatistics(); mergeIntoCfg(getCurrentCfg(), seq); + LibDHCP::setRuntimeOptionDefs(getCurrentCfg()->getCfgOptionDef()->getContainer()); } catch (...) { // Make sure the statistics is updated even if the merge failed. diff --git a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc index 1be8c68456..13ec6a1147 100644 --- a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -1054,6 +1055,13 @@ TEST_F(CfgMgrTest, mergeIntoCurrentCfg) { // Those must be two separate instances. ASSERT_FALSE(ext_cfg1 == ext_cfg2); + // Add an option definition. + ext_cfg1->getCfgOptionDef()->add(OptionDefinition::create("option-foo", + 1, + "isc", + OPT_EMPTY_TYPE, + "")); + // Add a subnet which will be merged from first configuration. Subnet4Ptr subnet1(new Subnet4(IOAddress("192.1.2.0"), 24, 1, 2, 3, 123)); ext_cfg1->getCfgSubnets4()->add(subnet1); @@ -1073,6 +1081,10 @@ TEST_F(CfgMgrTest, mergeIntoCurrentCfg) { ASSERT_TRUE(cfg_mgr.getCurrentCfg()->getCfgSubnets4()->getBySubnetId(123)); ASSERT_FALSE(cfg_mgr.getCurrentCfg()->getCfgSubnets4()->getBySubnetId(124)); + // Ensure that the runtime option definitions have been updated. + auto runtime_def = LibDHCP::getRuntimeOptionDef("isc", "option-foo"); + ASSERT_TRUE(runtime_def); + // Create another configuration instance to check what sequence it would // pick. It should pick the first available one. SrvConfigPtr ext_cfg3;