modules: hostap: Use net_mgmt context

Using a separate workqueue causes issues without any special locking to
synchronize with networking threads e.g., interface being removed while
the workqueue is trying to synchronize with WPA supplicant.

It's easier to use the net_mgmt thread which is in better sync with
networking.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit is contained in:
Chaitanya Tata 2024-09-30 23:58:37 +02:00 committed by Fabio Baltieri
parent 56d7e9a487
commit 2dec9313e4

View file

@ -477,9 +477,6 @@ static void submit_iface_work(struct supplicant_context *ctx,
static void interface_handler(struct net_mgmt_event_callback *cb,
uint32_t mgmt_event, struct net_if *iface)
{
struct supplicant_context *ctx = CONTAINER_OF(cb, struct supplicant_context,
cb);
if ((mgmt_event & INTERFACE_EVENT_MASK) != mgmt_event) {
return;
}
@ -492,13 +489,13 @@ static void interface_handler(struct net_mgmt_event_callback *cb,
if (mgmt_event == NET_EVENT_IF_ADMIN_UP) {
LOG_INF("Network interface %d (%p) up", net_if_get_by_iface(iface), iface);
submit_iface_work(ctx, iface, add_interface);
add_interface(get_default_context(), iface);
return;
}
if (mgmt_event == NET_EVENT_IF_ADMIN_DOWN) {
LOG_INF("Network interface %d (%p) down", net_if_get_by_iface(iface), iface);
submit_iface_work(ctx, iface, del_interface);
del_interface(get_default_context(), iface);
return;
}
}