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
Sebastian Schrader
Kea
Commits
7137b4a4
Commit
7137b4a4
authored
Apr 24, 2014
by
Marcin Siodelski
Browse files
[3409] The DHCPv4 config parser logs positions of the elements in config.
parent
71ceaa01
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp4/config_parser.cc
View file @
7137b4a4
...
...
@@ -218,8 +218,7 @@ protected:
global_context_
,
Dhcp4OptionDataParser
::
factory
);
}
else
{
isc_throw
(
NotImplemented
,
"parser error: Subnet4 parameter not supported: "
<<
config_id
);
isc_throw
(
NotImplemented
,
"unsupported parameter: "
<<
config_id
);
}
return
(
parser
);
...
...
src/lib/dhcpsrv/dhcp_parsers.cc
View file @
7137b4a4
...
...
@@ -455,15 +455,25 @@ OptionDataParser::createOption() {
isc_throw
(
DhcpConfigError
,
"invalid option space name '"
<<
option_space
<<
"' specified for option '"
<<
option_name
<<
"', code '"
<<
option_code
<<
"' ("
<<
string_values_
->
getPosition
(
"
nam
e"
)
<<
")"
);
<<
"' ("
<<
string_values_
->
getPosition
(
"
spac
e"
)
<<
")"
);
}
const
bool
csv_format
=
boolean_values_
->
getParam
(
"csv-format"
);
// Find the Option Definition for the option by its option code.
// findOptionDefinition will throw if not found, no need to test.
// Find the definition for the option by its code. This function
// may throw so we catch exceptions to log the culprit line of the
// configuration.
OptionDefinitionPtr
def
;
if
(
!
(
def
=
findServerSpaceOptionDefinition
(
option_space
,
option_code
)))
{
try
{
def
=
findServerSpaceOptionDefinition
(
option_space
,
option_code
);
}
catch
(
const
std
::
exception
&
ex
)
{
isc_throw
(
DhcpConfigError
,
ex
.
what
()
<<
" ("
<<
string_values_
->
getPosition
(
"space"
)
<<
")"
);
}
if
(
!
def
)
{
// If we are not dealing with a standard option then we
// need to search for its definition among user-configured
// options. They are expected to be in the global storage
...
...
@@ -1011,7 +1021,16 @@ SubnetConfigParser::SubnetConfigParser(const std::string&,
void
SubnetConfigParser
::
build
(
ConstElementPtr
subnet
)
{
BOOST_FOREACH
(
ConfigPair
param
,
subnet
->
mapValue
())
{
ParserPtr
parser
(
createSubnetConfigParser
(
param
.
first
));
ParserPtr
parser
;
// When unsupported parameter is specified, the function called
// below will thrown an exception. We have to catch this exception
// to append the line number where the parameter is.
try
{
parser
=
(
createSubnetConfigParser
(
param
.
first
));
}
catch
(
const
std
::
exception
&
ex
)
{
isc_throw
(
DhcpConfigError
,
ex
.
what
()
<<
" ("
<<
param
.
second
->
getPosition
()
<<
")"
);
}
parser
->
build
(
param
.
second
);
parsers_
.
push_back
(
parser
);
}
...
...
@@ -1029,7 +1048,13 @@ SubnetConfigParser::build(ConstElementPtr subnet) {
}
// Create a subnet.
createSubnet
();
try
{
createSubnet
();
}
catch
(
const
std
::
exception
&
ex
)
{
isc_throw
(
DhcpConfigError
,
"subnet configuration failed ("
<<
subnet
->
getPosition
()
<<
"): "
<<
ex
.
what
());
}
}
void
...
...
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