Commit cafeb725 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3035] Include HW type in the digest when generating DHCID from HW addr.

parent e91d83ea
......@@ -93,8 +93,16 @@ D2Dhcid::fromHWAddr(const isc::dhcp::HWAddrPtr& hwaddr,
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);
}
......
......@@ -549,8 +549,8 @@ TEST_F(DhcidTest, fromHWAddr) {
// 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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment