Tool/software:
There are multiple coordinators in the environment, all of whom have closed the Permit Job. If the router fails to detect the possibility of joining the network, it will crash.
it is. This issue is caused by the function 'bdb_filterNwkDisc'. It can be fixed like this.
void bdb_filterNwkDisc(void)
{
networkDesc_t* pNwkDesc;
uint8_t i = 0;
uint8_t ResultCount = 0, ResultTotal = 0;
pBDBListNwk = nwk_getNwkDescList();
nwk_desc_list_release();
pNwkDesc = pBDBListNwk;
while (pNwkDesc)
{
ResultCount++;
pNwkDesc = pNwkDesc->nextDesc;
}
ResultTotal = ResultCount;
if(pBDBListNwk)
{
pNwkDesc = pBDBListNwk;
if(pNwkDesc)
{
void *nextDesc = pNwkDesc->nextDesc;
// "nextDesc" replace "pNwkDesc->nextDesc" because "pNwkDesc->nextDesc" is not corret after freed, fixed by LuoYiming 2025-03-10
for ( i = 0; i < ResultTotal; i++, pNwkDesc = nextDesc )
{
nextDesc = pNwkDesc->nextDesc; // get the "nextDesc" before "pNwkDesc" is freed, fixed by LuoYiming 2025-03-10
if ( nwk_ExtPANIDValid( ZDO_UseExtendedPANID ) == true )
{
// If the extended Pan ID is commissioned to a non zero value
// Only join the Pan that has match EPID
if ( osal_ExtAddrEqual( ZDO_UseExtendedPANID, pNwkDesc->extendedPANID) == false )
{
//Remove from the list
bdb_nwkDescFree(pNwkDesc);
ResultCount--;
continue;
}
}
else if ( zgConfigPANID != 0xFFFF )
{
// PAN Id is preconfigured. check if it matches
if ( pNwkDesc->panId != zgConfigPANID )
{
//Remove from the list
bdb_nwkDescFree(pNwkDesc);
ResultCount--;
continue;
}
}
if ( pNwkDesc->chosenRouter != _NIB.nwkCoordAddress || _NIB.nwkCoordAddress == INVALID_NODE_ADDR )
{
// check that network is allowing joining
if ( ZSTACK_ROUTER_BUILD )
{
if ( !pNwkDesc->routerCapacity )
{
//Remove from the list
bdb_nwkDescFree(pNwkDesc);
ResultCount--;
continue;
}
}
else if ( ZSTACK_END_DEVICE_BUILD )
{
if ( !pNwkDesc->deviceCapacity )
{
//Remove from the list
bdb_nwkDescFree(pNwkDesc);
ResultCount--;
continue;
}
}
}
// check version of zigbee protocol
if ( pNwkDesc->version != _NIB.nwkProtocolVersion )
continue;
// check version of stack profile, only matching profiles are supported
if ( pNwkDesc->stackProfile != zgStackProfile )
{
//Remove from the list
bdb_nwkDescFree(pNwkDesc);
ResultCount--;
continue;
}
}
}
}
//Notify the application about the remaining valid networks to join
if(pfnFilterNwkDesc)
{
pfnFilterNwkDesc(pBDBListNwk, ResultCount);
}
}