commit 738184d49167590395439ed677c93db8b58639ac
parent d2556a48b7d65eb670fb0ce20e3f929bf9839a20
Author: Denis Kenzior <denkenz@gmail.com>
Date: Fri, 6 Dec 2019 10:11:51 -0600
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.
Fixes: 1057d8aa743a ("device: Move device creation from netdev.c to event watch")
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/device.c b/src/device.c
@@ -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);
diff --git a/src/netdev.c b/src/netdev.c
@@ -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;