Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
3f530012
Commit
3f530012
authored
Nov 25, 2015
by
Marcin Siodelski
Browse files
[4204] Remove runtime option defs if "option-def" is not in config.
parent
e9bcac1d
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp4/json_config_parser.cc
View file @
3f530012
...
...
@@ -515,6 +515,9 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
// Revert any runtime option definitions configured so far and not committed.
LibDHCP
::
revertRuntimeOptionDefs
();
// Let's set empty container in case a user hasn't specified any configuration
// for option definitions. This is equivalent to commiting empty container.
LibDHCP
::
setRuntimeOptionDefs
(
OptionDefSpaceContainer
());
// Some of the values specified in the configuration depend on
// other values. Typically, the values in the subnet4 structure
...
...
src/bin/dhcp4/tests/config_parser_unittest.cc
View file @
3f530012
...
...
@@ -1346,6 +1346,11 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) {
ASSERT_TRUE
(
status
);
checkResult
(
status
,
0
);
// We need to commit option definitions because later in this test we
// will be checking if they get removed when "option-def" parameter
// is removed from a configuration.
LibDHCP
::
commitRuntimeOptionDefs
();
// The option definition should now be available in the CfgMgr.
def
=
CfgMgr
::
instance
().
getStagingCfg
()
->
getCfgOptionDef
()
->
get
(
"isc"
,
100
);
ASSERT_TRUE
(
def
);
...
...
@@ -1365,6 +1370,16 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) {
// be equal.
EXPECT_TRUE
(
def_libdhcp
!=
def
);
EXPECT_TRUE
(
*
def_libdhcp
==
*
def
);
// Let's apply empty configuration. This removes the option definitions
// configuration and should result in removal of the option 100 from the
// libdhcp++.
config
=
"{ }"
;
json
=
Element
::
fromJSON
(
config
);
ASSERT_NO_THROW
(
status
=
configureDhcp4Server
(
*
srv_
,
json
));
checkResult
(
status
,
0
);
EXPECT_FALSE
(
LibDHCP
::
getRuntimeOptionDef
(
"isc"
,
100
));
}
// The goal of this test is to check whether an option definition
...
...
src/bin/dhcp6/json_config_parser.cc
View file @
3f530012
...
...
@@ -754,6 +754,9 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
// Revert any runtime option definitions configured so far and not committed.
LibDHCP
::
revertRuntimeOptionDefs
();
// Let's set empty container in case a user hasn't specified any configuration
// for option definitions. This is equivalent to commiting empty container.
LibDHCP
::
setRuntimeOptionDefs
(
OptionDefSpaceContainer
());
// Some of the values specified in the configuration depend on
// other values. Typically, the values in the subnet6 structure
...
...
src/bin/dhcp6/tests/config_parser_unittest.cc
View file @
3f530012
...
...
@@ -1583,6 +1583,12 @@ TEST_F(Dhcp6ParserTest, optionDefIpv6Address) {
ConstElementPtr
status
;
EXPECT_NO_THROW
(
status
=
configureDhcp6Server
(
srv_
,
json
));
ASSERT_TRUE
(
status
);
checkResult
(
status
,
0
);
// We need to commit option definitions because later in this test we
// will be checking if they get removed when "option-def" parameter
// is removed from a configuration.
LibDHCP
::
commitRuntimeOptionDefs
();
// The option definition should now be available in the CfgMgr.
def
=
CfgMgr
::
instance
().
getStagingCfg
()
->
getCfgOptionDef
()
->
get
(
"isc"
,
100
);
...
...
@@ -1602,6 +1608,16 @@ TEST_F(Dhcp6ParserTest, optionDefIpv6Address) {
// be equal.
EXPECT_TRUE
(
def_libdhcp
!=
def
);
EXPECT_TRUE
(
*
def_libdhcp
==
*
def
);
// Let's apply empty configuration. This removes the option definitions
// configuration and should result in removal of the option 100 from the
// libdhcp++.
config
=
"{ }"
;
json
=
Element
::
fromJSON
(
config
);
ASSERT_NO_THROW
(
status
=
configureDhcp6Server
(
srv_
,
json
));
checkResult
(
status
,
0
);
EXPECT_FALSE
(
LibDHCP
::
getRuntimeOptionDef
(
"isc"
,
100
));
}
// The goal of this test is to check whether an option definition
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment