mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-04 07:55:18 +00:00
[#2011] Checkpoint: added code and updated tests
This commit is contained in:
@@ -430,14 +430,6 @@ NameChangeTransaction::initServerSelection(const DdnsDomainPtr& domain) {
|
|||||||
"initServerSelection called with an empty domain");
|
"initServerSelection called with an empty domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the tsig_key to that of the DdnsDomain.
|
|
||||||
TSIGKeyInfoPtr tsig_key_info = domain->getTSIGKeyInfo();
|
|
||||||
if (tsig_key_info) {
|
|
||||||
tsig_key_ = tsig_key_info->getTSIGKey();
|
|
||||||
} else {
|
|
||||||
tsig_key_.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
current_server_list_ = domain->getServers();
|
current_server_list_ = domain->getServers();
|
||||||
next_server_pos_ = 0;
|
next_server_pos_ = 0;
|
||||||
current_server_.reset();
|
current_server_.reset();
|
||||||
@@ -451,6 +443,14 @@ NameChangeTransaction::selectNextServer() {
|
|||||||
// Toss out any previous response.
|
// Toss out any previous response.
|
||||||
dns_update_response_.reset();
|
dns_update_response_.reset();
|
||||||
|
|
||||||
|
// Set the tsig_key to that of the current server..
|
||||||
|
TSIGKeyInfoPtr tsig_key_info = current_server_->getTSIGKeyInfo();
|
||||||
|
if (tsig_key_info) {
|
||||||
|
tsig_key_ = tsig_key_info->getTSIGKey();
|
||||||
|
} else {
|
||||||
|
tsig_key_.reset();
|
||||||
|
}
|
||||||
|
|
||||||
// @todo Protocol is set on DNSClient constructor. We need
|
// @todo Protocol is set on DNSClient constructor. We need
|
||||||
// to propagate a configuration value downward, probably starting
|
// to propagate a configuration value downward, probably starting
|
||||||
// at global, then domain, then server
|
// at global, then domain, then server
|
||||||
|
@@ -425,7 +425,8 @@ public:
|
|||||||
/// @param config element to parse
|
/// @param config element to parse
|
||||||
virtual void parseElement(data::ConstElementPtr config) {
|
virtual void parseElement(data::ConstElementPtr config) {
|
||||||
DnsServerInfoParser parser;
|
DnsServerInfoParser parser;
|
||||||
server_ = parser.parse(config);
|
std::string domain = "{ \"key-name\": \"\" }";
|
||||||
|
server_ = parser.parse(config, Element::fromJSON(domain), {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Retains the DnsServerInfo created by a successful parsing
|
/// @brief Retains the DnsServerInfo created by a successful parsing
|
||||||
@@ -470,7 +471,8 @@ public:
|
|||||||
/// @param config element to parse
|
/// @param config element to parse
|
||||||
virtual void parseElement(data::ConstElementPtr config) {
|
virtual void parseElement(data::ConstElementPtr config) {
|
||||||
DnsServerInfoListParser parser;
|
DnsServerInfoListParser parser;
|
||||||
servers_ = parser.parse(config);
|
std::string domain = "{ \"key-name\": \"\" }";
|
||||||
|
servers_ = parser.parse(config, Element::fromJSON(domain), {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Retains the DnsServerInfos created by a successful parsing
|
/// @brief Retains the DnsServerInfos created by a successful parsing
|
||||||
@@ -977,7 +979,7 @@ TEST_F(DdnsDomainParserTest, invalidDomain) {
|
|||||||
" \"dns-servers\" : [ "
|
" \"dns-servers\" : [ "
|
||||||
" { \"ip-address\": \"127.0.0.3\" , "
|
" { \"ip-address\": \"127.0.0.3\" , "
|
||||||
" \"port\": 300 } ] } ";
|
" \"port\": 300 } ] } ";
|
||||||
PARSE_FAIL(config, "DdnsDomain : example.com specifies"
|
PARSE_FAIL(config, "DdnsDomain : specifies"
|
||||||
" an undefined key: d2_key.example.com (<string>:1:41)");
|
" an undefined key: d2_key.example.com (<string>:1:41)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,30 +1008,34 @@ TEST_F(DdnsDomainParserTest, validDomain) {
|
|||||||
// Verify the name and key_name values.
|
// Verify the name and key_name values.
|
||||||
EXPECT_EQ("example.com", domain_->getName());
|
EXPECT_EQ("example.com", domain_->getName());
|
||||||
EXPECT_EQ("d2_key.example.com", domain_->getKeyName());
|
EXPECT_EQ("d2_key.example.com", domain_->getKeyName());
|
||||||
ASSERT_TRUE(domain_->getTSIGKeyInfo());
|
|
||||||
ASSERT_TRUE(domain_->getTSIGKeyInfo()->getTSIGKey());
|
|
||||||
|
|
||||||
// Verify that the server list exists and contains the correct number of
|
// Verify that the server list exists and contains the correct number of
|
||||||
// servers.
|
// servers.
|
||||||
const DnsServerInfoStoragePtr& servers = domain_->getServers();
|
const DnsServerInfoStoragePtr& servers = domain_->getServers();
|
||||||
EXPECT_TRUE(servers);
|
ASSERT_TRUE(servers);
|
||||||
EXPECT_EQ(3, servers->size());
|
EXPECT_EQ(3, servers->size());
|
||||||
|
|
||||||
// Fetch each server and verify its contents.
|
// Fetch each server and verify its contents.
|
||||||
DnsServerInfoPtr server = (*servers)[0];
|
DnsServerInfoPtr server = (*servers)[0];
|
||||||
EXPECT_TRUE(server);
|
ASSERT_TRUE(server);
|
||||||
|
|
||||||
EXPECT_TRUE(checkServer(server, "", "127.0.0.1", 100));
|
EXPECT_TRUE(checkServer(server, "", "127.0.0.1", 100));
|
||||||
|
ASSERT_TRUE(server->getTSIGKeyInfo());
|
||||||
|
EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
|
||||||
|
|
||||||
server = (*servers)[1];
|
server = (*servers)[1];
|
||||||
EXPECT_TRUE(server);
|
ASSERT_TRUE(server);
|
||||||
|
|
||||||
EXPECT_TRUE(checkServer(server, "", "127.0.0.2", 200));
|
EXPECT_TRUE(checkServer(server, "", "127.0.0.2", 200));
|
||||||
|
ASSERT_TRUE(server->getTSIGKeyInfo());
|
||||||
|
EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
|
||||||
|
|
||||||
server = (*servers)[2];
|
server = (*servers)[2];
|
||||||
EXPECT_TRUE(server);
|
ASSERT_TRUE(server);
|
||||||
|
|
||||||
EXPECT_TRUE(checkServer(server, "", "127.0.0.3", 300));
|
EXPECT_TRUE(checkServer(server, "", "127.0.0.3", 300));
|
||||||
|
ASSERT_TRUE(server->getTSIGKeyInfo());
|
||||||
|
EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
|
||||||
|
|
||||||
// Verify unparsing.
|
// Verify unparsing.
|
||||||
ElementPtr json;
|
ElementPtr json;
|
||||||
@@ -1094,27 +1100,36 @@ TEST_F(DdnsDomainListParserTest, validList) {
|
|||||||
EXPECT_EQ("example.com", domain->getName());
|
EXPECT_EQ("example.com", domain->getName());
|
||||||
EXPECT_EQ("d2_key.example.com", domain->getKeyName());
|
EXPECT_EQ("d2_key.example.com", domain->getKeyName());
|
||||||
|
|
||||||
// Verify the TSIGKeyInfo name and that the actual key was created
|
|
||||||
ASSERT_TRUE(domain->getTSIGKeyInfo());
|
|
||||||
EXPECT_EQ(domain->getKeyName(), domain->getTSIGKeyInfo()->getName());
|
|
||||||
EXPECT_TRUE(domain->getTSIGKeyInfo()->getTSIGKey());
|
|
||||||
|
|
||||||
// Verify the each of the first domain's servers
|
// Verify the each of the first domain's servers
|
||||||
DnsServerInfoStoragePtr servers = domain->getServers();
|
DnsServerInfoStoragePtr servers = domain->getServers();
|
||||||
EXPECT_TRUE(servers);
|
ASSERT_TRUE(servers);
|
||||||
EXPECT_EQ(3, servers->size());
|
EXPECT_EQ(3, servers->size());
|
||||||
|
|
||||||
DnsServerInfoPtr server = (*servers)[0];
|
DnsServerInfoPtr server = (*servers)[0];
|
||||||
EXPECT_TRUE(server);
|
ASSERT_TRUE(server);
|
||||||
EXPECT_TRUE(checkServer(server, "", "127.0.0.1", 100));
|
EXPECT_TRUE(checkServer(server, "", "127.0.0.1", 100));
|
||||||
|
|
||||||
|
// Verify the TSIGKeyInfo name and that the actual key was created
|
||||||
|
ASSERT_TRUE(server->getTSIGKeyInfo());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getKeyName());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
|
||||||
|
EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
|
||||||
|
|
||||||
server = (*servers)[1];
|
server = (*servers)[1];
|
||||||
EXPECT_TRUE(server);
|
ASSERT_TRUE(server);
|
||||||
EXPECT_TRUE(checkServer(server, "", "127.0.0.2", 200));
|
EXPECT_TRUE(checkServer(server, "", "127.0.0.2", 200));
|
||||||
|
ASSERT_TRUE(server->getTSIGKeyInfo());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getKeyName());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
|
||||||
|
EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
|
||||||
|
|
||||||
server = (*servers)[2];
|
server = (*servers)[2];
|
||||||
EXPECT_TRUE(server);
|
ASSERT_TRUE(server);
|
||||||
EXPECT_TRUE(checkServer(server, "", "127.0.0.3", 300));
|
EXPECT_TRUE(checkServer(server, "", "127.0.0.3", 300));
|
||||||
|
ASSERT_TRUE(server->getTSIGKeyInfo());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getKeyName());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
|
||||||
|
EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
|
||||||
|
|
||||||
// Verify second domain
|
// Verify second domain
|
||||||
gotit = domains_->find("billcat.net");
|
gotit = domains_->find("billcat.net");
|
||||||
@@ -1124,27 +1139,35 @@ TEST_F(DdnsDomainListParserTest, validList) {
|
|||||||
// Verify the name and key_name values of the second domain.
|
// Verify the name and key_name values of the second domain.
|
||||||
EXPECT_EQ("billcat.net", domain->getName());
|
EXPECT_EQ("billcat.net", domain->getName());
|
||||||
EXPECT_EQ("d2_key.billcat.net", domain->getKeyName());
|
EXPECT_EQ("d2_key.billcat.net", domain->getKeyName());
|
||||||
ASSERT_TRUE(domain->getTSIGKeyInfo());
|
|
||||||
EXPECT_EQ(domain->getKeyName(), domain->getTSIGKeyInfo()->getName());
|
|
||||||
EXPECT_TRUE(domain->getTSIGKeyInfo()->getTSIGKey());
|
|
||||||
|
|
||||||
// Verify the each of second domain's servers
|
// Verify the each of second domain's servers
|
||||||
servers = domain->getServers();
|
servers = domain->getServers();
|
||||||
EXPECT_TRUE(servers);
|
ASSERT_TRUE(servers);
|
||||||
servers->size();
|
|
||||||
EXPECT_EQ(3, servers->size());
|
EXPECT_EQ(3, servers->size());
|
||||||
|
|
||||||
server = (*servers)[0];
|
server = (*servers)[0];
|
||||||
EXPECT_TRUE(server);
|
ASSERT_TRUE(server);
|
||||||
EXPECT_TRUE(checkServer(server, "", "127.0.0.4", 400));
|
EXPECT_TRUE(checkServer(server, "", "127.0.0.4", 400));
|
||||||
|
ASSERT_TRUE(server->getTSIGKeyInfo());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getKeyName());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
|
||||||
|
EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
|
||||||
|
|
||||||
server = (*servers)[1];
|
server = (*servers)[1];
|
||||||
EXPECT_TRUE(server);
|
ASSERT_TRUE(server);
|
||||||
EXPECT_TRUE(checkServer(server, "", "127.0.0.5", 500));
|
EXPECT_TRUE(checkServer(server, "", "127.0.0.5", 500));
|
||||||
|
ASSERT_TRUE(server->getTSIGKeyInfo());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getKeyName());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
|
||||||
|
EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
|
||||||
|
|
||||||
server = (*servers)[2];
|
server = (*servers)[2];
|
||||||
EXPECT_TRUE(server);
|
ASSERT_TRUE(server);
|
||||||
EXPECT_TRUE(checkServer(server, "", "127.0.0.6", 600));
|
EXPECT_TRUE(checkServer(server, "", "127.0.0.6", 600));
|
||||||
|
ASSERT_TRUE(server->getTSIGKeyInfo());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getKeyName());
|
||||||
|
EXPECT_EQ(domain->getKeyName(), server->getTSIGKeyInfo()->getName());
|
||||||
|
EXPECT_TRUE(server->getTSIGKeyInfo()->getTSIGKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Tests that a domain list configuration cannot contain duplicates.
|
/// @brief Tests that a domain list configuration cannot contain duplicates.
|
||||||
@@ -1168,4 +1191,4 @@ TEST_F(DdnsDomainListParserTest, duplicateDomain) {
|
|||||||
"Duplicate domain specified:example.com (<string>:1:115)");
|
"Duplicate domain specified:example.com (<string>:1:115)");
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
@@ -285,9 +285,9 @@ TransactionTest::setupForIPv4Transaction(dhcp_ddns::NameChangeType chg_type,
|
|||||||
// Create the forward domain and then its servers.
|
// Create the forward domain and then its servers.
|
||||||
forward_domain_ = makeDomain("example.com.", tsig_key_info);
|
forward_domain_ = makeDomain("example.com.", tsig_key_info);
|
||||||
addDomainServer(forward_domain_, "forward.example.com",
|
addDomainServer(forward_domain_, "forward.example.com",
|
||||||
"127.0.0.1", 5301);
|
"127.0.0.1", 5301, tsig_key_info);
|
||||||
addDomainServer(forward_domain_, "forward2.example.com",
|
addDomainServer(forward_domain_, "forward2.example.com",
|
||||||
"127.0.0.1", 5302);
|
"127.0.0.1", 5302, tsig_key_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the change mask does not include a reverse change clear the
|
// If the change mask does not include a reverse change clear the
|
||||||
@@ -299,9 +299,9 @@ TransactionTest::setupForIPv4Transaction(dhcp_ddns::NameChangeType chg_type,
|
|||||||
// Create the reverse domain and its server.
|
// Create the reverse domain and its server.
|
||||||
reverse_domain_ = makeDomain("2.168.192.in.addr.arpa.", tsig_key_info);
|
reverse_domain_ = makeDomain("2.168.192.in.addr.arpa.", tsig_key_info);
|
||||||
addDomainServer(reverse_domain_, "reverse.example.com",
|
addDomainServer(reverse_domain_, "reverse.example.com",
|
||||||
"127.0.0.1", 5301);
|
"127.0.0.1", 5301, tsig_key_info);
|
||||||
addDomainServer(reverse_domain_, "reverse2.example.com",
|
addDomainServer(reverse_domain_, "reverse2.example.com",
|
||||||
"127.0.0.1", 5302);
|
"127.0.0.1", 5302, tsig_key_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,9 +344,9 @@ TransactionTest::setupForIPv6Transaction(dhcp_ddns::NameChangeType chg_type,
|
|||||||
// Create the forward domain and then its servers.
|
// Create the forward domain and then its servers.
|
||||||
forward_domain_ = makeDomain("example.com.", tsig_key_info);
|
forward_domain_ = makeDomain("example.com.", tsig_key_info);
|
||||||
addDomainServer(forward_domain_, "fwd6-server.example.com",
|
addDomainServer(forward_domain_, "fwd6-server.example.com",
|
||||||
"::1", 5301);
|
"::1", 5301, tsig_key_info);
|
||||||
addDomainServer(forward_domain_, "fwd6-server2.example.com",
|
addDomainServer(forward_domain_, "fwd6-server2.example.com",
|
||||||
"::1", 5302);
|
"::1", 5302, tsig_key_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the change mask does not include a reverse change clear the
|
// If the change mask does not include a reverse change clear the
|
||||||
@@ -358,9 +358,9 @@ TransactionTest::setupForIPv6Transaction(dhcp_ddns::NameChangeType chg_type,
|
|||||||
// Create the reverse domain and its server.
|
// Create the reverse domain and its server.
|
||||||
reverse_domain_ = makeDomain("1.2001.ip6.arpa.", tsig_key_info);
|
reverse_domain_ = makeDomain("1.2001.ip6.arpa.", tsig_key_info);
|
||||||
addDomainServer(reverse_domain_, "rev6-server.example.com",
|
addDomainServer(reverse_domain_, "rev6-server.example.com",
|
||||||
"::1", 5301);
|
"::1", 5301, tsig_key_info);
|
||||||
addDomainServer(reverse_domain_, "rev6-server2.example.com",
|
addDomainServer(reverse_domain_, "rev6-server2.example.com",
|
||||||
"::1", 5302);
|
"::1", 5302, tsig_key_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,8 +454,7 @@ dhcp_ddns::NameChangeRequestPtr makeNcrFromString(const std::string& ncr_str) {
|
|||||||
DdnsDomainPtr makeDomain(const std::string& zone_name,
|
DdnsDomainPtr makeDomain(const std::string& zone_name,
|
||||||
const std::string& key_name) {
|
const std::string& key_name) {
|
||||||
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
|
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
|
||||||
DdnsDomainPtr domain(new DdnsDomain(zone_name, servers,
|
DdnsDomainPtr domain(new DdnsDomain(zone_name, servers, key_name));
|
||||||
makeTSIGKeyInfo(key_name)));
|
|
||||||
return (domain);
|
return (domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,7 +462,11 @@ DdnsDomainPtr makeDomain(const std::string& zone_name,
|
|||||||
const TSIGKeyInfoPtr &tsig_key_info) {
|
const TSIGKeyInfoPtr &tsig_key_info) {
|
||||||
DdnsDomainPtr domain;
|
DdnsDomainPtr domain;
|
||||||
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
|
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
|
||||||
domain.reset(new DdnsDomain(zone_name, servers, tsig_key_info));
|
std::string key_name;
|
||||||
|
if (tsig_key_info) {
|
||||||
|
key_name = tsig_key_info->getName();
|
||||||
|
}
|
||||||
|
domain.reset(new DdnsDomain(zone_name, servers, key_name));
|
||||||
return (domain);
|
return (domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,9 +497,10 @@ TSIGKeyInfoPtr makeTSIGKeyInfo(const std::string& key_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addDomainServer(DdnsDomainPtr& domain, const std::string& name,
|
void addDomainServer(DdnsDomainPtr& domain, const std::string& name,
|
||||||
const std::string& ip, const size_t port) {
|
const std::string& ip, const size_t port,
|
||||||
|
const TSIGKeyInfoPtr &tsig_key_info) {
|
||||||
DnsServerInfoPtr server(new DnsServerInfo(name, asiolink::IOAddress(ip),
|
DnsServerInfoPtr server(new DnsServerInfo(name, asiolink::IOAddress(ip),
|
||||||
port));
|
port, true, tsig_key_info, true));
|
||||||
domain->getServers()->push_back(server);
|
domain->getServers()->push_back(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
// Copyright (C) 2013-2021 Internet Systems Consortium, Inc. ("ISC")
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@@ -451,11 +451,15 @@ TSIGKeyInfoPtr makeTSIGKeyInfo(const std::string& key_name,
|
|||||||
/// @param name new server's host name of the server
|
/// @param name new server's host name of the server
|
||||||
/// @param ip new server's ip address
|
/// @param ip new server's ip address
|
||||||
/// @param port new server's port
|
/// @param port new server's port
|
||||||
|
/// @param tsig_key_info pointer to the TSIGInfog key for this server.
|
||||||
|
/// Defaults to an empty pointer, meaning this server has no key.
|
||||||
///
|
///
|
||||||
/// @throw Underlying methods may throw.
|
/// @throw Underlying methods may throw.
|
||||||
extern void addDomainServer(DdnsDomainPtr& domain, const std::string& name,
|
extern void addDomainServer(DdnsDomainPtr& domain, const std::string& name,
|
||||||
const std::string& ip = TEST_DNS_SERVER_IP,
|
const std::string& ip = TEST_DNS_SERVER_IP,
|
||||||
const size_t port = TEST_DNS_SERVER_PORT);
|
const size_t port = TEST_DNS_SERVER_PORT,
|
||||||
|
const TSIGKeyInfoPtr&
|
||||||
|
tsig_key_info = TSIGKeyInfoPtr());
|
||||||
|
|
||||||
/// @brief Creates a hex text dump of the given data buffer.
|
/// @brief Creates a hex text dump of the given data buffer.
|
||||||
///
|
///
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
|
// Copyright (C) 2013-2021 Internet Systems Consortium, Inc. ("ISC")
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
4
src/bin/d2/tests/testdata/d2_cfg_tests.json
vendored
4
src/bin/d2/tests/testdata/d2_cfg_tests.json
vendored
@@ -878,7 +878,7 @@
|
|||||||
#------ "D2.forward-ddns.dhcp-ddns, key-name tests
|
#------ "D2.forward-ddns.dhcp-ddns, key-name tests
|
||||||
,{
|
,{
|
||||||
"description" : "D2.forward-ddns, no matching key name",
|
"description" : "D2.forward-ddns, no matching key name",
|
||||||
"logic-error" : "DdnsDomain : four.example.com. specifies an undefined key: no.such.key (<string>:1:104)",
|
"logic-error" : "DdnsDomain : specifies an undefined key: no.such.key (<string>:1:104)",
|
||||||
"data" :
|
"data" :
|
||||||
{
|
{
|
||||||
"forward-ddns" :
|
"forward-ddns" :
|
||||||
@@ -1272,7 +1272,7 @@
|
|||||||
#------ "D2.reverse-ddns.dhcp-ddns, key-name tests
|
#------ "D2.reverse-ddns.dhcp-ddns, key-name tests
|
||||||
,{
|
,{
|
||||||
"description" : "D2.reverse-ddns, no matching key name",
|
"description" : "D2.reverse-ddns, no matching key name",
|
||||||
"logic-error" : "DdnsDomain : 2.0.192.in-addr.arpa. specifies an undefined key: no.such.key (<string>:1:126)",
|
"logic-error" : "DdnsDomain : specifies an undefined key: no.such.key (<string>:1:126)",
|
||||||
"data" :
|
"data" :
|
||||||
{
|
{
|
||||||
"forward-ddns" : {},
|
"forward-ddns" : {},
|
||||||
|
@@ -201,15 +201,28 @@ TSIGKeyInfo::toElement() const {
|
|||||||
|
|
||||||
// *********************** DnsServerInfo *************************
|
// *********************** DnsServerInfo *************************
|
||||||
DnsServerInfo::DnsServerInfo(const std::string& hostname,
|
DnsServerInfo::DnsServerInfo(const std::string& hostname,
|
||||||
isc::asiolink::IOAddress ip_address, uint32_t port,
|
isc::asiolink::IOAddress ip_address,
|
||||||
bool enabled)
|
uint32_t port,
|
||||||
:hostname_(hostname), ip_address_(ip_address), port_(port),
|
bool enabled,
|
||||||
enabled_(enabled) {
|
const TSIGKeyInfoPtr& tsig_key_info,
|
||||||
|
bool inherited_key)
|
||||||
|
: hostname_(hostname), ip_address_(ip_address), port_(port),
|
||||||
|
enabled_(enabled), tsig_key_info_(tsig_key_info),
|
||||||
|
inherited_key_(inherited_key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DnsServerInfo::~DnsServerInfo() {
|
DnsServerInfo::~DnsServerInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string
|
||||||
|
DnsServerInfo::getKeyName() const {
|
||||||
|
if (tsig_key_info_) {
|
||||||
|
return (tsig_key_info_->getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ("");
|
||||||
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
DnsServerInfo::toText() const {
|
DnsServerInfo::toText() const {
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
@@ -228,11 +241,14 @@ DnsServerInfo::toElement() const {
|
|||||||
result->set("ip-address", Element::create(ip_address_.toText()));
|
result->set("ip-address", Element::create(ip_address_.toText()));
|
||||||
// Set port
|
// Set port
|
||||||
result->set("port", Element::create(static_cast<int64_t>(port_)));
|
result->set("port", Element::create(static_cast<int64_t>(port_)));
|
||||||
|
// Set key-name
|
||||||
|
if (tsig_key_info_ && !inherited_key_) {
|
||||||
|
result->set("key-name", Element::create(tsig_key_info_->getName()));
|
||||||
|
}
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<<(std::ostream& os, const DnsServerInfo& server) {
|
operator<<(std::ostream& os, const DnsServerInfo& server) {
|
||||||
os << server.toText();
|
os << server.toText();
|
||||||
@@ -243,23 +259,13 @@ operator<<(std::ostream& os, const DnsServerInfo& server) {
|
|||||||
|
|
||||||
DdnsDomain::DdnsDomain(const std::string& name,
|
DdnsDomain::DdnsDomain(const std::string& name,
|
||||||
DnsServerInfoStoragePtr servers,
|
DnsServerInfoStoragePtr servers,
|
||||||
const TSIGKeyInfoPtr& tsig_key_info)
|
const std::string& key_name)
|
||||||
: name_(name), servers_(servers),
|
: name_(name), servers_(servers), key_name_(key_name) {
|
||||||
tsig_key_info_(tsig_key_info) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DdnsDomain::~DdnsDomain() {
|
DdnsDomain::~DdnsDomain() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string
|
|
||||||
DdnsDomain::getKeyName() const {
|
|
||||||
if (tsig_key_info_) {
|
|
||||||
return (tsig_key_info_->getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return ("");
|
|
||||||
}
|
|
||||||
|
|
||||||
ElementPtr
|
ElementPtr
|
||||||
DdnsDomain::toElement() const {
|
DdnsDomain::toElement() const {
|
||||||
ElementPtr result = Element::createMap();
|
ElementPtr result = Element::createMap();
|
||||||
@@ -279,8 +285,8 @@ DdnsDomain::toElement() const {
|
|||||||
result->set("dns-servers", servers);
|
result->set("dns-servers", servers);
|
||||||
}
|
}
|
||||||
// Set key-name
|
// Set key-name
|
||||||
if (tsig_key_info_) {
|
if (!key_name_.empty()) {
|
||||||
result->set("key-name", Element::create(tsig_key_info_->getName()));
|
result->set("key-name", Element::create(key_name_));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
@@ -477,12 +483,47 @@ TSIGKeyInfoListParser::parse(ConstElementPtr key_list) {
|
|||||||
// *********************** DnsServerInfoParser *************************
|
// *********************** DnsServerInfoParser *************************
|
||||||
|
|
||||||
DnsServerInfoPtr
|
DnsServerInfoPtr
|
||||||
DnsServerInfoParser::parse(ConstElementPtr server_config) {
|
DnsServerInfoParser::parse(ConstElementPtr server_config,
|
||||||
|
ConstElementPtr domain_config,
|
||||||
|
const TSIGKeyInfoMapPtr keys) {
|
||||||
std::string hostname = getString(server_config, "hostname");
|
std::string hostname = getString(server_config, "hostname");
|
||||||
std::string ip_address = getString(server_config, "ip-address");
|
std::string ip_address = getString(server_config, "ip-address");
|
||||||
uint32_t port = getInteger(server_config, "port");
|
uint32_t port = getInteger(server_config, "port");
|
||||||
|
std::string key_name = getString(server_config, "key-name");
|
||||||
ConstElementPtr user_context = server_config->get("user-context");
|
ConstElementPtr user_context = server_config->get("user-context");
|
||||||
|
|
||||||
|
// Key name is optional. If it is not blank, then find the key in the
|
||||||
|
// list of defined keys.
|
||||||
|
TSIGKeyInfoPtr tsig_key_info;
|
||||||
|
bool inherited_key = false;
|
||||||
|
if (key_name.empty()) {
|
||||||
|
std::string domain_key_name = getString(domain_config, "key-name");
|
||||||
|
if (!domain_key_name.empty()) {
|
||||||
|
key_name = domain_key_name;
|
||||||
|
inherited_key = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!key_name.empty()) {
|
||||||
|
if (keys) {
|
||||||
|
TSIGKeyInfoMap::iterator kit = keys->find(key_name);
|
||||||
|
if (kit != keys->end()) {
|
||||||
|
tsig_key_info = kit->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tsig_key_info) {
|
||||||
|
if (inherited_key) {
|
||||||
|
isc_throw(D2CfgError, "DdnsDomain : specifies an "
|
||||||
|
<< "undefined key: " << key_name << " ("
|
||||||
|
<< getPosition("key-name", domain_config) << ")");
|
||||||
|
} else {
|
||||||
|
isc_throw(D2CfgError, "Dns Server : specifies an "
|
||||||
|
<< "undefined key: " << key_name << " ("
|
||||||
|
<< getPosition("key-name", server_config) << ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The configuration must specify one or the other.
|
// The configuration must specify one or the other.
|
||||||
if (hostname.empty() == ip_address.empty()) {
|
if (hostname.empty() == ip_address.empty()) {
|
||||||
isc_throw(D2CfgError, "Dns Server must specify one or the other"
|
isc_throw(D2CfgError, "Dns Server must specify one or the other"
|
||||||
@@ -512,7 +553,9 @@ DnsServerInfoParser::parse(ConstElementPtr server_config) {
|
|||||||
// Create an IOAddress from the IP address string given and then
|
// Create an IOAddress from the IP address string given and then
|
||||||
// create the DnsServerInfo.
|
// create the DnsServerInfo.
|
||||||
isc::asiolink::IOAddress io_addr(ip_address);
|
isc::asiolink::IOAddress io_addr(ip_address);
|
||||||
server_info.reset(new DnsServerInfo(hostname, io_addr, port));
|
server_info.reset(new DnsServerInfo(hostname, io_addr, port,
|
||||||
|
true, tsig_key_info,
|
||||||
|
inherited_key));
|
||||||
} catch (const isc::asiolink::IOError& ex) {
|
} catch (const isc::asiolink::IOError& ex) {
|
||||||
isc_throw(D2CfgError, "Dns Server : invalid IP address : "
|
isc_throw(D2CfgError, "Dns Server : invalid IP address : "
|
||||||
<< ip_address
|
<< ip_address
|
||||||
@@ -531,12 +574,15 @@ DnsServerInfoParser::parse(ConstElementPtr server_config) {
|
|||||||
// *********************** DnsServerInfoListParser *************************
|
// *********************** DnsServerInfoListParser *************************
|
||||||
|
|
||||||
DnsServerInfoStoragePtr
|
DnsServerInfoStoragePtr
|
||||||
DnsServerInfoListParser::parse(ConstElementPtr server_list) {
|
DnsServerInfoListParser::parse(ConstElementPtr server_list,
|
||||||
|
ConstElementPtr domain_config,
|
||||||
|
const TSIGKeyInfoMapPtr keys) {
|
||||||
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
|
DnsServerInfoStoragePtr servers(new DnsServerInfoStorage());
|
||||||
ConstElementPtr server_config;
|
ConstElementPtr server_config;
|
||||||
DnsServerInfoParser parser;
|
DnsServerInfoParser parser;
|
||||||
BOOST_FOREACH(server_config, server_list->listValue()) {
|
BOOST_FOREACH(server_config, server_list->listValue()) {
|
||||||
DnsServerInfoPtr server = parser.parse(server_config);
|
DnsServerInfoPtr server =
|
||||||
|
parser.parse(server_config, domain_config, keys);
|
||||||
servers->push_back(server);
|
servers->push_back(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,24 +597,6 @@ DdnsDomainPtr DdnsDomainParser::parse(ConstElementPtr domain_config,
|
|||||||
std::string key_name = getString(domain_config, "key-name");
|
std::string key_name = getString(domain_config, "key-name");
|
||||||
ConstElementPtr user_context = domain_config->get("user-context");
|
ConstElementPtr user_context = domain_config->get("user-context");
|
||||||
|
|
||||||
// Key name is optional. If it is not blank, then find the key in the
|
|
||||||
// list of defined keys.
|
|
||||||
TSIGKeyInfoPtr tsig_key_info;
|
|
||||||
if (!key_name.empty()) {
|
|
||||||
if (keys) {
|
|
||||||
TSIGKeyInfoMap::iterator kit = keys->find(key_name);
|
|
||||||
if (kit != keys->end()) {
|
|
||||||
tsig_key_info = kit->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tsig_key_info) {
|
|
||||||
isc_throw(D2CfgError, "DdnsDomain : " << name
|
|
||||||
<< " specifies an undefined key: " << key_name
|
|
||||||
<< " (" << getPosition("key-name", domain_config) << ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse the list of DNS servers
|
// Parse the list of DNS servers
|
||||||
ConstElementPtr servers_config;
|
ConstElementPtr servers_config;
|
||||||
try {
|
try {
|
||||||
@@ -579,14 +607,15 @@ DdnsDomainPtr DdnsDomainParser::parse(ConstElementPtr domain_config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DnsServerInfoListParser server_parser;
|
DnsServerInfoListParser server_parser;
|
||||||
DnsServerInfoStoragePtr servers = server_parser.parse(servers_config);
|
DnsServerInfoStoragePtr servers =
|
||||||
|
server_parser.parse(servers_config, domain_config, keys);
|
||||||
if (servers->size() == 0) {
|
if (servers->size() == 0) {
|
||||||
isc_throw(D2CfgError, "DNS server list cannot be empty"
|
isc_throw(D2CfgError, "DNS server list cannot be empty"
|
||||||
<< servers_config->getPosition());
|
<< servers_config->getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instantiate the new domain and add it to domain storage.
|
// Instantiate the new domain and add it to domain storage.
|
||||||
DdnsDomainPtr domain(new DdnsDomain(name, servers, tsig_key_info));
|
DdnsDomainPtr domain(new DdnsDomain(name, servers, key_name));
|
||||||
|
|
||||||
// Add user-context
|
// Add user-context
|
||||||
if (user_context) {
|
if (user_context) {
|
||||||
@@ -640,5 +669,5 @@ DdnsDomainListMgrParser::parse(ConstElementPtr mgr_config,
|
|||||||
return(mgr);
|
return(mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // end of isc::dhcp namespace
|
} // end of isc::dhcp namespace
|
||||||
}; // end of isc namespace
|
} // end of isc namespace
|
||||||
|
@@ -122,7 +122,8 @@ namespace d2 {
|
|||||||
/// "key-name": "d2_key.tmark.org" ,
|
/// "key-name": "d2_key.tmark.org" ,
|
||||||
/// "dns-servers" :
|
/// "dns-servers" :
|
||||||
/// [
|
/// [
|
||||||
/// { "ip-address": "127.0.0.101" , "port": 100 }
|
/// { "ip-address": "127.0.0.101" , "port": 100 ,
|
||||||
|
/// "key-name": "d2_key.tmark.org" }
|
||||||
/// ]
|
/// ]
|
||||||
/// }
|
/// }
|
||||||
/// ]
|
/// ]
|
||||||
@@ -434,10 +435,17 @@ public:
|
|||||||
/// the default.)
|
/// the default.)
|
||||||
/// @param enabled is a flag that indicates whether this server is
|
/// @param enabled is a flag that indicates whether this server is
|
||||||
/// enabled for use. It defaults to true.
|
/// enabled for use. It defaults to true.
|
||||||
|
/// @param tsig_key_info pointer to the TSIGKeyInfo for the server's key
|
||||||
|
/// It defaults to an empty pointer, signifying the server has no key.
|
||||||
|
/// @param inherited_key is a flag that indicates whether the key was
|
||||||
|
/// inherited from the domain or not. It defaults to false i.e. not
|
||||||
|
/// inherited.
|
||||||
DnsServerInfo(const std::string& hostname,
|
DnsServerInfo(const std::string& hostname,
|
||||||
isc::asiolink::IOAddress ip_address,
|
isc::asiolink::IOAddress ip_address,
|
||||||
uint32_t port = STANDARD_DNS_PORT,
|
uint32_t port = STANDARD_DNS_PORT,
|
||||||
bool enabled=true);
|
bool enabled = true,
|
||||||
|
const TSIGKeyInfoPtr& tsig_key_info = TSIGKeyInfoPtr(),
|
||||||
|
bool inherited_key = false);
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
virtual ~DnsServerInfo();
|
virtual ~DnsServerInfo();
|
||||||
@@ -481,6 +489,20 @@ public:
|
|||||||
enabled_ = false;
|
enabled_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Convenience method which returns the server's TSIG key name.
|
||||||
|
///
|
||||||
|
/// @return returns the key name in an std::string. If server has no
|
||||||
|
/// TSIG key, the string will empty.
|
||||||
|
const std::string getKeyName() const;
|
||||||
|
|
||||||
|
/// @brief Getter which returns the server's TSIGKey info
|
||||||
|
///
|
||||||
|
/// @return returns the pointer to the server storage. If the server
|
||||||
|
/// is not configured to use TSIG the pointer will be empty.
|
||||||
|
const TSIGKeyInfoPtr& getTSIGKeyInfo() {
|
||||||
|
return (tsig_key_info_);
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Returns a text representation for the server.
|
/// @brief Returns a text representation for the server.
|
||||||
std::string toText() const;
|
std::string toText() const;
|
||||||
|
|
||||||
@@ -505,6 +527,14 @@ private:
|
|||||||
/// @param enabled is a flag that indicates whether this server is
|
/// @param enabled is a flag that indicates whether this server is
|
||||||
/// enabled for use. It defaults to true.
|
/// enabled for use. It defaults to true.
|
||||||
bool enabled_;
|
bool enabled_;
|
||||||
|
|
||||||
|
/// @brief Pointer to domain's the TSIGKeyInfo.
|
||||||
|
/// Value is empty if the domain is not configured for TSIG.
|
||||||
|
TSIGKeyInfoPtr tsig_key_info_;
|
||||||
|
|
||||||
|
/// @brief Inherited key. When true the key was inherited from the domain,
|
||||||
|
/// when false the key was not inherited from the domain.
|
||||||
|
bool inherited_key_;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
@@ -533,11 +563,9 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param name is the domain name of the domain.
|
/// @param name is the domain name of the domain.
|
||||||
/// @param servers is the list of server(s) supporting this domain.
|
/// @param servers is the list of server(s) supporting this domain.
|
||||||
/// @param tsig_key_info pointer to the TSIGKeyInfo for the domain's key
|
/// @param key_name is the TSIG key name of the domain.
|
||||||
/// It defaults to an empty pointer, signifying the domain has no key.
|
DdnsDomain(const std::string& name, DnsServerInfoStoragePtr servers,
|
||||||
DdnsDomain(const std::string& name,
|
const std::string& key_name = "");
|
||||||
DnsServerInfoStoragePtr servers,
|
|
||||||
const TSIGKeyInfoPtr& tsig_key_info = TSIGKeyInfoPtr());
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
virtual ~DdnsDomain();
|
virtual ~DdnsDomain();
|
||||||
@@ -549,11 +577,15 @@ public:
|
|||||||
return (name_);
|
return (name_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Convenience method which returns the domain's TSIG key name.
|
/// @brief Getter which returns the domain's TSIG key name.
|
||||||
|
///
|
||||||
|
/// @note: TSIG key infos are in servers.
|
||||||
///
|
///
|
||||||
/// @return returns the key name in an std::string. If domain has no
|
/// @return returns the key name in an std::string. If domain has no
|
||||||
/// TSIG key, the string will empty.
|
/// TSIG key, the string will empty.
|
||||||
const std::string getKeyName() const;
|
const std::string getKeyName() const {
|
||||||
|
return (key_name_);
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Getter which returns the domain's list of servers.
|
/// @brief Getter which returns the domain's list of servers.
|
||||||
///
|
///
|
||||||
@@ -562,14 +594,6 @@ public:
|
|||||||
return (servers_);
|
return (servers_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Getter which returns the domain's TSIGKey info
|
|
||||||
///
|
|
||||||
/// @return returns the pointer to the server storage. If the domain
|
|
||||||
/// is not configured to use TSIG the pointer will be empty.
|
|
||||||
const TSIGKeyInfoPtr& getTSIGKeyInfo() {
|
|
||||||
return (tsig_key_info_);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief Unparse a configuration object
|
/// @brief Unparse a configuration object
|
||||||
///
|
///
|
||||||
/// @return a pointer to a configuration
|
/// @return a pointer to a configuration
|
||||||
@@ -582,9 +606,8 @@ private:
|
|||||||
/// @brief The list of server(s) supporting this domain.
|
/// @brief The list of server(s) supporting this domain.
|
||||||
DnsServerInfoStoragePtr servers_;
|
DnsServerInfoStoragePtr servers_;
|
||||||
|
|
||||||
/// @brief Pointer to domain's the TSIGKeyInfo.
|
/// @brief The TSIG key name (empty when there is no key for the domain).
|
||||||
/// Value is empty if the domain is not configured for TSIG.
|
std::string key_name_;
|
||||||
TSIGKeyInfoPtr tsig_key_info_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Defines a pointer for DdnsDomain instances.
|
/// @brief Defines a pointer for DdnsDomain instances.
|
||||||
@@ -778,6 +801,7 @@ public:
|
|||||||
/// 3. Add the new TSIGKeyInfo instance to the key map
|
/// 3. Add the new TSIGKeyInfo instance to the key map
|
||||||
///
|
///
|
||||||
/// @param key_list_config is the list of "tsig_key" elements to parse.
|
/// @param key_list_config is the list of "tsig_key" elements to parse.
|
||||||
|
/// @param keys map of defined TSIG keys
|
||||||
///
|
///
|
||||||
/// @return a map containing the TSIGKeyInfo instances
|
/// @return a map containing the TSIGKeyInfo instances
|
||||||
TSIGKeyInfoMapPtr parse(data::ConstElementPtr key_list_config);
|
TSIGKeyInfoMapPtr parse(data::ConstElementPtr key_list_config);
|
||||||
@@ -796,6 +820,8 @@ public:
|
|||||||
/// and returns it.
|
/// and returns it.
|
||||||
///
|
///
|
||||||
/// @param server_config is the "dns-server" configuration to parse
|
/// @param server_config is the "dns-server" configuration to parse
|
||||||
|
/// @param domain_config the parent domain's configuration
|
||||||
|
/// @param keys map of defined TSIG keys
|
||||||
///
|
///
|
||||||
/// @return a pointer to the newly created server instance
|
/// @return a pointer to the newly created server instance
|
||||||
///
|
///
|
||||||
@@ -803,7 +829,9 @@ public:
|
|||||||
/// -# hostname is not blank, hostname is not yet supported
|
/// -# hostname is not blank, hostname is not yet supported
|
||||||
/// -# ip_address is invalid
|
/// -# ip_address is invalid
|
||||||
/// -# port is 0
|
/// -# port is 0
|
||||||
DnsServerInfoPtr parse(data::ConstElementPtr server_config);
|
DnsServerInfoPtr parse(data::ConstElementPtr server_config,
|
||||||
|
data::ConstElementPtr domain_config,
|
||||||
|
const TSIGKeyInfoMapPtr keys);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Parser for a list of DnsServerInfos
|
/// @brief Parser for a list of DnsServerInfos
|
||||||
@@ -811,7 +839,7 @@ public:
|
|||||||
/// This class parses a list of "dns-server" configuration elements.
|
/// This class parses a list of "dns-server" configuration elements.
|
||||||
/// The DnsServerInfo instances are added
|
/// The DnsServerInfo instances are added
|
||||||
/// to the given storage upon commit.
|
/// to the given storage upon commit.
|
||||||
class DnsServerInfoListParser : public data::SimpleParser{
|
class DnsServerInfoListParser : public data::SimpleParser {
|
||||||
public:
|
public:
|
||||||
/// @brief Performs the actual parsing of the given list "dns-server"
|
/// @brief Performs the actual parsing of the given list "dns-server"
|
||||||
/// elements.
|
/// elements.
|
||||||
@@ -823,8 +851,12 @@ public:
|
|||||||
/// 2. Adds the server to the server list
|
/// 2. Adds the server to the server list
|
||||||
///
|
///
|
||||||
/// @param server_list_config is the list of "dns-server" elements to parse.
|
/// @param server_list_config is the list of "dns-server" elements to parse.
|
||||||
|
/// @param domain_config the parent domain's configuration
|
||||||
|
/// @param keys map of defined TSIG keys
|
||||||
/// @return A pointer to the new, populated server list
|
/// @return A pointer to the new, populated server list
|
||||||
DnsServerInfoStoragePtr parse(data::ConstElementPtr server_list_config);
|
DnsServerInfoStoragePtr parse(data::ConstElementPtr server_list_config,
|
||||||
|
data::ConstElementPtr domain_config,
|
||||||
|
const TSIGKeyInfoMapPtr keys);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Parser for DdnsDomain
|
/// @brief Parser for DdnsDomain
|
||||||
@@ -891,8 +923,7 @@ public:
|
|||||||
const TSIGKeyInfoMapPtr keys);
|
const TSIGKeyInfoMapPtr keys);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // end of isc::d2 namespace
|
||||||
}; // end of isc::d2 namespace
|
} // end of isc namespace
|
||||||
}; // end of isc namespace
|
|
||||||
|
|
||||||
#endif // D2_CONFIG_H
|
#endif // D2_CONFIG_H
|
||||||
|
@@ -110,6 +110,7 @@ const SimpleDefaults D2SimpleParser::DDNS_DOMAIN_DEFAULTS = {
|
|||||||
const SimpleDefaults D2SimpleParser::DNS_SERVER_DEFAULTS = {
|
const SimpleDefaults D2SimpleParser::DNS_SERVER_DEFAULTS = {
|
||||||
{ "hostname", Element::string, "" },
|
{ "hostname", Element::string, "" },
|
||||||
{ "port", Element::integer, "53" },
|
{ "port", Element::integer, "53" },
|
||||||
|
{ "key-name", Element::string, "" }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
Reference in New Issue
Block a user