mirror of
https://github.com/espressif/openthread.git
synced 2026-08-22 10:29:52 +00:00
[posix-host] update the function IsSafeToHandleNow() to avoid re-entrant issue (#4407)
mWaitingKey != SPINEL_PROP_LAST_STATUS means the NCP is waiting for a spinel response from RCP. When mWaitingKey is set to SPINEL_PROP_LAST_STATUS and HdlcInterface receives a ChildIdResponse message from RCP,HdlcInterface calls the function Decode() to decode the received HDLC frame. Then the decoded spinel frame is sent to RadioSpinel module. Because the function IsSafeToHandleNow() returns true now, the RadioSpinel sends the received ChildIdResponse frame to up layer immediately. Then the MLE layer calls the function otPlatRadioSetShortAddress() to set short address. The function otPlatRadioSetShortAddress() sends spinel frame MAC_15_4_SADDR to RCP and waits for the spinel response. When the response frame is received, the HdlcInterface calls the function Decode() again, the function Decode() uses previous calculated FCS value to calculate the current received HDLC frame. The wrong FCS value caused the parsing error for the received response frame.
This commit is contained in:
committed by
Jonathan Hui
parent
ef7a230c31
commit
57b0f533bb
@@ -624,8 +624,7 @@ private:
|
||||
*/
|
||||
bool IsSafeToHandleNow(spinel_prop_key_t aKey) const
|
||||
{
|
||||
return !((mWaitingKey != SPINEL_PROP_LAST_STATUS) &&
|
||||
(aKey == SPINEL_PROP_STREAM_RAW || aKey == SPINEL_PROP_MAC_ENERGY_SCAN_RESULT));
|
||||
return !(aKey == SPINEL_PROP_STREAM_RAW || aKey == SPINEL_PROP_MAC_ENERGY_SCAN_RESULT);
|
||||
}
|
||||
|
||||
void HandleNotification(HdlcInterface::RxFrameBuffer &aFrameBuffer);
|
||||
|
||||
Reference in New Issue
Block a user