Skip to content

Commit

Permalink
[nrf fromlist] modules: hostap: Use net_mgmt context
Browse files Browse the repository at this point in the history
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.

Upstream PR: zephyrproject-rtos/zephyr#79231

Signed-off-by: Chaitanya Tata <[email protected]>
  • Loading branch information
krish2718 authored and bjarki-andreasen committed Oct 1, 2024
1 parent d42f4be commit 8ad93ce
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions modules/hostap/src/supp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,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;
}
Expand All @@ -490,13 +487,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;
}
}
Expand Down

0 comments on commit 8ad93ce

Please sign in to comment.