Skip to content

Commit 2d21548

Browse files
fraziejejukkar
authored andcommitted
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 <[email protected]>
1 parent 03dcfee commit 2d21548

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

subsys/net/l2/openthread/openthread_utils.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ void add_ipv6_maddr_to_ot(struct openthread_context *context)
250250
void add_ipv6_maddr_to_zephyr(struct openthread_context *context)
251251
{
252252
const otNetifMulticastAddress *maddress;
253+
struct net_if_mcast_addr *zmaddr;
253254

254255
for (maddress = otIp6GetMulticastAddresses(context->instance);
255256
maddress; maddress = maddress->mNext) {
@@ -269,8 +270,18 @@ void add_ipv6_maddr_to_zephyr(struct openthread_context *context)
269270
buf, sizeof(buf))));
270271
}
271272

272-
net_if_ipv6_maddr_add(context->iface,
273+
zmaddr = net_if_ipv6_maddr_add(context->iface,
273274
(struct in6_addr *)(&maddress->mAddress));
275+
276+
if (zmaddr &&
277+
!(net_if_ipv6_maddr_is_joined(zmaddr) ||
278+
net_ipv6_is_addr_mcast_iface(
279+
(struct in6_addr *)(&maddress->mAddress)) ||
280+
net_ipv6_is_addr_mcast_link_all_nodes(
281+
(struct in6_addr *)(&maddress->mAddress)))) {
282+
283+
net_if_ipv6_maddr_join(zmaddr);
284+
}
274285
}
275286
}
276287

0 commit comments

Comments
 (0)