net/mld: Very that the address of the group that we join is a valid IPv6 multicast address.
This commit is contained in:
parent
9c3e65f15f
commit
5340016104
|
@ -132,6 +132,13 @@ int mld_joingroup(FAR const struct ipv6_mreq *mrec)
|
|||
|
||||
DEBUGASSERT(mrec != NULL);
|
||||
|
||||
/* Assure that the group address is an IPv6 multicast address */
|
||||
|
||||
if (!net_is_addr_mcast(mrec->ipv6mr_multiaddr.s6_addr16))
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Get the device from the interface index. Use the default network device
|
||||
* if an interface index of 0 is provided.
|
||||
*/
|
||||
|
|
|
@ -74,12 +74,15 @@ int mld_report(FAR struct net_driver_s *dev, FAR const net_ipv6addr_t grpaddr)
|
|||
grpaddr[0], grpaddr[1], grpaddr[2], grpaddr[3],
|
||||
grpaddr[4], grpaddr[5], grpaddr[6], grpaddr[7]);
|
||||
|
||||
/* 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
|
||||
* reports from groups that we are not a member of.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_MLD_ROUTER
|
||||
/* Assure that the group address is an IPv6 multicast address */
|
||||
|
||||
if (!net_is_addr_mcast(mrec->ipv6mr_multiaddr.s6_addr16))
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
group = mld_grpallocfind(dev, grpaddr);
|
||||
if (group == NULL)
|
||||
{
|
||||
|
@ -88,6 +91,10 @@ int mld_report(FAR struct net_driver_s *dev, FAR const net_ipv6addr_t grpaddr)
|
|||
}
|
||||
|
||||
#else
|
||||
/* Find the group using the incoming IP address. If we are not a router,
|
||||
* then can ignore reports from groups that we are not a member of.
|
||||
*/
|
||||
|
||||
group = mld_grpfind(dev, grpaddr);
|
||||
if (group == NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue