Commit ea3d6bca authored by Thomas Markwalder's avatar Thomas Markwalder Committed by Tomek Mrugalski
Browse files

[5680] kea-dhcp4/6 now parse hostname-char-set and hostname-char-replacment params

Added to parsing and parsing unit tests.
Servers do not yet utilize the values.

Modified:

src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_parser.yy

src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp4/tests/fqdn_unittest.cc
src/bin/dhcp4/tests/get_config_unittest.

src/bin/dhcp6/dhcp6_lexer.ll
src/bin/dhcp6/dhcp6_parser.yy

src/bin/dhcp6/tests/config_parser_unittest.cc
src/bin/dhcp6/tests/fqdn_unittest.cc
src/bin/dhcp6/tests/get_config_unittest.
parent 54bb07ee
This diff is collapsed.
// Generated 201804111443
// A Bison parser, made by GNU Bison 3.0.4.
// Locations for Bison parsers in C++
......
// Generated 201804111443
// A Bison parser, made by GNU Bison 3.0.4.
// Positions for Bison parsers in C++
......
// Generated 201804111443
// A Bison parser, made by GNU Bison 3.0.4.
// Stack handling for Bison parsers in C++
......
This diff is collapsed.
......@@ -1323,6 +1323,24 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"hostname-char-set\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::DHCP_DDNS:
return isc::dhcp::Dhcp4Parser::make_HOSTNAME_CHAR_SET(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("hostname-char-set", driver.loc_);
}
}
\"hostname-char-replacement\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::DHCP_DDNS:
return isc::dhcp::Dhcp4Parser::make_HOSTNAME_CHAR_REPLACEMENT(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("hostname-char-replacement", driver.loc_);
}
}
(?i:\"UDP\") {
/* dhcp-ddns value keywords are case insensitive */
if (driver.ctx_ == isc::dhcp::Parser4Context::NCR_PROTOCOL) {
......
This diff is collapsed.
This diff is collapsed.
......@@ -186,6 +186,8 @@ using namespace std;
NEVER "never"
ALWAYS "always"
WHEN_NOT_PRESENT "when-not-present"
HOSTNAME_CHAR_SET "hostname-char-set"
HOSTNAME_CHAR_REPLACEMENT "hostname-char-replacement"
LOGGING "Logging"
LOGGERS "loggers"
......@@ -1825,6 +1827,8 @@ dhcp_ddns_param: enable_updates
| override_client_update
| replace_client_name
| generated_prefix
| hostname_char_set
| hostname_char_replacement
| user_context
| comment
| unknown_map_entry
......@@ -1943,6 +1947,23 @@ generated_prefix: GENERATED_PREFIX {
ctx.leave();
};
hostname_char_set: HOSTNAME_CHAR_SET {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr s(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("hostname-char-set", s);
ctx.leave();
};
hostname_char_replacement: HOSTNAME_CHAR_REPLACEMENT {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr s(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("hostname-char-replacement", s);
ctx.leave();
};
// JSON entries for Dhcp4 and DhcpDdns
dhcp6_json_object: DHCP6 {
......
......@@ -4021,7 +4021,9 @@ TEST_F(Dhcp4ParserTest, d2ClientConfig) {
" \"override-client-update\" : true, "
" \"replace-client-name\" : \"when-present\", "
" \"generated-prefix\" : \"test.prefix\", "
" \"qualifying-suffix\" : \"test.suffix.\" },"
" \"qualifying-suffix\" : \"test.suffix.\", "
" \"hostname-char-set\" : \"[^A-Za-z0-9_-]\", "
" \"hostname-char-replacement\" : \"x\" }, "
"\"valid-lifetime\": 4000 }";
// Convert the JSON string to configuration elements.
......
......@@ -243,7 +243,7 @@ public:
((mask & REPLACE_CLIENT_NAME) ?
D2ClientConfig::RCM_WHEN_PRESENT
: D2ClientConfig::RCM_NEVER),
"myhost", "example.com")));
"myhost", "example.com", "", "")));
ASSERT_NO_THROW(CfgMgr::instance().setD2ClientConfig(cfg));
ASSERT_NO_THROW(srv_->startD2());
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment