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_));
}
/// 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
}
}
+// 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: