Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian Schrader
Kea
Commits
1c43f8dc
Commit
1c43f8dc
authored
Jan 03, 2017
by
Tomek Mrugalski
🛰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[5020] Changes after review.
parent
600236ee
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
11 deletions
+44
-11
src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_lexer.ll
+20
-0
src/bin/dhcp4/dhcp4_parser.yy
src/bin/dhcp4/dhcp4_parser.yy
+13
-5
src/bin/dhcp4/json_config_parser.cc
src/bin/dhcp4/json_config_parser.cc
+1
-1
src/bin/dhcp6/json_config_parser.cc
src/bin/dhcp6/json_config_parser.cc
+1
-1
src/lib/dhcpsrv/parsers/ifaces_config_parser.cc
src/lib/dhcpsrv/parsers/ifaces_config_parser.cc
+8
-3
src/lib/dhcpsrv/parsers/ifaces_config_parser.h
src/lib/dhcpsrv/parsers/ifaces_config_parser.h
+1
-1
No files found.
src/bin/dhcp4/dhcp4_lexer.ll
View file @
1c43f8dc
...
...
@@ -196,6 +196,26 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"
raw\
" {
std::cout << "
RAW
regexp
" << std::endl;
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::INTERFACES_CONFIG:
return isc::dhcp::Dhcp4Parser::make_DHCP_SOCKET_TYPE_RAW(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
raw
", driver.loc_);
}
}
\"
udp\
" {
std::cout << "
RAW
regexp
" << std::endl;
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::INTERFACES_CONFIG:
return isc::dhcp::Dhcp4Parser::make_DHCP_SOCKET_TYPE_UDP(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
udp
", driver.loc_);
}
}
\"
interfaces\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::INTERFACES_CONFIG:
...
...
src/bin/dhcp4/dhcp4_parser.yy
View file @
1c43f8dc
...
...
@@ -53,6 +53,8 @@ using namespace std;
INTERFACES_CONFIG "interfaces-config"
INTERFACES "interfaces"
DHCP_SOCKET_TYPE "dhcp-socket-type"
DHCP_SOCKET_TYPE_RAW "raw"
DHCP_SOCKET_TYPE_UDP "udp"
ECHO_CLIENT_ID "echo-client-id"
MATCH_CLIENT_ID "match-client-id"
...
...
@@ -443,12 +445,18 @@ interfaces_list: INTERFACES {
ctx.leave();
};
dhcp_socket_type: DHCP_SOCKET_TYPE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr type(new StringElement($4, ctx.loc2pos(@4)));
dhcp_socket_type: dhcp_socket_type_raw
| dhcp_socket_type_udp
;
dhcp_socket_type_raw: DHCP_SOCKET_TYPE COLON DHCP_SOCKET_TYPE_RAW {
ElementPtr type(new StringElement("raw", ctx.loc2pos(@3)));
ctx.stack_.back()->set("dhcp-socket-type", type);
};
dhcp_socket_type_udp: DHCP_SOCKET_TYPE COLON DHCP_SOCKET_TYPE_UDP {
ElementPtr type(new StringElement("udp", ctx.loc2pos(@3)));
ctx.stack_.back()->set("dhcp-socket-type", type);
ctx.leave();
};
lease_database: LEASE_DATABASE {
...
...
src/bin/dhcp4/json_config_parser.cc
View file @
1c43f8dc
...
...
@@ -585,7 +585,7 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
// In principle we could have the following code structured as a series
// of long if else if clauses. That would give a marginal performance
// boost, but would make the code less readable. We had serious issues
// with the parser code debug
g
ability, so I decided to keep it as a
// with the parser code debugability, so I decided to keep it as a
// series of independent ifs.
if
(
config_pair
.
first
==
"option-def"
)
{
...
...
src/bin/dhcp6/json_config_parser.cc
View file @
1c43f8dc
...
...
@@ -859,7 +859,7 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
// In principle we could have the following code structured as a series
// of long if else if clauses. That would give a marginal performance
// boost, but would make the code less readable. We had serious issues
// with the parser code debug
g
ability, so I decided to keep it as a
// with the parser code debugability, so I decided to keep it as a
// series of independent ifs.
if
(
config_pair
.
first
==
"option-def"
)
{
...
...
src/lib/dhcpsrv/parsers/ifaces_config_parser.cc
View file @
1c43f8dc
...
...
@@ -62,7 +62,11 @@ IfacesConfigParser::parse(const CfgIfacePtr& cfg,
}
}
isc_throw
(
DhcpConfigError
,
"usupported parameter '"
// This should never happen as the input produced by the parser
// see (src/bin/dhcpX/dhcpX_parser.yy) should not produce any
// other parameter, so this case is only to catch bugs in
// the parser.
isc_throw
(
DhcpConfigError
,
"unsupported parameter '"
<<
element
.
first
<<
"'"
);
}
catch
(
const
std
::
exception
&
ex
)
{
// Append line number where the error occurred.
...
...
@@ -72,8 +76,9 @@ IfacesConfigParser::parse(const CfgIfacePtr& cfg,
}
// User hasn't specified the socket type. Log that we are using
// the default type.
if
(
!
socket_type_specified
)
{
// the default type. Log it only if this is DHCPv4. (DHCPv6 does not use
// raw sockets).
if
(
!
socket_type_specified
&&
(
protocol_
==
AF_INET
)
)
{
LOG_INFO
(
dhcpsrv_logger
,
DHCPSRV_CFGMGR_SOCKET_TYPE_DEFAULT
)
.
arg
(
cfg
->
socketTypeToText
());
}
...
...
src/lib/dhcpsrv/parsers/ifaces_config_parser.h
View file @
1c43f8dc
...
...
@@ -19,7 +19,7 @@ namespace dhcp {
///
/// This parser parses the "interfaces-config" parameter which holds the
/// full configuration of the DHCP server with respect to the use of
/// interfaces, sockets and alike.
/// interfaces,
DHCP traffic
sockets and alike.
///
/// This parser is used in both DHCPv4 and DHCPv6. Derived parsers
/// are not needed.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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