From 754eefabb6891b9676097baa81fb5d8790f277da Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Mon, 6 Apr 2026 21:46:21 -0700 Subject: [PATCH] [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. --- tests/nexus/platform/nexus_node.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/nexus/platform/nexus_node.cpp b/tests/nexus/platform/nexus_node.cpp index 46511f6f0..a149c2443 100644 --- a/tests/nexus/platform/nexus_node.cpp +++ b/tests/nexus/platform/nexus_node.cpp @@ -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)