net: l2: openthread: join thread mcast addrs added to zephyr

Modifies openthread shim layer to automatically join multicast
addresses as they are added to zephyr from openthread, unless the
address is interface-local or link-local. This allows incoming
openthread multicast group messages to avoid being filtered by
zephyr ipv6 recv.

Fixes #31085

Signed-off-by: Joel Frazier <frazieje@gmail.com>
This commit is contained in:
Joel Frazier 2021-01-08 22:28:51 -05:00 committed by Jukka Rissanen
parent 03dcfeea0a
commit 2d215484cc

View file

@ -250,6 +250,7 @@ void add_ipv6_maddr_to_ot(struct openthread_context *context)
void add_ipv6_maddr_to_zephyr(struct openthread_context *context)
{
const otNetifMulticastAddress *maddress;
struct net_if_mcast_addr *zmaddr;
for (maddress = otIp6GetMulticastAddresses(context->instance);
maddress; maddress = maddress->mNext) {
@ -269,8 +270,18 @@ void add_ipv6_maddr_to_zephyr(struct openthread_context *context)
buf, sizeof(buf))));
}
net_if_ipv6_maddr_add(context->iface,
zmaddr = net_if_ipv6_maddr_add(context->iface,
(struct in6_addr *)(&maddress->mAddress));
if (zmaddr &&
!(net_if_ipv6_maddr_is_joined(zmaddr) ||
net_ipv6_is_addr_mcast_iface(
(struct in6_addr *)(&maddress->mAddress)) ||
net_ipv6_is_addr_mcast_link_all_nodes(
(struct in6_addr *)(&maddress->mAddress)))) {
net_if_ipv6_maddr_join(zmaddr);
}
}
}