mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-16 20:55:18 +00:00
[5704] host backends and kea-dhcp4/6 support global HR storage
- Added constants for special SubnetIDs: SUBNET_ID_GLOBAL, SUBNET_ID_MAX, SUBNET_ID_UNUSED - Modified code throughout to use these constants, rather than hard-coded values. Note, MySQL and PostgreSQL host backends convert from NULL to UNUSED and back. - kea-dhcp4/6 servers will now parse a "reservations" element at the global level. src/lib/dhcpsrv/subnet_id.h Added constants SubnetID SUBNET_ID_GLOBAL, SUBNET_ID_MAX, SUBNET_ID_UNUSED src/bin/dhcp4/dhcp4_lexer.ll src/bin/dhcp4/dhcp4_parser.yy src/bin/dhcp4/json_config_parser.cc kea-dhcp4 parsing now handles reservations as a global element src/bin/dhcp4/tests/config_parser_unittest.cc TEST_F(Dhcp4ParserTest, globalReservations) - new test to verify global HR parsing src/bin/dhcp4/tests/dora_unittest.cc src/lib/dhcpsrv/cfg_hosts.cc src/lib/dhcpsrv/host.cc src/lib/dhcpsrv/host_mgr.cc src/lib/dhcpsrv/mysql_host_data_source.cc src/lib/dhcpsrv/parsers/host_reservation_parser.cc src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc src/lib/dhcpsrv/tests/alloc_engine_utils.cc src/lib/dhcpsrv/tests/host_mgr_unittest.cc src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc src/lib/dhcpsrv/tests/host_reservations_list_parser_unittest.cc src/lib/dhcpsrv/tests/host_unittest.cc Replaced SubnetID 0 with SUBNET_ID_UNUSED src/lib/dhcpsrv/srv_config.cc SrvConfig::toElement() - added global reservations output src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc TEST_F(CfgHostsTest, globalSubnetIDs) TEST_F(CfgHostsTest, unusedSubnetIDs) - new tests src/lib/dhcpsrv/tests/host_unittest.cc Replaced SubnetID 0 with SUBNET_ID_UNUSED TEST_F(HostTest, toText) - updated to verify global ID output src/lib/dhcpsrv/tests/mysql_host_data_source_unittest.cc TEST_F(MySqlHostDataSourceTest, globalSubnetId4) TEST_F(MySqlHostDataSourceTest, globalSubnetId6) - new tests src/lib/dhcpsrv/tests/srv_config_unittest.cc TEST_F(SrvConfigTest, unparseHR) - added global HRs src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.* GenericHostDataSourceTest::testGlobalSubnetId4() GenericHostDataSourceTest::testGlobalSubnetId6() src/bin/dhcp6/dhcp6_lexer.ll src/bin/dhcp6/dhcp6_parser.yy src/bin/dhcp6/json_config_parser.cc kea-dhcp6 now parses reservations as a global element src/bin/dhcp6/tests/config_parser_unittest.cc TEST_F(Dhcp6ParserTest, globalReservations) - new test
This commit is contained in:
@@ -129,7 +129,8 @@ public:
|
||||
bind_(columns_num_), columns_(columns_num_),
|
||||
error_(columns_num_, MLM_FALSE), host_id_(0),
|
||||
dhcp_identifier_length_(0), dhcp_identifier_type_(0),
|
||||
dhcp4_subnet_id_(0), dhcp6_subnet_id_(0), ipv4_address_(0),
|
||||
dhcp4_subnet_id_(SUBNET_ID_UNUSED),
|
||||
dhcp6_subnet_id_(SUBNET_ID_UNUSED), ipv4_address_(0),
|
||||
hostname_length_(0), dhcp4_client_classes_length_(0),
|
||||
dhcp6_client_classes_length_(0),
|
||||
user_context_length_(0),
|
||||
@@ -312,7 +313,7 @@ public:
|
||||
// Can't take an address of intermediate object, so let's store it
|
||||
// in dhcp4_subnet_id_
|
||||
dhcp4_subnet_id_ = host->getIPv4SubnetID();
|
||||
dhcp4_subnet_id_null_ = host->getIPv4SubnetID() == 0 ? MLM_TRUE : MLM_FALSE;
|
||||
dhcp4_subnet_id_null_ = host->getIPv4SubnetID() == SUBNET_ID_UNUSED ? MLM_TRUE : MLM_FALSE;
|
||||
bind_[3].buffer_type = MYSQL_TYPE_LONG;
|
||||
bind_[3].buffer = reinterpret_cast<char*>(&dhcp4_subnet_id_);
|
||||
bind_[3].is_unsigned = MLM_TRUE;
|
||||
@@ -322,7 +323,7 @@ public:
|
||||
// Can't take an address of intermediate object, so let's store it
|
||||
// in dhcp6_subnet_id_
|
||||
dhcp6_subnet_id_ = host->getIPv6SubnetID();
|
||||
dhcp6_subnet_id_null_ = host->getIPv6SubnetID() == 0 ? MLM_TRUE : MLM_FALSE;
|
||||
dhcp6_subnet_id_null_ = host->getIPv6SubnetID() == SUBNET_ID_UNUSED ? MLM_TRUE : MLM_FALSE;
|
||||
bind_[4].buffer_type = MYSQL_TYPE_LONG;
|
||||
bind_[4].buffer = reinterpret_cast<char*>(&dhcp6_subnet_id_);
|
||||
bind_[4].is_unsigned = MLM_TRUE;
|
||||
@@ -571,14 +572,14 @@ public:
|
||||
|
||||
// Set DHCPv4 subnet ID to the value returned. If NULL returned,
|
||||
// set to 0.
|
||||
SubnetID ipv4_subnet_id(0);
|
||||
SubnetID ipv4_subnet_id(SUBNET_ID_UNUSED);
|
||||
if (dhcp4_subnet_id_null_ == MLM_FALSE) {
|
||||
ipv4_subnet_id = static_cast<SubnetID>(dhcp4_subnet_id_);
|
||||
}
|
||||
|
||||
// Set DHCPv6 subnet ID to the value returned. If NULL returned,
|
||||
// set to 0.
|
||||
SubnetID ipv6_subnet_id(0);
|
||||
SubnetID ipv6_subnet_id(SUBNET_ID_UNUSED);
|
||||
if (dhcp6_subnet_id_null_ == MLM_FALSE) {
|
||||
ipv6_subnet_id = static_cast<SubnetID>(dhcp6_subnet_id_);
|
||||
}
|
||||
@@ -1742,7 +1743,7 @@ public:
|
||||
: type_(0), value_len_(0), formatted_value_len_(0), space_(),
|
||||
space_len_(0), persistent_(false), user_context_(),
|
||||
user_context_len_(0), client_class_(), client_class_len_(0),
|
||||
subnet_id_(0), host_id_(0), option_() {
|
||||
subnet_id_(SUBNET_ID_UNUSED), host_id_(0), option_() {
|
||||
|
||||
BOOST_STATIC_ASSERT(9 < OPTION_COLUMNS);
|
||||
}
|
||||
|
Reference in New Issue
Block a user