From 19cb752ada55ad9de4ffc75eaf3af8241c3a48ea Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Mon, 5 Oct 2020 17:39:33 +0300 Subject: [PATCH] [#1454] fix PDExclude fields in example JSONs excluded prefix length should be higher in value (smaller in address space) --- doc/examples/kea6/advanced.json | 2 +- doc/examples/kea6/all-keys-netconf.json | 2 +- doc/examples/kea6/all-keys.json | 2 +- src/lib/dhcp/option6_pdexclude.cc | 2 +- src/lib/dhcpsrv/pool.cc | 7 ++++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/examples/kea6/advanced.json b/doc/examples/kea6/advanced.json index 1830f32d62..7b543e1c07 100644 --- a/doc/examples/kea6/advanced.json +++ b/doc/examples/kea6/advanced.json @@ -133,7 +133,7 @@ "prefix-len": 48, "delegated-len": 64, "excluded-prefix": "2001:db8:abcd:1234::", - "excluded-prefix-len": 62, + "excluded-prefix-len": 72, // Another user-context for this PD pool. Again, you can put // anything you want in there as long as it's valid JSON and diff --git a/doc/examples/kea6/all-keys-netconf.json b/doc/examples/kea6/all-keys-netconf.json index 4b4230de85..eb16357c2e 100644 --- a/doc/examples/kea6/all-keys-netconf.json +++ b/doc/examples/kea6/all-keys-netconf.json @@ -596,7 +596,7 @@ "excluded-prefix": "2001:db8::", // Excluded prefix (length) from client assignments. - "excluded-prefix-len": 48, + "excluded-prefix-len": 72, // Prefix pool level list of DHCP options. "option-data": [], diff --git a/doc/examples/kea6/all-keys.json b/doc/examples/kea6/all-keys.json index 324b4e7a83..8bfab736ce 100644 --- a/doc/examples/kea6/all-keys.json +++ b/doc/examples/kea6/all-keys.json @@ -737,7 +737,7 @@ "excluded-prefix": "2001:db8::", // Excluded prefix (length) from client assignments. - "excluded-prefix-len": 48, + "excluded-prefix-len": 72, // Prefix pool level list of DHCP options. "option-data": [], diff --git a/src/lib/dhcp/option6_pdexclude.cc b/src/lib/dhcp/option6_pdexclude.cc index 951b3f117f..977390220b 100644 --- a/src/lib/dhcp/option6_pdexclude.cc +++ b/src/lib/dhcp/option6_pdexclude.cc @@ -44,7 +44,7 @@ Option6PDExclude::Option6PDExclude(const isc::asiolink::IOAddress& delegated_pre << static_cast(excluded_prefix_length_)); } - // Excluded prefix must be longer than the delegated prefix. + // Excluded prefix must be longer than or equal to the delegated prefix. if (excluded_prefix_length_ <= delegated_prefix_length) { isc_throw(BadValue, "length of the excluded prefix " << excluded_prefix << "/" diff --git a/src/lib/dhcpsrv/pool.cc b/src/lib/dhcpsrv/pool.cc index 4cbd620042..518b79f0b3 100644 --- a/src/lib/dhcpsrv/pool.cc +++ b/src/lib/dhcpsrv/pool.cc @@ -309,9 +309,10 @@ Pool6::init(const Lease::Type& type, // excluded_prefix_len == 0 means there's no excluded prefix at all. if (excluded_prefix_len && (excluded_prefix_len < delegated_len)) { - isc_throw(BadValue, "Excluded prefix (" << static_cast(excluded_prefix_len) - << ") must be longer than the delegated prefix length (" - << static_cast(delegated_len)); + isc_throw(BadValue, "Excluded prefix (" + << static_cast(excluded_prefix_len) + << ") must be longer than or equal to the delegated prefix length (" + << static_cast(delegated_len) << ")"); } /// @todo: We should probably implement checks against weird addresses