mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
Merged in antmerlino/nuttx/multicast-fix (pull request #739)
Fixes logic in ipv6_input to handle more than ff02::/16 multicast addresses. Don't forward mcast packets if scope is not appropriate Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
committed by
GregoryN
parent
1adfef8113
commit
4898c477a9
+14
-5
@@ -309,17 +309,26 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
|||||||
* address yet assigned to the device). We should actually pick off
|
* address yet assigned to the device). We should actually pick off
|
||||||
* certain multicast address (all hosts multicast address, and the
|
* certain multicast address (all hosts multicast address, and the
|
||||||
* solicited-node multicast address). We will cheat here and accept
|
* solicited-node multicast address). We will cheat here and accept
|
||||||
* all multicast packets that are sent to the ff02::/16 addresses.
|
* all multicast packets that are sent to the ff00::/8 addresses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_BROADCAST) && defined(NET_UDP_HAVE_STACK)
|
#if defined(CONFIG_NET_BROADCAST) && defined(NET_UDP_HAVE_STACK)
|
||||||
if (ipv6->proto == IP_PROTO_UDP &&
|
if (ipv6->proto == IP_PROTO_UDP && net_is_addr_mcast(ipv6->destipaddr))
|
||||||
ipv6->destipaddr[0] == HTONS(0xff02))
|
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_IPFORWARD_BROADCAST
|
#ifdef CONFIG_NET_IPFORWARD_BROADCAST
|
||||||
/* Forward broadcast packets */
|
|
||||||
|
|
||||||
ipv6_forward_broadcast(dev, ipv6);
|
/* Packets sent to ffx0 are reserved, ffx1 are interface-local, and ffx2
|
||||||
|
* are interface-local, and therefore, should not be forwarded
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff00)) &&
|
||||||
|
(ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff01)) &&
|
||||||
|
(ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff02)))
|
||||||
|
{
|
||||||
|
/* Forward broadcast packets */
|
||||||
|
|
||||||
|
ipv6_forward_broadcast(dev, ipv6);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return udp_ipv6_input(dev);
|
return udp_ipv6_input(dev);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user