station: add dependency to device
PATCH 1/1 station: add dependency to device
scan_periodic_start triggered by station requires scan_wdev_add to be called first from device.
--- src/station.c | 1 + 1 file changed, 1 insertion(+)
src/station.c +1 -0
@@ -3225,3 +3225,4 @@ static void station_exit(void) IWD_MODULE(station, station_init, station_exit) IWD_MODULE_DEPENDS(station, netconfig) +IWD_MODULE_DEPENDS (station, device)
Signature · 1 line
2.24.0
Hi Shuai,
Quoted 6 lines · Shuai Wang
scan_periodic_starttriggered by station requiresscan_wdev_addto be called first from device.--- src/station.c | 1 + 1 file changed, 1 insertion(+)
Thanks for the bug report & fix. Looks like commit 1057d8aa743a ("device: Move device creation from netdev.c to event watch") introduced this regression.
src/station.c static void station_exit(void) · line 3228
Quoted 10 lines
src/station.c +1
-0@@ -3225,3 +3225,4 @@ static void station_exit(void) IWD_MODULE(station, station_init, station_exit) IWD_MODULE_DEPENDS(station, netconfig) +IWD_MODULE_DEPENDS (station, device)
Module dependencies are only really needed if one module _init function uses functionality (like event watch registrations, etc) from another module at daemon startup time. For this case the fix is a bit different.
Could you try the attached patch instead?
Regards,
-Denis
From 738184d49167590395439ed677c93db8b58639ac Mon Sep 17 00:00:00 2001
From: Denis Kenzior <[email protected]>
Date: Fri, 6 Dec 2019 10:11:51 -0600
Subject: [PATCH] device/netdev: init scan in netdev instead of device
Commit 1057d8aa743a changed the device interface creation logic from being unconditional inside netdev.c to instead use NETDEV_WATCH_* events. However, this broke the assumption that the device interface was created before all others. The effect is that the scan_wdev_add might no longer be called prior to station interface being created. Fix this by moving scan_wdev_add/remove calls to netdev.c instead.
--- src/device.c | 4 ---- src/netdev.c | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-)
src/device.c +0 -4
@@ -322,8 +322,6 @@ static struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)l_info ("Unable to register %s interface" ,L_DBUS_INTERFACE_PROPERTIES ); -scan_wdev_add (netdev_get_wdev_id (device->netdev)); -/* * register for AP roam transition watch */
@@ -345,8 +343,6 @@ static void device_free(struct device *device) {l_debug ("" ); -scan_wdev_remove (netdev_get_wdev_id (device->netdev)); -netdev_frame_watch_remove (device->netdev, device->ap_roam_watch);wiphy_state_watch_remove (device->wiphy, device->wiphy_rfkill_watch);
src/netdev.c +4 -0
@@ -626,6 +626,8 @@ static void netdev_free(void *data)WATCHLIST_NOTIFY (&netdev_watches, netdev_watch_func_t, netdev,NETDEV_WATCH_EVENT_DEL ); +scan_wdev_remove (netdev->wdev_id); +watchlist_destroy (&netdev->frame_watches);watchlist_destroy (&netdev->station_watches);
@@ -4204,6 +4206,8 @@ static void netdev_initial_up_cb(int error, uint16_t type, const void *data,l_debug ("Interface %i initialized" , netdev->index); +scan_wdev_add (netdev->wdev_id); +WATCHLIST_NOTIFY (&netdev_watches, netdev_watch_func_t, netdev,NETDEV_WATCH_EVENT_NEW ); netdev->events_ready = true;
Signature · 1 line
2.21.0
Hi Denis,
Thanks for the quick response. I tried your patch and it works great :)
Shuai
Quoted 34 lines · Denis Kenzior
Hi Shuai,
Quoted 6 lines · Shuai Wang
scan_periodic_starttriggered by station requiresscan_wdev_addto be called first from device.--- src/station.c | 1 + 1 file changed, 1 insertion(+)Thanks for the bug report & fix. Looks like commit
1057d8aa743a("device: Move device creation fromnetdev.cto event watch") introduced this regression.src/station.c static void station_exit(void) · line 3228
Quoted 10 lines
src/station.c +1
-0@@ -3225,3 +3225,4 @@ static void station_exit(void) IWD_MODULE(station, station_init, station_exit) IWD_MODULE_DEPENDS(station, netconfig) +IWD_MODULE_DEPENDS (station, device)Module dependencies are only really needed if one module
_initfunction uses functionality (like event watch registrations, etc) from another module at daemon startup time. For this case the fix is a bit different.Could you try the attached patch instead?
Regards,
-Denis
Hi Shuai,
Quoted 1 line
Thanks for the quick response. I tried your patch and it works great :)
Great! Thanks for testing. I pushed this out upstream now.
Regards,
-Denis