summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/host_mgr.cc
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2020-09-25 14:12:14 +0200
committerMarcin Siodelski <marcin@isc.org>2020-10-05 15:14:57 +0200
commit99c44ffd314947a20aca781e1a5cc7b58ade0ff4 (patch)
treed53aad88d4f284222a2ba6437da2552d8a1acd40 /src/lib/dhcpsrv/host_mgr.cc
parent[#1418] Fixed ChangeLog number (diff)
downloadkea-99c44ffd314947a20aca781e1a5cc7b58ade0ff4.tar.xz
kea-99c44ffd314947a20aca781e1a5cc7b58ade0ff4.zip
[#1428] Allow non-unique IPs in MySQL and PgSQL
Introduced new host API function which allows for configuring selected backends to accept non-unique IP reservations for multiple hosts. Support for it was added in MySQL, Postgres and Kea config file. It is not supported in Cassandra. New migrations for MySQL and Postgres have been created.
Diffstat (limited to 'src/lib/dhcpsrv/host_mgr.cc')
-rw-r--r--src/lib/dhcpsrv/host_mgr.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/host_mgr.cc b/src/lib/dhcpsrv/host_mgr.cc
index cc70a5bacc..ba043d0316 100644
--- a/src/lib/dhcpsrv/host_mgr.cc
+++ b/src/lib/dhcpsrv/host_mgr.cc
@@ -604,5 +604,26 @@ HostMgr::cacheNegative(const SubnetID& ipv4_subnet_id,
}
}
+bool
+HostMgr::setIPReservationUnique(const bool unique) {
+ // Iterate over the alternate sources first, because they may include those
+ // for which the new setting is not supported.
+ for (auto source : alternate_sources_) {
+ if (!source->setIPReservationUnique(unique)) {
+ // One of the sources does not support this new mode of operation.
+ // Let's log a warning and back off the changes to the default
+ // setting which should always be supported.
+ LOG_WARN(hosts_logger, HOSTS_MGR_NON_UNIQUE_IP_UNSUPPORTED)
+ .arg(source->getType());
+ for (auto source : alternate_sources_) {
+ source->setIPReservationUnique(true);
+ }
+ return (false);
+ }
+ }
+ return (true);
+}
+
+
} // end of isc::dhcp namespace
} // end of isc namespace