I have a small unsecured network of a coordinator and 18 routers running 2.5.0 of the stack. I'm seeing 1 to 3 nodes showing up in the Associated Device List, when I'm performing a ZDO_IEEE_ADDR_REQ. The 18 routers are maintaining the same network address, so its not the case of the routers leaving the network and returning. When I perform the ZDO_IEEE_ADRS_REQ on one of these unknown nodes, I get no response. I can only guess that this might be a bug or possibly a node from a Zigbee network somewhere in the vicinity.
I added some code that was previously posted to remove stale nodes in the Associated Device List. It is called from a timer and I set the condition to remove a node when its age was greater than 250. If the age is incremented every 15s, then a node would be stale and removed after a little over an hour. Is this the best means to clean up up the table?
void RouterApp_CleanAssocDeviceTable ( void )
{
uint8 _nodeCounter;
for (_nodeCounter = 0; _nodeCounter < NWK_MAX_DEVICES; _nodeCounter++ )
{
if ( ( AssociatedDevList[_nodeCounter].nodeRelation == CHILD_FFD_RX_IDLE ) ||
( AssociatedDevList[_nodeCounter].nodeRelation == CHILD_FFD ) )
{
if ( AssociatedDevList[_nodeCounter].age > 250 )
{
RemoveStaleNode(_nodeCounter);
}
}
}
}
static void RemoveStaleNode( uint8 index )
{
AddrMgrEntry_t addrEntry;
NLME_LeaveReq_t req;
addrEntry.user = ADDRMGR_USER_DEFAULT;
addrEntry.index = index;
if (AddrMgrEntryGet( &addrEntry ))
{
// Remove device
req.extAddr = addrEntry.extAddr;
req.removeChildren = TRUE;
req.rejoin = FALSE;
req.silent = FALSE;
NLME_LeaveReq( &req );
}
}