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
+1 -1
View File
@@ -140,7 +140,7 @@ struct igmp_iphdr_s
/* Router Alert IP header option */ /* Router Alert IP header option */
uint16_t ra[2]; uint16_t ra[2]; /* RFC 2113 */
/* IGMPv2 header: /* IGMPv2 header:
* *
+11 -3
View File
@@ -344,10 +344,18 @@ struct net_driver_s
uint16_t d_sndlen; uint16_t d_sndlen;
#ifdef CONFIG_NET_MCASTGROUP /* Multicast group support */
/* IGMP/MLD group list */
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 #endif
#ifdef CONFIG_NETDEV_STATISTICS #ifdef CONFIG_NETDEV_STATISTICS
+3 -3
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 */ /* 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(); 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); grpinfo("Searching for addr %08x\n", (int)*addr);
net_lock(); 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 = group->next) 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 */ /* 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 */ /* Destroy the wait semaphore */
+1 -1
View File
@@ -94,7 +94,7 @@ void igmp_initialize(void)
void igmp_devinit(struct net_driver_s *dev) void igmp_devinit(struct net_driver_s *dev)
{ {
ninfo("IGMP initializing dev %p\n", 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 */ /* Add the all systems address to the group */
+1 -1
View File
@@ -196,7 +196,7 @@ void igmp_input(struct net_driver_s *dev)
} }
IGMP_STATINCR(g_netstats.igmp.query_received); 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 = member->next) member = member->next)
{ {
+1 -1
View File
@@ -152,7 +152,7 @@ void igmp_poll(FAR struct net_driver_s *dev)
/* Check each member of the group */ /* 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 = group->next) group = group->next)
{ {
+1 -1
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; 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[0] = HTONS(IPOPT_RA >> 16);
IGMPBUF->ra[1] = HTONS(IPOPT_RA & 0xffff); IGMPBUF->ra[1] = HTONS(IPOPT_RA & 0xffff);
+3 -3
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 */ /* 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(); 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); grpinfo("Searching for addr %08x\n", (int)*addr);
net_lock(); 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 = group->next) 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 */ /* 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 */ /* Destroy the wait semaphore */
+1 -1
View File
@@ -77,7 +77,7 @@ void mld_initialize(void)
void mld_devinit(struct net_driver_s *dev) void mld_devinit(struct net_driver_s *dev)
{ {
ninfo("MLD initializing dev %p\n", 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 */ /* Add the all nodes address to the group */
+1 -1
View File
@@ -156,7 +156,7 @@ void mld_poll(FAR struct net_driver_s *dev)
/* Check each member of the group */ /* 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 = group->next) group = group->next)
{ {
+1 -1
View File
@@ -133,7 +133,7 @@ int mld_query(FAR struct net_driver_s *dev,
ninfo("General multicast query\n"); ninfo("General multicast query\n");
MLD_STATINCR(g_netstats.mld.gmq_query_received); 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 = member->next) member = member->next)
{ {