2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[5531] Checkpoint before first syntax change

This commit is contained in:
Francis Dupont
2018-02-12 01:34:48 +01:00
parent 405ae2f6a8
commit 66fd3572c0
10 changed files with 206 additions and 102 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
/* Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
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
@@ -294,6 +294,15 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"hosts-databases\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::DHCP4:
return isc::dhcp::Dhcp4Parser::make_HOSTS_DATABASES(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("hosts-databases", driver.loc_);
}
}
\"readonly\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::HOSTS_DATABASE:

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
/* Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
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
@@ -68,6 +68,7 @@ using namespace std;
LEASE_DATABASE "lease-database"
HOSTS_DATABASE "hosts-database"
HOSTS_DATABASES "hosts-databases"
TYPE "type"
MEMFILE "memfile"
MYSQL "mysql"
@@ -421,6 +422,7 @@ global_param: valid_lifetime
| interfaces_config
| lease_database
| hosts_database
| hosts_databases
| host_reservation_identifiers
| client_classes
| option_def_list
@@ -568,6 +570,34 @@ hosts_database: HOSTS_DATABASE {
ctx.leave();
};
hosts_databases: HOSTS_DATABASES {
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("hosts-databases", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.HOSTS_DATABASE);
} COLON LSQUARE_BRACKET database_list RSQUARE_BRACKET {
ctx.stack_.pop_back();
ctx.leave();
};
database_list: %empty
| not_empty_database_list
;
not_empty_database_list: database
| not_empty_database_list COMMA database
;
database: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} database_map_params RCURLY_BRACKET {
// The type parameter is required
ctx.require("type", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.stack_.pop_back();
};
database_map_params: database_map_param
| database_map_params COMMA database_map_param
;

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// 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
@@ -425,6 +425,17 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set,
continue;
}
// For now only support empty or singleton, ignoring extra entries.
if (config_pair.first == "hosts-databases") {
if (config_pair.second->size() == 0) {
continue;
}
DbAccessParser parser(DbAccessParser::HOSTS_DB);
CfgDbAccessPtr cfg_db_access = srv_cfg->getCfgDbAccess();
parser.parse(cfg_db_access, config_pair.second->get(0));
continue;
}
if (config_pair.first == "subnet4") {
SrvConfigPtr srv_cfg = CfgMgr::instance().getStagingCfg();
Subnets4ListConfigParser subnets_parser;

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
//
// 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
@@ -223,7 +223,7 @@ public:
/// Used while parsing Dhcp4/lease-database structures.
LEASE_DATABASE,
/// Used while parsing Dhcp4/hosts-database structures.
/// Used while parsing Dhcp4/hosts-database[s] structures.
HOSTS_DATABASE,
/// Used while parsing Dhcp4/*-database/type.

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
/* Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
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
@@ -457,6 +457,15 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"hosts-databases\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::DHCP6:
return isc::dhcp::Dhcp6Parser::make_HOSTS_DATABASES(driver.loc_);
default:
return isc::dhcp::Dhcp6Parser::make_STRING("hosts-databases", driver.loc_);
}
}
\"readonly\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::HOSTS_DATABASE:

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
/* Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
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
@@ -56,6 +56,7 @@ using namespace std;
LEASE_DATABASE "lease-database"
HOSTS_DATABASE "hosts-database"
HOSTS_DATABASES "hosts-databases"
TYPE "type"
MEMFILE "memfile"
MYSQL "mysql"
@@ -425,6 +426,7 @@ global_param: preferred_lifetime
| interfaces_config
| lease_database
| hosts_database
| hosts_databases
| mac_sources
| relay_supplied_options
| host_reservation_identifiers
@@ -538,6 +540,34 @@ hosts_database: HOSTS_DATABASE {
ctx.leave();
};
hosts_databases: HOSTS_DATABASES {
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("hosts-databases", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.HOSTS_DATABASE);
} COLON LSQUARE_BRACKET database_list RSQUARE_BRACKET {
ctx.stack_.pop_back();
ctx.leave();
};
database_list: %empty
| not_empty_database_list
;
not_empty_database_list: database
| not_empty_database_list COMMA database
;
database: LCURLY_BRACKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} database_map_params RCURLY_BRACKET {
// The type parameter is required
ctx.require("type", ctx.loc2pos(@1), ctx.loc2pos(@4));
ctx.stack_.pop_back();
};
database_map_params: database_map_param
| database_map_params COMMA database_map_param
;

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
//
// 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
@@ -538,6 +538,17 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set,
continue;
}
// For now only support empty or singleton, ignoring extra entries.
if (config_pair.first == "hosts-databases") {
if (config_pair.second->size() == 0) {
continue;
}
DbAccessParser parser(DbAccessParser::HOSTS_DB);
CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
parser.parse(cfg_db_access, config_pair.second->get(0));
continue;
}
if (config_pair.first == "subnet6") {
Subnets6ListConfigParser subnets_parser;
// parse() returns number of subnets parsed. We may log it one day.

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
//
// 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
@@ -221,7 +221,7 @@ public:
/// Used while parsing Dhcp6/lease-database structures.
LEASE_DATABASE,
/// Used while parsing Dhcp6/hosts-database structures.
/// Used while parsing Dhcp6/hosts-database[s] structures.
HOSTS_DATABASE,
/// Used while parsing Dhcp6/*-database/type.

View File

@@ -116,16 +116,16 @@ ConstHostPtr
HostMgr::get4(const SubnetID& subnet_id, const HWAddrPtr& hwaddr,
const DuidPtr& duid) const {
ConstHostPtr host = getCfgHosts()->get4(subnet_id, hwaddr, duid);
if (host || alternate_sources_.empty()) {
return (host);
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_HWADDR_DUID)
.arg(subnet_id)
.arg(hwaddr ? hwaddr->toText() : "(no-hwaddr)")
.arg(duid ? duid->toText() : "(duid)");
for (auto it = alternate_sources_.begin();
it != alternate_sources_.end(); ++it) {
if (host) {
break;
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_HWADDR_DUID)
.arg(subnet_id)
.arg(hwaddr ? hwaddr->toText() : "(no-hwaddr)")
.arg(duid ? duid->toText() : "(duid)");
!host && it != alternate_sources_.end(); ++it) {
if (duid) {
host = (*it)->get4(subnet_id, HWAddrPtr(), duid);
}
@@ -143,18 +143,18 @@ HostMgr::get4(const SubnetID& subnet_id,
const size_t identifier_len) const {
ConstHostPtr host = getCfgHosts()->get4(subnet_id, identifier_type,
identifier_begin, identifier_len);
if (host || alternate_sources_.empty()) {
return (host);
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER)
.arg(subnet_id)
.arg(Host::getIdentifierAsText(identifier_type, identifier_begin,
identifier_len));
for (auto it = alternate_sources_.begin();
it != alternate_sources_.end(); ++it) {
if (host) {
break;
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER)
.arg(subnet_id)
.arg(Host::getIdentifierAsText(identifier_type,
identifier_begin,
identifier_len));
host = (*it)->get4(subnet_id, identifier_type,
identifier_begin, identifier_len);
@@ -165,17 +165,17 @@ HostMgr::get4(const SubnetID& subnet_id,
.arg(Host::getIdentifierAsText(identifier_type,
identifier_begin,
identifier_len))
.arg((*it)->getType())
.arg(host->toText());
break;
return (host);
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_RESULTS,
HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER_NULL)
.arg(subnet_id)
.arg(Host::getIdentifierAsText(identifier_type,
identifier_begin,
identifier_len));
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_RESULTS,
HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER_NULL)
.arg(subnet_id)
.arg(Host::getIdentifierAsText(identifier_type, identifier_begin,
identifier_len));
return (host);
}
@@ -183,15 +183,15 @@ ConstHostPtr
HostMgr::get4(const SubnetID& subnet_id,
const asiolink::IOAddress& address) const {
ConstHostPtr host = getCfgHosts()->get4(subnet_id, address);
if (host || alternate_sources_.empty()) {
return (host);
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_ADDRESS4)
.arg(subnet_id)
.arg(address.toText());
for (auto it = alternate_sources_.begin();
it != alternate_sources_.end(); ++it) {
if (host) {
break;
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_ADDRESS4)
.arg(subnet_id)
.arg(address.toText());
!host && it != alternate_sources_.end(); ++it) {
host = (*it)->get4(subnet_id, address);
}
return (host);
@@ -202,16 +202,17 @@ ConstHostPtr
HostMgr::get6(const SubnetID& subnet_id, const DuidPtr& duid,
const HWAddrPtr& hwaddr) const {
ConstHostPtr host = getCfgHosts()->get6(subnet_id, duid, hwaddr);
if (host || alternate_sources_.empty()) {
return (host);
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_DUID_HWADDR)
.arg(subnet_id)
.arg(duid ? duid->toText() : "(duid)")
.arg(hwaddr ? hwaddr->toText() : "(no-hwaddr)");
for (auto it = alternate_sources_.begin();
it != alternate_sources_.end(); ++it) {
if (host) {
break;
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_DUID_HWADDR)
.arg(subnet_id)
.arg(duid ? duid->toText() : "(duid)")
.arg(hwaddr ? hwaddr->toText() : "(no-hwaddr)");
!host && it != alternate_sources_.end(); ++it) {
if (duid) {
host = (*it)->get6(subnet_id, duid, HWAddrPtr());
}
@@ -225,15 +226,15 @@ HostMgr::get6(const SubnetID& subnet_id, const DuidPtr& duid,
ConstHostPtr
HostMgr::get6(const IOAddress& prefix, const uint8_t prefix_len) const {
ConstHostPtr host = getCfgHosts()->get6(prefix, prefix_len);
if (host || alternate_sources_.empty()) {
return (host);
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET6_PREFIX)
.arg(prefix.toText())
.arg(static_cast<int>(prefix_len));
for (auto it = alternate_sources_.begin();
it != alternate_sources_.end(); ++it) {
if (host) {
break;
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET6_PREFIX)
.arg(prefix.toText())
.arg(static_cast<int>(prefix_len));
!host && it != alternate_sources_.end(); ++it) {
host = (*it)->get6(prefix, prefix_len);
}
return (host);
@@ -246,17 +247,18 @@ HostMgr::get6(const SubnetID& subnet_id,
const size_t identifier_len) const {
ConstHostPtr host = getCfgHosts()->get6(subnet_id, identifier_type,
identifier_begin, identifier_len);
if (host || alternate_sources_.empty()) {
return (host);
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER)
.arg(subnet_id)
.arg(Host::getIdentifierAsText(identifier_type, identifier_begin,
identifier_len));
for (auto it = alternate_sources_.begin();
it != alternate_sources_.end(); ++it) {
if (host) {
break;
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER)
.arg(subnet_id)
.arg(Host::getIdentifierAsText(identifier_type,
identifier_begin,
identifier_len));
host = (*it)->get6(subnet_id, identifier_type,
identifier_begin, identifier_len);
@@ -268,16 +270,18 @@ HostMgr::get6(const SubnetID& subnet_id,
.arg(Host::getIdentifierAsText(identifier_type,
identifier_begin,
identifier_len))
.arg((*it)->getType())
.arg(host->toText());
break;
return (host);
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_RESULTS,
HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER_NULL)
.arg(subnet_id)
.arg(Host::getIdentifierAsText(identifier_type,
identifier_begin,
identifier_len));
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_RESULTS,
HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER_NULL)
.arg(subnet_id)
.arg(Host::getIdentifierAsText(identifier_type, identifier_begin,
identifier_len));
return (host);
}
@@ -285,15 +289,15 @@ ConstHostPtr
HostMgr::get6(const SubnetID& subnet_id,
const asiolink::IOAddress& addr) const {
ConstHostPtr host = getCfgHosts()->get6(subnet_id, addr);
if (host || alternate_sources_.empty()) {
return (host);
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_ADDRESS6)
.arg(subnet_id)
.arg(addr.toText());
for (auto it = alternate_sources_.begin();
it != alternate_sources_.end(); ++it) {
if (host) {
break;
}
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE,
HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_ADDRESS6)
.arg(subnet_id)
.arg(addr.toText());
!host && it != alternate_sources_.end(); ++it) {
host = (*it)->get6(subnet_id, addr);
}
return (host);

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
#
# 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
@@ -134,24 +134,24 @@ subnet id and specific host identifier.
This debug message is issued when no host was found using the specified
subnet id and host identifier.
% HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_ADDRESS4 trying alternate source for host using subnet id %1 and address %2
% HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_ADDRESS4 trying alternate sources for host using subnet id %1 and address %2
This debug message is issued when the Host Manager doesn't find the
host connected to the specific subnet and having the reservation for
the specific IPv4 address, and it is starting to search for this host
in the alternate host data source.
in alternate host data sources.
% HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_HWADDR_DUID trying alternate source for host using subnet id %1, HWADDR %2, DUID%3
% HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_HWADDR_DUID trying alternate sources for host using subnet id %1, HWADDR %2, DUID%3
This debug message is issued when the Host Manager doesn't find the
host connected to the specific subnet and identified by the HW address
or DUID, and it is starting to search for this host in the alternate
host data source.
or DUID, and it is starting to search for this host in alternate
host data sources.
% HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER get one host with IPv4 reservation for subnet id %1, identified by %2
This debug message is issued when starting to retrieve a host holding
IPv4 reservation, which is connected to a specific subnet and
is identified by a specific unique identifier.
% HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER_HOST using subnet id %1 and identifier %2, found host: %3
% HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER_HOST using subnet id %1 and identifier %2, found in %3 host: %4
This debug message includes the details of a host returned by an
alternate hosts data source using a subnet id and specific host
identifier.
@@ -160,32 +160,32 @@ identifier.
This debug message is issued when no host was found using the specified
subnet id and host identifier.
% HOSTS_MGR_ALTERNATE_GET6_PREFIX trying alternate source for host using prefix %1/%2
% HOSTS_MGR_ALTERNATE_GET6_PREFIX trying alternate sources for host using prefix %1/%2
This debug message is issued when the Host Manager doesn't find the
host connected to the specific subnet and having the reservation for
the specified prefix, and it is starting to search for this host in
the alternate host data source.
alternate host data sources.
% HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_ADDRESS6 trying alternate source for host using subnet id %1 and IPv6 address %2
% HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_ADDRESS6 trying alternate sources for host using subnet id %1 and IPv6 address %2
This debug message is issued when the Host Manager doesn't find the
host connected to the specific subnet and having the reservation for
the specified IPv6 address, and it is starting to search for this
host in the alternate host data source.
host in alternate host data sources.
% HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_DUID_HWADDR trying alternate source for host using subnet id %1, DUID %2, HWADDR %3
% HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_DUID_HWADDR trying alternate sources for host using subnet id %1, DUID %2, HWADDR %3
This debug message is issued when the Host Manager doesn't find the
host connected to the specific subnet and identified by the specified
DUID or HW Address, and it is starting to search for this host in the
alternate host data source.
DUID or HW Address, and it is starting to search for this host in
alternate host data sources.
% HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER get one host with IPv6 reservation for subnet id %1, identified by %2
This debug message is issued when starting to retrieve a host holding
IPv4 reservation, which is connected to a specific subnet and
is identified by a specific unique identifier.
% HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER_HOST using subnet id %1 and identifier %2, found host: %3
% HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER_HOST using subnet id %1 and identifier %2, found in %3 host: %4
This debug message includes the details of a host returned by an
alternate hosts data source using a subnet id and specific host
alternate host data source using a subnet id and specific host
identifier.
% HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER_NULL host not found using subnet id %1 and identifier %2