]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[801-cb-adding-basic-ipv6-subnet-results-in-0-lifetimes] Rewrote the new subnet6... 801-cb-adding-basic-ipv6-subnet-results-in-0-lifetimes
authorFrancis Dupont <fdupont@isc.org>
Wed, 7 Aug 2019 13:24:56 +0000 (15:24 +0200)
committerTomek Mrugalski <tomek@isc.org>
Wed, 7 Aug 2019 16:27:14 +0000 (12:27 -0400)
src/lib/dhcpsrv/parsers/dhcp_parsers.cc

index 8d7fc4f7c79e25ef5d3b1ea9a79ce0ad3877c48b..a9c20aa85e378ef7e048b89e8568fa51478f542b 100644 (file)
@@ -29,6 +29,7 @@
 #include <map>
 #include <string>
 #include <vector>
+#include <iomanip>
 
 using namespace std;
 using namespace isc::asiolink;
@@ -1198,16 +1199,6 @@ Subnet6ConfigParser::initSubnet(data::ConstElementPtr params,
                                    subnet_id);
     subnet_.reset(subnet6);
 
-    std::ostringstream output;
-    output << addr << "/" << static_cast<int>(len)
-           << " with params "
-           << " preferred-lifetime=" << pref.get()
-           << ", valid-lifetime=" << subnet6->getValid().get()
-           << ", rapid-commit is " << (rapid_commit ? "enabled" : "disabled");
-
-
-    LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_NEW_SUBNET6).arg(output.str());
-
     // Parse timers that are common for v4 and v6.
     NetworkPtr network = boost::dynamic_pointer_cast<Network>(subnet_);
     parseCommonTimers(params, network);
@@ -1217,6 +1208,28 @@ Subnet6ConfigParser::initSubnet(data::ConstElementPtr params,
         subnet6->setRapidCommit(rapid_commit);
     }
 
+    std::ostringstream output;
+    output << addr << "/" << static_cast<int>(len) << " with params: ";
+    // t1 and t2 are optional may be not specified.
+    if (!subnet6->getT1().unspecified()) {
+        output << "t1=" << subnet6->getT1().get() << ", ";
+    }
+    if (!subnet6->getT2().unspecified()) {
+        output << "t2=" << subnet6->getT2().get() << ", ";
+    }
+    if (!subnet6->getPreferred().unspecified()) {
+        output << "preferred-lifetime=" << subnet6->getPreferred().get() << ", ";
+    }
+    if (!subnet6->getValid().unspecified()) {
+        output << "valid-lifetime=" << subnet6->getValid().get();
+    }
+    if (!subnet6->getRapidCommit().unspecified()) {
+        output << ", rapid-commit is "
+               << boolalpha << subnet6->getRapidCommit().get();
+    }
+
+    LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_NEW_SUBNET6).arg(output.str());
+
     // Get interface-id option content. For now we support string
     // representation only
     Optional<std::string> ifaceid;