Commit 2dec9313 authored by Chaitanya Tata's avatar Chaitanya Tata Committed by Fabio Baltieri
Browse files

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: default avatarChaitanya Tata <Chaitanya.Tata@nordicsemi.no>
parent 56d7e9a4
Loading
Loading
Loading
Loading
+2 −5
Changes for modules/hostap/src/supp_main.c: 2 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -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;
	}
}