mirror of
https://github.com/espressif/openthread.git
synced 2026-08-18 08:29:52 +00:00
[mac] change address filter and seek function to accept frame without PAN ID (#5389)
In 802.15.4-2015 spec Table 7-2, it is possible to receive frame with destination address but without destination PAN ID. This commit changes the address filter function to avoid dropping such frames.
This commit is contained in:
@@ -39,7 +39,7 @@ bool otMacFrameDoesAddrMatch(const otRadioFrame *aFrame,
|
||||
const otExtAddress *aExtAddress)
|
||||
{
|
||||
const Mac::Frame &frame = *static_cast<const Mac::Frame *>(aFrame);
|
||||
bool rval = false;
|
||||
bool rval = true;
|
||||
Mac::Address dst;
|
||||
Mac::PanId panid;
|
||||
|
||||
@@ -48,22 +48,20 @@ bool otMacFrameDoesAddrMatch(const otRadioFrame *aFrame,
|
||||
switch (dst.GetType())
|
||||
{
|
||||
case Mac::Address::kTypeShort:
|
||||
SuccessOrExit(frame.GetDstPanId(panid));
|
||||
rval = (panid == Mac::kPanIdBroadcast || panid == aPanId) &&
|
||||
(dst.GetShort() == Mac::kShortAddrBroadcast || dst.GetShort() == aShortAddress);
|
||||
VerifyOrExit(dst.GetShort() == Mac::kShortAddrBroadcast || dst.GetShort() == aShortAddress, rval = false);
|
||||
break;
|
||||
|
||||
case Mac::Address::kTypeExtended:
|
||||
SuccessOrExit(frame.GetDstPanId(panid));
|
||||
rval = (panid == Mac::kPanIdBroadcast || panid == aPanId) &&
|
||||
dst.GetExtended() == *static_cast<const Mac::ExtAddress *>(aExtAddress);
|
||||
VerifyOrExit(dst.GetExtended() == *static_cast<const Mac::ExtAddress *>(aExtAddress), rval = false);
|
||||
break;
|
||||
|
||||
case Mac::Address::kTypeNone:
|
||||
rval = true;
|
||||
break;
|
||||
}
|
||||
|
||||
SuccessOrExit(frame.GetDstPanId(panid));
|
||||
VerifyOrExit(panid == Mac::kPanIdBroadcast || panid == aPanId, rval = false);
|
||||
|
||||
exit:
|
||||
return rval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user