summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/host.cc
diff options
context:
space:
mode:
authorRazvan Becheriu <razvan@isc.org>2023-06-29 09:31:35 +0200
committerRazvan Becheriu <razvan@isc.org>2023-06-29 19:54:14 +0200
commit70f4321e4ca7962a2b9eae102920aee19b46d45f (patch)
treef833dc7adc46467fd7c971a1be890bab324ad064 /src/lib/dhcpsrv/host.cc
parent[#2725] addressed review comments (diff)
downloadkea-70f4321e4ca7962a2b9eae102920aee19b46d45f.tar.xz
kea-70f4321e4ca7962a2b9eae102920aee19b46d45f.zip
[#2725] fixed v6 reservations
Diffstat (limited to 'src/lib/dhcpsrv/host.cc')
-rw-r--r--src/lib/dhcpsrv/host.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lib/dhcpsrv/host.cc b/src/lib/dhcpsrv/host.cc
index 73f4548578..0f9c4212ef 100644
--- a/src/lib/dhcpsrv/host.cc
+++ b/src/lib/dhcpsrv/host.cc
@@ -6,13 +6,15 @@
#include <config.h>
+#include <asiolink/io_address.h>
+#include <asiolink/addr_utilities.h>
+#include <cryptolink/crypto_rng.h>
#include <dhcp/pkt4.h>
#include <dhcpsrv/host.h>
+#include <exceptions/exceptions.h>
+
#include <util/encode/hex.h>
#include <util/strutil.h>
-#include <asiolink/io_address.h>
-#include <cryptolink/crypto_rng.h>
-#include <exceptions/exceptions.h>
#include <sstream>
@@ -104,6 +106,13 @@ IPv6Resrv::set(const Type& type, const asiolink::IOAddress& prefix,
isc_throw(isc::BadValue, "invalid prefix length '"
<< static_cast<int>(prefix_len)
<< "' for reserved IPv6 address, expected 128");
+ } else if ((type == TYPE_PD) && (prefix_len != 128)) {
+ IOAddress first_address = firstAddrInPrefix(prefix, prefix_len);
+ if (first_address != prefix) {
+ isc_throw(BadValue, "Invalid host address boundaries: " << prefix
+ << " is not the first address in prefix: " << first_address
+ << "/" << static_cast<uint32_t>(prefix_len));
+ }
}
type_ = type;