diff options
author | Francis Dupont <fdupont@isc.org> | 2015-05-21 15:23:39 +0200 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2015-05-21 15:23:39 +0200 |
commit | 1fdd6924a600a5b8b9113189fbd33fcf604bec60 (patch) | |
tree | 39652b008e39573ef9191ba9f76a94a875ac19f8 /src/lib/dhcpsrv/cfg_hosts.cc | |
parent | [master] updated git hash (diff) | |
download | kea-1fdd6924a600a5b8b9113189fbd33fcf604bec60.tar.xz kea-1fdd6924a600a5b8b9113189fbd33fcf604bec60.zip |
[3652] handle the IPv4 address already reserved case
Diffstat (limited to 'src/lib/dhcpsrv/cfg_hosts.cc')
-rw-r--r-- | src/lib/dhcpsrv/cfg_hosts.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/cfg_hosts.cc b/src/lib/dhcpsrv/cfg_hosts.cc index 352de873fe..c1dd769ece 100644 --- a/src/lib/dhcpsrv/cfg_hosts.cc +++ b/src/lib/dhcpsrv/cfg_hosts.cc @@ -494,6 +494,18 @@ CfgHosts::add4(const HostPtr& host) { << "' as this host has already been added"); } + // Check if the address is already reserved for the specified IPv4 subnet. + if (!host->getIPv4Reservation().isV4Zero() && + (host->getIPv4SubnetID() > 0) && + get4(host->getIPv4SubnetID(), host->getIPv4Reservation())) { + isc_throw(ReservedAddress, "failed to add new host using the HW" + " address '" << (hwaddr ? hwaddr->toText(false) : "(null)") + << " and DUID '" << (duid ? duid->toText() : "(null)") + << "' to the IPv4 subnet id '" << host->getIPv4SubnetID() + << "' for the address " << host->getIPv4Reservation() + << ": There's already a reservation for this address"); + } + /// @todo This may need further sanity checks. // This is a new instance - add it. |