summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2017-08-03 21:19:00 +0200
committerThomas Markwalder <tmark@isc.org>2017-08-03 21:19:00 +0200
commit44c02f59720e359c0b3eed27c1aa7ec2a36696ca (patch)
treec9b505f247d571a3d87d297caf88a9e3800e663f
parent[5314] Added Pool::toElement() and Pool<4/6>::toElement() (diff)
downloadkea-44c02f59720e359c0b3eed27c1aa7ec2a36696ca.tar.xz
kea-44c02f59720e359c0b3eed27c1aa7ec2a36696ca.zip
[5314] Suppress excluded_prefix when blank in Pool6::toElement()
Pool6::toElement() will only include excluded-prefix if it isn't blank.
-rw-r--r--src/lib/dhcpsrv/subnet.cc6
-rw-r--r--src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc2
2 files changed, 2 insertions, 6 deletions
diff --git a/src/lib/dhcpsrv/subnet.cc b/src/lib/dhcpsrv/subnet.cc
index a5d1b08ae4..a28c0a9cbf 100644
--- a/src/lib/dhcpsrv/subnet.cc
+++ b/src/lib/dhcpsrv/subnet.cc
@@ -657,6 +657,7 @@ Subnet6::toElement() const {
uint8_t len = pdpool->getLength();
pool_map->set("delegated-len",
Element::create(static_cast<int>(len)));
+
// Set excluded prefix
const Option6PDExcludePtr& xopt =
pdpool->getPrefixExcludeOption();
@@ -668,11 +669,8 @@ Subnet6::toElement() const {
uint8_t xlen = xopt->getExcludedPrefixLength();
pool_map->set("excluded-prefix-len",
Element::create(static_cast<int>(xlen)));
- } else {
- pool_map->set("excluded-prefix",
- Element::create(std::string("::")));
- pool_map->set("excluded-prefix-len", Element::create(0));
}
+
// Set user-context
ConstElementPtr context = pdpool->getContext();
if (!isNull(context)) {
diff --git a/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc b/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc
index 5b75ebd245..7572201fe8 100644
--- a/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc
+++ b/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc
@@ -545,8 +545,6 @@ TEST(CfgSubnets6Test, unparsePdPool) {
" \"prefix\": \"2001:db8:2::\",\n"
" \"prefix-len\": 48,\n"
" \"delegated-len\": 64,\n"
- " \"excluded-prefix\": \"::\",\n"
- " \"excluded-prefix-len\": 0,\n"
" \"option-data\": [ ]\n"
" },{\n"
" \"prefix\": \"2001:db8:3::\",\n"