[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:
Jintao Lin
2020-08-17 22:34:38 -07:00
committed by GitHub
parent 5e34b5062d
commit 3f38068a71
5 changed files with 85 additions and 68 deletions
+6 -8
View File
@@ -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;
}