Skip to content

Commit

Permalink
net: openthread: Verify iface in net_mgmt event handler
Browse files Browse the repository at this point in the history
OpenThread did not verify if the interface provided in the net_mgmt
handler is actually an OpenThread interface. In result, when multiple
network interfaces were used, different interfaces were processed by the
OpenThread handler, ending up in a crash.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
  • Loading branch information
rlubos authored and jukkar committed Jul 3, 2019
1 parent f4ff0a6 commit 1ee8e0b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions subsys/net/l2/openthread/openthread.c
Expand Up @@ -69,6 +69,10 @@ static void ipv6_addr_event_handler(struct net_mgmt_event_callback *cb,
{
struct openthread_context *ot_context = net_if_l2_data(iface);

if (net_if_l2(iface) != &NET_L2_GET_NAME(OPENTHREAD)) {
return;
}

if (mgmt_event == NET_EVENT_IPV6_ADDR_ADD) {
add_ipv6_addr_to_ot(ot_context);
} else if (mgmt_event == NET_EVENT_IPV6_MADDR_ADD) {
Expand Down

0 comments on commit 1ee8e0b

Please sign in to comment.