]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3977] Do not generate NCRs for prefix delegation.
authorMarcin Siodelski <marcin@isc.org>
Wed, 21 Oct 2015 10:47:04 +0000 (12:47 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 21 Oct 2015 10:47:04 +0000 (12:47 +0200)
src/lib/dhcpsrv/ncr_generator.cc
src/lib/dhcpsrv/ncr_generator.h
src/lib/dhcpsrv/tests/ncr_generator_unittest.cc

index 4ba96ce7aae20616f4af4426a7894f462210b83f..d4cbfe3d1a2412302f2e0047645488e4fa0afd99 100644 (file)
@@ -101,7 +101,7 @@ void queueNCR(const NameChangeType& chg_type, const Lease4Ptr& lease) {
 
 void queueNCR(const NameChangeType& chg_type, const Lease6Ptr& lease) {
     // DUID is required to generate NCR.
-    if (lease && lease->duid_) {
+    if (lease && (lease->type_ != Lease::TYPE_PD) && lease->duid_) {
         queueNCRCommon(chg_type, lease, *(lease->duid_),
                        Pkt6::makeLabel(lease->duid_, lease->hwaddr_));
     }
index 95f8684dcb8fa721f73fa9765937c048bc7d01a3..6f71c2a6bc309931f44bdb17fb73592e0f137961 100644 (file)
@@ -40,6 +40,9 @@ void queueNCR(const dhcp_ddns::NameChangeType& chg_type, const Lease4Ptr& lease)
 /// in the DHCPv6 lease. The DUID is used to compute the DHCID for the name
 /// change request.
 ///
+/// This function will skip sending the NCR if the lease type is a delegated
+/// prefix.
+///
 /// This function is exception safe. On failure, it logs an error.
 ///
 /// @param chg_type Type of the name change request
index 11c8e4fdfe8d5e207b8e46ca2c4323ce3ad68a7f..521e232ef904a69ca0c9d6945e988f50cbe65440 100644 (file)
@@ -348,6 +348,22 @@ TEST_F(NCRGenerator6Test, wrongHostname) {
     }
 }
 
+// Test that NameChangeRequest is not generated if the lease is not an
+// address lease, i.e. is a prefix.
+TEST_F(NCRGenerator6Test, wrongLeaseType) {
+    // Change lease type to delegated prefix.
+    lease_->type_ = Lease::TYPE_PD;
+
+    {
+        SCOPED_TRACE("case CHG_REMOVE");
+        testNoUpdate(CHG_REMOVE, true, true, "myhost.example.org.");
+    }
+    {
+        SCOPED_TRACE("case CHG_ADD");
+        testNoUpdate(CHG_ADD, true, true, "myhost.example.org.");
+    }
+}
+
 /// @brief Test fixture class implementation for DHCPv4.
 class NCRGenerator4Test : public NCRGeneratorTest<Lease4Ptr> {
 public: