[nexus] fix IPv6 receive callback setup in node reset (#12845)

This commit updates `Node::Reset()` in the Nexus platform to correctly
set the IPv6 receive callback after the OpenThread `Instance` has been
re-initialized via placement `new`.

Previously, `otIp6SetReceiveCallback()` was called before the new
`Instance` was constructed, meaning the callback registration would
be lost when the instance memory was overwritten. Additionally, the
callback registration now passes the associated `Node` object as the
context.
This commit is contained in:
Abtin Keshavarzian
2026-04-06 23:46:21 -05:00
committed by GitHub
parent 5735726616
commit 754eefabb6
+2 -1
View File
@@ -43,7 +43,6 @@ void Node::Reset(void)
mInfraIf.mPendingTxQueue.DequeueAndFreeAll();
mPendingTasklet = false;
otIp6SetReceiveCallback(&GetInstance(), HandleIp6Receive, &GetInstance());
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
mTrel.Reset();
#endif
@@ -53,6 +52,8 @@ void Node::Reset(void)
instance = new (instance) Instance();
instance->SetId(id);
instance->AfterInit();
otIp6SetReceiveCallback(instance, Node::HandleIp6Receive, this);
}
void Node::Form(void)