net/mld: Fix logic error when testing for the case where all members have left. Still does not work. The end result is that the query timer no longer stops. Not when another another querier with a lower IP is present or when all of the members have left. Basically just can't stop querying under any condition.
This commit is contained in:
parent
bfa8c362c6
commit
002f09f2da
|
@ -60,6 +60,40 @@
|
|||
|
||||
#ifdef CONFIG_NET_MLD
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mld_ngroups
|
||||
*
|
||||
* Description:
|
||||
* Return the number of groups joined by applications.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int mld_ngroups(FAR struct net_driver_s *dev)
|
||||
{
|
||||
FAR struct mld_group_s *group;
|
||||
int ngroups;
|
||||
|
||||
/* Count the number of groups in the group list */
|
||||
|
||||
for (group = (FAR struct mld_group_s *)dev->d_mld.grplist.head;
|
||||
group != NULL;
|
||||
group = group->next)
|
||||
{
|
||||
ngroups++;
|
||||
}
|
||||
|
||||
/* REVISIT: Subtract one for the IPv6 allnodes group. Why is this here?
|
||||
* what do we need it for? It was cloned from IGMP and is probably not
|
||||
* needed.
|
||||
*/
|
||||
|
||||
return ngroups - 1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -118,7 +152,7 @@ FAR struct mld_group_s *mld_grpalloc(FAR struct net_driver_s *dev,
|
|||
* group member of the group.
|
||||
*/
|
||||
|
||||
if (dev->d_mld.grplist.head == NULL)
|
||||
if (mld_ngroups(dev) < 1)
|
||||
{
|
||||
mld_start_gentimer(dev, MSEC2TICK(MLD_QUERY_MSEC));
|
||||
}
|
||||
|
@ -240,9 +274,12 @@ void mld_grpfree(FAR struct net_driver_s *dev, FAR struct mld_group_s *group)
|
|||
#ifndef CONFIG_CONFIG_NET_MLD_ROUTER
|
||||
/* If there are no longer any groups, then stop the general query and v1
|
||||
* compatibility timers.
|
||||
*
|
||||
* REVISIT: Does not work. Continues to query after the last group
|
||||
* leaves.
|
||||
*/
|
||||
|
||||
if (dev->d_mld.grplist.head == NULL)
|
||||
if (mld_ngroups(dev) < 1)
|
||||
{
|
||||
wd_cancel(dev->d_mld.gendog);
|
||||
wd_cancel(dev->d_mld.v1dog);
|
||||
|
|
|
@ -92,7 +92,10 @@ void mld_devinit(struct net_driver_s *dev)
|
|||
|
||||
SET_MLD_QUERIER(dev->d_mld.flags);
|
||||
|
||||
/* Add the all nodes address to the group */
|
||||
/* Add the all nodes address to the group
|
||||
* REVISIT: Do we need this? What is it for? It is clone from IGMP and
|
||||
* probably is not relevant here.
|
||||
*/
|
||||
|
||||
(void)mld_grpalloc(dev, g_ipv6_allnodes);
|
||||
|
||||
|
|
Loading…
Reference in New Issue