isc_throw(isc::dhcp_ddns::DhcidRdataComputeError,
"unable to compute DHCID from the HW address, "
"NULL pointer has been specified");
+ } else if (hwaddr->hwaddr_.empty()) {
+ isc_throw(isc::dhcp_ddns::DhcidRdataComputeError,
+ "unable to compute DHCID from the HW address, "
+ "HW address is empty");
}
- createDigest(DHCID_ID_HWADDR, hwaddr->hwaddr_, wire_fqdn);
+ std::vector<uint8_t> hwaddr_data;
+ hwaddr_data.push_back(hwaddr->htype_);
+ hwaddr_data.insert(hwaddr_data.end(), hwaddr->hwaddr_.begin(),
+ hwaddr->hwaddr_.end());
+ createDigest(DHCID_ID_HWADDR, hwaddr_data, wire_fqdn);
}
// The reference DHCID (represented as string of hexadecimal digits)
// has been calculated using one of the online calculators.
- std::string dhcid_ref = "0000012191B7B21AF97E0E656DF887C5E2D"
- "EF30E7758A207EDF4CCB2DE8CA37066021C";
+ std::string dhcid_ref = "0000012247F6DC4423C3E8627434A9D686860"
+ "9D88948F78018B215EDCAA30C0C135035";
// Make sure that the DHCID is valid.
EXPECT_EQ(dhcid_ref, dhcid.toStr());