Skip to content

Commit

Permalink
[Zephyr] Fix General Diagnostics Hardware Address (#24941)
Browse files Browse the repository at this point in the history
15.4 drivers in Zephyr set EUI-64 as the link-layer address
of the corresponding interface. However, Hardware Address
field in the General Diagnostics cluster is supposed to
return Extended Address for Thread interfaces according to
the specification.

Make sure the diagnostic data provider returns the extended
address for the concerned field.

Signed-off-by: Damian Krolik <[email protected]>
  • Loading branch information
Damian-Nordic authored and pull[bot] committed Jul 6, 2023
1 parent 8d01b45 commit 4205779
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/platform/Zephyr/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,23 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
ifp->offPremiseServicesReachableIPv4.SetNull();
ifp->offPremiseServicesReachableIPv6.SetNull();

CHIP_ERROR error;
uint8_t addressSize;
if (interfaceIterator.GetHardwareAddress(ifp->MacAddress, addressSize, sizeof(ifp->MacAddress)) != CHIP_NO_ERROR)

#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
if (interfaceType == Inet::InterfaceType::Thread)
{
static_assert(OT_EXT_ADDRESS_SIZE <= sizeof(ifp->MacAddress), "Unexpected extended address size");
error = ThreadStackMgr().GetPrimary802154MACAddress(ifp->MacAddress);
addressSize = OT_EXT_ADDRESS_SIZE;
}
else
#endif
{
error = interfaceIterator.GetHardwareAddress(ifp->MacAddress, addressSize, sizeof(ifp->MacAddress));
}

if (error != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "Failed to get network hardware address");
}
Expand Down

0 comments on commit 4205779

Please sign in to comment.