Openthread - fault with dual network interfaces #15975
Labels
area: Networking
area: OpenThread
bug
The issue is a bug, or the PR is fixing a bug
priority: low
Low impact/importance bug
Describe the bug
Multiple network interfaces (ETHERNET and OPENTHREAD) cause hard fault in openthread network_management callback.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Impact
Showstopper. System freezes/is unstable
Screenshots or console output
If applicable, add a screenshot (drag-and-drop an image), or console logs
(cut-and-paste text and put a code fence (```) before and after, to help
explain the issue.
Environment (please complete the following information):
Additional context
ipv6_addr_event_hander at/near openthread.c:67 will be called by net management events for all net ifaces. This event handler does no checking on whether the context returned by net_if_l2_data(iface) is a valid openthread_context and a hard fault will be issued eventually in a memcmp call.
I added a u32_t to the openthread context called ot_magic, and initialized it in openthread_init to hold a magic number/identifier. Then, in ipv6_addr_even_handler, I check the returned data structure for both NULL and the magic number, and if either fail, skip the processing of the IPV6 address on the invalid openthread context.
The text was updated successfully, but these errors were encountered: