[spinel] networkInfo may not exist when recovering from RCP failure (#9327)

Current implementation of RestoreProperties() assumes there's always a
networkInfo structure stored in the settings.  But, it's possible the
RCP device needs to be recovered before this structure is populated.

Signed-off-by: Axel Le Bourhis <[email protected]>
This commit is contained in:
Axel Le Bourhis
2023-07-31 11:27:51 -07:00
committed by GitHub
parent a361aebc8b
commit 94822eadb5
2 changed files with 5 additions and 14 deletions
+5 -3
View File
@@ -2143,9 +2143,11 @@ template <typename InterfaceType> void RadioSpinel<InterfaceType>::RestoreProper
if (mInstance != nullptr)
{
SuccessOrDie(static_cast<Instance *>(mInstance)->template Get<Settings>().Read(networkInfo));
SuccessOrDie(
Set(SPINEL_PROP_RCP_MAC_FRAME_COUNTER, SPINEL_DATATYPE_UINT32_S, networkInfo.GetMacFrameCounter()));
if (static_cast<Instance *>(mInstance)->template Get<Settings>().Read(networkInfo) == OT_ERROR_NONE)
{
SuccessOrDie(
Set(SPINEL_PROP_RCP_MAC_FRAME_COUNTER, SPINEL_DATATYPE_UINT32_S, networkInfo.GetMacFrameCounter()));
}
}
for (int i = 0; i < mSrcMatchShortEntryCount; ++i)
@@ -54,17 +54,6 @@ puts "RCP PID: $rcp_pid"
try {
puts "Before enabling"
spawn_node 1 "rcp" "spinel+hdlc_uart://$host_pty"
exec kill $rcp_pid
puts "Killed $rcp_pid"
sleep 1
set rcp_pid [exec $::env(OT_SIMULATION_APPS)/ncp/ot-rcp 1 < $radio_pty > $radio_pty &]
puts "RCP PID: $rcp_pid"
expect eof
puts "Queued parent-to-child packets, as parent"
spawn_node 1 "rcp" "spinel+hdlc_uart://$host_pty"