mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-02 15:05:16 +00:00
[5022] Options can only be specified for DHCPv6 pools.
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <netinet/in.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ public:
|
|||||||
/// @param pools storage container in which to store the parsed pool
|
/// @param pools storage container in which to store the parsed pool
|
||||||
/// upon "commit"
|
/// upon "commit"
|
||||||
Pool4Parser(const std::string& param_name, PoolStoragePtr pools)
|
Pool4Parser(const std::string& param_name, PoolStoragePtr pools)
|
||||||
:PoolParser(param_name, pools) {
|
:PoolParser(param_name, pools, AF_INET) {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <netinet/in.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -78,7 +79,7 @@ public:
|
|||||||
/// @param pools storage container in which to store the parsed pool
|
/// @param pools storage container in which to store the parsed pool
|
||||||
/// upon "commit"
|
/// upon "commit"
|
||||||
Pool6Parser(const std::string& param_name, PoolStoragePtr pools)
|
Pool6Parser(const std::string& param_name, PoolStoragePtr pools)
|
||||||
:PoolParser(param_name, pools) {
|
:PoolParser(param_name, pools, AF_INET6) {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -1039,8 +1039,10 @@ void PoolsListParser::commit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//****************************** PoolParser ********************************
|
//****************************** PoolParser ********************************
|
||||||
PoolParser::PoolParser(const std::string&, PoolStoragePtr pools)
|
PoolParser::PoolParser(const std::string&, PoolStoragePtr pools,
|
||||||
:pools_(pools), options_(new CfgOption()) {
|
const uint16_t address_family)
|
||||||
|
:pools_(pools), options_(new CfgOption()),
|
||||||
|
address_family_(address_family) {
|
||||||
|
|
||||||
if (!pools_) {
|
if (!pools_) {
|
||||||
isc_throw(isc::dhcp::DhcpConfigError, "parser logic error: "
|
isc_throw(isc::dhcp::DhcpConfigError, "parser logic error: "
|
||||||
@@ -1124,9 +1126,15 @@ PoolParser::build(ConstElementPtr pool_structure) {
|
|||||||
ConstElementPtr option_data = pool_structure->get("option-data");
|
ConstElementPtr option_data = pool_structure->get("option-data");
|
||||||
if (option_data) {
|
if (option_data) {
|
||||||
try {
|
try {
|
||||||
|
// Currently we don't support specifying options for the DHCPv4 server.
|
||||||
|
if (address_family_ == AF_INET) {
|
||||||
|
isc_throw(DhcpConfigError, "option-data is not supported for DHCPv4"
|
||||||
|
" address pools");
|
||||||
|
}
|
||||||
|
|
||||||
OptionDataListParserPtr option_parser(new OptionDataListParser("option-data",
|
OptionDataListParserPtr option_parser(new OptionDataListParser("option-data",
|
||||||
options_,
|
options_,
|
||||||
AF_INET6));
|
address_family_));
|
||||||
option_parser->build(option_data);
|
option_parser->build(option_data);
|
||||||
option_parser->commit();
|
option_parser->commit();
|
||||||
options_->copyTo(*pool->getCfgOption());;
|
options_->copyTo(*pool->getCfgOption());;
|
||||||
|
@@ -835,8 +835,10 @@ public:
|
|||||||
/// accept string as first argument.
|
/// accept string as first argument.
|
||||||
/// @param pools is the storage in which to store the parsed pool
|
/// @param pools is the storage in which to store the parsed pool
|
||||||
/// upon "commit".
|
/// upon "commit".
|
||||||
|
/// @param address_family AF_INET (for DHCPv4) or AF_INET6 (for DHCPv6).
|
||||||
/// @throw isc::dhcp::DhcpConfigError if storage is null.
|
/// @throw isc::dhcp::DhcpConfigError if storage is null.
|
||||||
PoolParser(const std::string& dummy, PoolStoragePtr pools);
|
PoolParser(const std::string& dummy, PoolStoragePtr pools,
|
||||||
|
const uint16_t address_family);
|
||||||
|
|
||||||
/// @brief parses the actual structure
|
/// @brief parses the actual structure
|
||||||
///
|
///
|
||||||
@@ -882,6 +884,9 @@ protected:
|
|||||||
|
|
||||||
/// A storage for pool specific option values.
|
/// A storage for pool specific option values.
|
||||||
CfgOptionPtr options_;
|
CfgOptionPtr options_;
|
||||||
|
|
||||||
|
/// @brief Address family: AF_INET (for DHCPv4) or AF_INET6 for DHCPv6.
|
||||||
|
uint16_t address_family_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Parser for a list of pools
|
/// @brief Parser for a list of pools
|
||||||
|
Reference in New Issue
Block a user