Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openthread - fault with dual network interfaces #15975

Closed
acsplayon opened this issue May 7, 2019 · 2 comments · Fixed by #17308
Closed

Openthread - fault with dual network interfaces #15975

acsplayon opened this issue May 7, 2019 · 2 comments · Fixed by #17308
Assignees
Labels
area: Networking area: OpenThread bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@acsplayon
Copy link

Describe the bug
Multiple network interfaces (ETHERNET and OPENTHREAD) cause hard fault in openthread network_management callback.

To Reproduce
Steps to reproduce the behavior:

  1. You create 2 L2 network interfaces. ETHERNET and OPENTHREAD
  2. I use USB cdc_ecm to interface to the ETHERNET iface.
  3. no special configuration of openthread.
  4. on init, openthread will install a net_mgmt callback which is located in openthread.c.

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):

  • OS: Linux (ubuntu 16.04/18.04)
  • Toolchain Zephyr SDK
  • Commit - master

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.

@acsplayon acsplayon added the bug The issue is a bug, or the PR is fixing a bug label May 7, 2019
@jukkar
Copy link
Member

jukkar commented May 9, 2019

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.

Could you send a PR if you have already a fix?

@rlubos
Copy link
Contributor

rlubos commented Jul 3, 2019

@acsplayon I've reproduced the issue and submitted #17308 to fix it. Please review/verify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking area: OpenThread bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants