Hello Experts,
I'm using the CC2530EB board and ZStack of version 2.5. I setup a simple environment with a coordinator and an end device to test the leaving procedure with the following steps:
1. Start the coordinator and let the end device join it successfully
2. Press a key to make the end device call my test_zdo_leave(void) function to register a leave-confirm-callback function and send a NLME-Leave.request.
3. After a while press another key to call a function to send some data to the Coordinator
4. Coordinator received the data.
During step2 the Coordinator will trigger the functions: ZDO_LeaveInd()-->ZDApp_LeaveUpdate()-->NLME_RemoveChild(). And since the end device registered a leave-confirm-callback function leave_confirm() and its return value is not NULL hence ZDO_LeaveCnf() callback will not call ZDApp_LeaveReset() to restart the end device that makes a chance in step3 to send data.
My question is why coordinator device can receive data from the leaved end device? I studied the zigbee spec and found no description about this issue, according to my understand this behavior is not reasonable and may cause security problems. Here is my code,thanks!
static ZStatus_t do_leave(void)
{
NLME_LeaveReq_t req;
osal_memset(&req, 0, sizeof(req));
return NLME_LeaveReq(&req);
}
static void *leave_confirm(void *pParam)
{
return (void*)(1);
}
static void test_zdo_leave(void)
{
ZDO_RegisterForZdoCB(ZDO_LEAVE_CNF_CBID, leave_confirm);
do_leave();
}