-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Openthread border router fix socket close #99495
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
base: main
Are you sure you want to change the base?
Openthread border router fix socket close #99495
Conversation
modules/openthread/platform/trel.c
Outdated
| if (!net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, ail_iface_ptr, | ||
| &status, sizeof(status))) { | ||
| if (status.state == WIFI_STATE_COMPLETED) { | ||
| (void)trel_plat_init(ot_instance_ptr, ail_iface_ptr); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this make a hardcoded assumption that the backbone link is Wi-Fi? Please correct me if I'm wrong, but I think this module should also work with other interface types like Ethernet?
A generic way to check if the interface is ready to transmit data would be to check net_if_is_up() - for Wi-Fi interfaces, this should only return true if the interface is connected to a Wi-Fi network.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTBR is planned to support both interfaces, Wi-FI or Ethernet, you are right. It would be a better idea to stick with your approach.
OpenThread interface is initialized beform Wi-Fi interface. `otPlatTrelEnable` is called by OpenThread stack when it's interface is being initialized. Given this scenario, socket operation, like `bind`, will fail. There is also no mean to get a valid pointer to backbone interface. This is why, `trel_plat_init` was declared and called when backbone interface reported connectivity. This commit handles the `ot trel disable/ot trel enable` scenario that can be initialized from CLI. `otPlatTrelEnable` will be called, but `trel_plat_init` will not be called anymore, leaving trel socket without any options set, and `net_socket_service_register` is not called anymore, to handle incoming traffic. Now, when `otPlatTrelEnable` is called, it will verify if Wi-Fi interface is connected and will call `trel_plat_init` if needed. Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2523147 to
7311d26
Compare
In this commit, `net_socket_service_register` is called when a platform module that has sockets is deinitialized, and it's socket/sockets are closed. This commit also handles a case when a module tries to join a multicast group and a subscription, from another module, is already present. Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
This commit deinitializes platform modules when external network interface is brought down. It also delets the multicast routes that are added for OpenThread interface. Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
7311d26 to
6de7a35
Compare
|



Main goal of this PR is to handle a WI-Fi connect/disconnect or link lost and link re-established scenario.
OpenThread's platform code has been enhanced to handle those events.
Border Router application code has been updated to de-initialize platform modules and remove its multicast routes.
TREL code has been updated to accommodate user enable/disable interaction from CLI.