Squashed commit of the following:

net/mld:  Fix a couple of places where I forgot to unlock the network in the previous commit.

    net/mld:  Implement 'Other Querier Present Timer'.  This timer is used to revert to Querier mode if there is no other querier on the network.  Also, fix some naming:  The Done message is not just Version 1 but is used with Version 2 as well.

    net/igmp:  Back out some blind, backported improvements to IGMP from MLD.  There are too many subtle differences in the protocols for this to be safe.
This commit is contained in:
Gregory Nutt
2018-11-07 10:39:51 -06:00
parent 5f09e6fd04
commit 02f83334d5
12 changed files with 130 additions and 196 deletions
+5 -82
View File
@@ -137,33 +137,17 @@ void igmp_input(struct net_driver_s *dev)
return;
}
/* Find the group (or create a new one) using the incoming IP address.
* If we are not a router (and I assume we are not), then can ignore
* querys for and reports from groups that we are not a member of.
*
* REVISIT: Router support is not yet implemented.
*/
/* Find the group (or create a new one) using the incoming IP address. */
destipaddr = net_ip4addr_conv32(IGMPBUF->destipaddr);
#ifdef CONFIG_IGMP_ROUTER
group = igmp_grpallocfind(dev, &destipaddr);
if (group == NULL)
{
nerr("ERROR: Failed to allocate group: %08x\n", destipaddr);
nerr("ERROR: Failed to find/allocate group: %08x\n", destipaddr);
return;
}
#else
group = igmp_grpfind(dev, &destipaddr);
if (group == NULL)
{
nwarn("WARNING: Ignoring group. We are not a member: %08x\n",
destipaddr);
return;
}
#endif
/* Now handle the message based on the IGMP message type */
switch (IGMPBUF->type)
@@ -200,7 +184,6 @@ void igmp_input(struct net_driver_s *dev)
if (IGMPBUF->grpaddr == 0)
{
FAR struct igmp_group_s *member;
bool rptsent = false;
/* This is the general query */
@@ -215,10 +198,6 @@ void igmp_input(struct net_driver_s *dev)
IGMP_STATINCR(g_netstats.igmp.query_received);
/* Two passes through the member list. On the first, just
* perform IDLE member checks.
*/
for (member = (FAR struct igmp_group_s *)dev->d_igmp_grplist.head;
member;
member = member->next)
@@ -236,42 +215,6 @@ void igmp_input(struct net_driver_s *dev)
}
}
}
/* On the second time through, we send the Report in
* response to the query. This has to be done twice because
* because there is only a single packet buffer that is used
* for both incoming and outgoing packets. When the report
* is sent, it will clobber the incoming query. Any attempt
* to send an additional Report would also clobber a preceding
* report
*
* REVISIT: This is a design flaw: Only a single report can
* be sent in this context because there is no mechanism to
* preserve the incoming request nor to queue multiple
* outgoing reports.
*/
for (member = (FAR struct igmp_group_s *)dev->d_igmp_grplist.head;
member;
member = member->next)
{
/* Skip over the all systems group entry */
if (!net_ipv4addr_cmp(member->grpaddr, g_ipv4_allsystems))
{
/* Send one REPORT and break out of the loop. */
igmp_send(dev, member, &member->grpaddr,
IGMPv2_MEMBERSHIP_REPORT);
rptsent = true;
break;
}
}
if (!rptsent)
{
goto noresponse;
}
}
else /* if (IGMPBUF->grpaddr != 0) */
{
@@ -284,7 +227,7 @@ void igmp_input(struct net_driver_s *dev)
IGMP_STATINCR(g_netstats.igmp.ucast_query);
grpaddr = net_ip4addr_conv32(IGMPBUF->grpaddr);
group = igmp_grpfind(dev, &grpaddr);
group = igmp_grpallocfind(dev, &grpaddr);
if (group != NULL)
{
@@ -295,15 +238,6 @@ void igmp_input(struct net_driver_s *dev)
igmp_startticks(group, ticks);
CLR_IDLEMEMBER(group->flags);
}
/* Send the REPORT */
igmp_send(dev, group, &group->grpaddr,
IGMPv2_MEMBERSHIP_REPORT);
}
else
{
goto noresponse;
}
}
}
@@ -323,11 +257,6 @@ void igmp_input(struct net_driver_s *dev)
igmp_startticks(group, ticks);
CLR_IDLEMEMBER(group->flags);
}
/* Send the REPORT */
igmp_send(dev, group, &group->grpaddr,
IGMPv2_MEMBERSHIP_REPORT);
}
break;
@@ -344,22 +273,16 @@ void igmp_input(struct net_driver_s *dev)
SET_IDLEMEMBER(group->flags);
CLR_LASTREPORT(group->flags);
}
goto noresponse;
}
break;
break;
default:
{
nwarn("WARNING: Unexpected msg %02x\n", IGMPBUF->type);
goto noresponse;
}
break;
break;
}
return;
noresponse:
dev->d_len = 0;
return;
}