net/igmp and net/mld: Fix problem when both IGMP and MLD are enabled. The cannot share the same group list in the network devices structure.

This commit is contained in:
Gregory Nutt 2018-11-03 07:06:30 -06:00
parent 42a018747e
commit 863f617262
11 changed files with 25 additions and 17 deletions

View file

@ -140,7 +140,7 @@ struct igmp_iphdr_s
/* Router Alert IP header option */
uint16_t ra[2];
uint16_t ra[2]; /* RFC 2113 */
/* IGMPv2 header:
*

View file

@ -344,10 +344,18 @@ struct net_driver_s
uint16_t d_sndlen;
#ifdef CONFIG_NET_MCASTGROUP
/* IGMP/MLD group list */
/* Multicast group support */
sq_queue_t grplist;
#ifdef CONFIG_NET_IGMP
/* IGMP group list */
sq_queue_t d_igmp_grplist;
#endif
#ifdef CONFIG_NET_MCASTGROUP
/* MLD group list */
sq_queue_t d_mld_grplist;
#endif
#ifdef CONFIG_NETDEV_STATISTICS

View file

@ -143,7 +143,7 @@ FAR struct igmp_group_s *igmp_grpalloc(FAR struct net_driver_s *dev,
/* Add the group structure to the list in the device structure */
sq_addfirst((FAR sq_entry_t *)group, &dev->grplist);
sq_addfirst((FAR sq_entry_t *)group, &dev->d_igmp_grplist);
net_unlock();
}
@ -166,7 +166,7 @@ FAR struct igmp_group_s *igmp_grpfind(FAR struct net_driver_s *dev,
grpinfo("Searching for addr %08x\n", (int)*addr);
net_lock();
for (group = (FAR struct igmp_group_s *)dev->grplist.head;
for (group = (FAR struct igmp_group_s *)dev->d_igmp_grplist.head;
group;
group = group->next)
{
@ -225,7 +225,7 @@ void igmp_grpfree(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group)
/* Remove the group structure from the group list in the device structure */
sq_rem((FAR sq_entry_t *)group, &dev->grplist);
sq_rem((FAR sq_entry_t *)group, &dev->d_igmp_grplist);
/* Destroy the wait semaphore */

View file

@ -94,7 +94,7 @@ void igmp_initialize(void)
void igmp_devinit(struct net_driver_s *dev)
{
ninfo("IGMP initializing dev %p\n", dev);
DEBUGASSERT(dev->grplist.head == NULL);
DEBUGASSERT(dev->d_igmp_grplist.head == NULL);
/* Add the all systems address to the group */

View file

@ -196,7 +196,7 @@ void igmp_input(struct net_driver_s *dev)
}
IGMP_STATINCR(g_netstats.igmp.query_received);
for (member = (FAR struct igmp_group_s *)dev->grplist.head;
for (member = (FAR struct igmp_group_s *)dev->d_igmp_grplist.head;
member;
member = member->next)
{

View file

@ -152,7 +152,7 @@ void igmp_poll(FAR struct net_driver_s *dev)
/* Check each member of the group */
for (group = (FAR struct igmp_group_s *)dev->grplist.head;
for (group = (FAR struct igmp_group_s *)dev->d_igmp_grplist.head;
group;
group = group->next)
{

View file

@ -129,7 +129,7 @@ void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group,
dev->d_sndlen = IGMP_HDRLEN;
/* Add the router alert option */
/* Add the router alert option (RFC 2113) */
IGMPBUF->ra[0] = HTONS(IPOPT_RA >> 16);
IGMPBUF->ra[1] = HTONS(IPOPT_RA & 0xffff);

View file

@ -138,7 +138,7 @@ FAR struct mld_group_s *mld_grpalloc(FAR struct net_driver_s *dev,
/* Add the group structure to the list in the device structure */
sq_addfirst((FAR sq_entry_t *)group, &dev->grplist);
sq_addfirst((FAR sq_entry_t *)group, &dev->d_mld_grplist);
net_unlock();
}
@ -161,7 +161,7 @@ FAR struct mld_group_s *mld_grpfind(FAR struct net_driver_s *dev,
grpinfo("Searching for addr %08x\n", (int)*addr);
net_lock();
for (group = (FAR struct mld_group_s *)dev->grplist.head;
for (group = (FAR struct mld_group_s *)dev->d_mld_grplist.head;
group;
group = group->next)
{
@ -227,7 +227,7 @@ void mld_grpfree(FAR struct net_driver_s *dev, FAR struct mld_group_s *group)
/* Remove the group structure from the group list in the device structure */
sq_rem((FAR sq_entry_t *)group, &dev->grplist);
sq_rem((FAR sq_entry_t *)group, &dev->d_mld_grplist);
/* Destroy the wait semaphore */

View file

@ -77,7 +77,7 @@ void mld_initialize(void)
void mld_devinit(struct net_driver_s *dev)
{
ninfo("MLD initializing dev %p\n", dev);
DEBUGASSERT(dev->grplist.head == NULL);
DEBUGASSERT(dev->d_mld_grplist.head == NULL);
/* Add the all nodes address to the group */

View file

@ -156,7 +156,7 @@ void mld_poll(FAR struct net_driver_s *dev)
/* Check each member of the group */
for (group = (FAR struct mld_group_s *)dev->grplist.head;
for (group = (FAR struct mld_group_s *)dev->d_mld_grplist.head;
group;
group = group->next)
{

View file

@ -133,7 +133,7 @@ int mld_query(FAR struct net_driver_s *dev,
ninfo("General multicast query\n");
MLD_STATINCR(g_netstats.mld.gmq_query_received);
for (member = (FAR struct mld_group_s *)dev->grplist.head;
for (member = (FAR struct mld_group_s *)dev->d_mld_grplist.head;
member;
member = member->next)
{