net: ipv6: Drop organisation scope multicast dst address pkt

If we receive an IPv6 packet with organisation scope multicast
address FF08:: then we must drop it as those addresses are
reserved for organisation network traffic only.

Fixes #10961

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2018-11-01 09:55:43 +02:00
parent bd37a9462b
commit 4b7d8fb76d
2 changed files with 16 additions and 1 deletions

View file

@ -702,6 +702,20 @@ static inline bool net_is_ipv6_addr_mcast_site(const struct in6_addr *addr)
return net_is_ipv6_addr_mcast_scope(addr, 0x05);
}
/**
* @brief Check if the IPv6 address is an organisation scope multicast
* address (FFx8::).
*
* @param addr IPv6 address.
*
* @return True if the address is an organisation scope multicast address,
* false otherwise.
*/
static inline bool net_is_ipv6_addr_mcast_org(const struct in6_addr *addr)
{
return net_is_ipv6_addr_mcast_scope(addr, 0x08);
}
/**
* @brief Check if the IPv6 address belongs to certain multicast group
*

View file

@ -465,7 +465,8 @@ enum net_verdict net_ipv6_process_pkt(struct net_pkt *pkt, bool is_loopback)
if (net_is_ipv6_addr_mcast_iface(&hdr->dst) ||
(is_empty_group &&
net_is_ipv6_addr_mcast_site(&hdr->dst))) {
(net_is_ipv6_addr_mcast_site(&hdr->dst) ||
net_is_ipv6_addr_mcast_org(&hdr->dst)))) {
NET_DBG("Dropping invalid scope multicast packet");
net_stats_update_ipv6_drop(net_pkt_iface(pkt));
goto drop;