diff options
author | Thomas Markwalder <tmark@isc.org> | 2018-08-07 12:46:30 +0200 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2018-08-07 12:46:30 +0200 |
commit | f1b3b3c76d5080fb1dbccc22231b7ba29af65768 (patch) | |
tree | c745a56e1d09d82955667397297078a4107d847d /src/lib/dhcpsrv/host.cc | |
parent | [5704] Added subnet-id = 0 unit tests to host data sources (diff) | |
download | kea-f1b3b3c76d5080fb1dbccc22231b7ba29af65768.tar.xz kea-f1b3b3c76d5080fb1dbccc22231b7ba29af65768.zip |
[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
Diffstat (limited to 'src/lib/dhcpsrv/host.cc')
-rw-r--r-- | src/lib/dhcpsrv/host.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/dhcpsrv/host.cc b/src/lib/dhcpsrv/host.cc index 0244f23aea..1899e1c6dc 100644 --- a/src/lib/dhcpsrv/host.cc +++ b/src/lib/dhcpsrv/host.cc @@ -595,13 +595,13 @@ Host::toText() const { // Add HW address or DUID. s << getIdentifierAsText(); - // Add IPv4 subnet id if exists (non-zero). - if (ipv4_subnet_id_) { + // Add IPv4 subnet id if exists. + if (ipv4_subnet_id_ != SUBNET_ID_UNUSED) { s << " ipv4_subnet_id=" << ipv4_subnet_id_; } - // Add IPv6 subnet id if exists (non-zero). - if (ipv6_subnet_id_) { + // Add IPv6 subnet id if exists. + if (ipv6_subnet_id_ != SUBNET_ID_UNUSED) { s << " ipv6_subnet_id=" << ipv6_subnet_id_; } |