Browse Source

device/netdev: init scan in netdev instead of device

Commit 1057d8aa74 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: 1057d8aa74 ("device: Move device creation from netdev.c to event watch")
upstream/latest
Denis Kenzior 4 years ago
parent
commit
738184d491
  1. 4
      src/device.c
  2. 4
      src/netdev.c

4
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);

4
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;

Loading…
Cancel
Save