mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-05 12:52:37 +01:00
device: Modify signature of device_set_scan_results
WSC was using this to set the scan results. However it never needed the autoconnect paths, so modify the signature to make this explicit.
This commit is contained in:
parent
345485c506
commit
977b817f3c
21
src/device.c
21
src/device.c
@ -321,7 +321,8 @@ static bool bss_match(const void *a, const void *b)
|
|||||||
* Used when scan results were obtained; either from passive scan running
|
* Used when scan results were obtained; either from passive scan running
|
||||||
* inside device.c or active scans running in other state machines, e.g. wsc.c
|
* inside device.c or active scans running in other state machines, e.g. wsc.c
|
||||||
*/
|
*/
|
||||||
void device_set_scan_results(struct device *device, struct l_queue *bss_list)
|
void device_set_scan_results(struct device *device, struct l_queue *bss_list,
|
||||||
|
bool add_to_autoconnect)
|
||||||
{
|
{
|
||||||
struct network *network;
|
struct network *network;
|
||||||
const struct l_queue_entry *bss_entry;
|
const struct l_queue_entry *bss_entry;
|
||||||
@ -342,13 +343,8 @@ void device_set_scan_results(struct device *device, struct l_queue *bss_list)
|
|||||||
struct scan_bss *bss = bss_entry->data;
|
struct scan_bss *bss = bss_entry->data;
|
||||||
struct network *network = add_seen_bss(device, bss);
|
struct network *network = add_seen_bss(device, bss);
|
||||||
|
|
||||||
if (!network)
|
if (network && add_to_autoconnect)
|
||||||
continue;
|
add_autoconnect_bss(device, network, bss);
|
||||||
|
|
||||||
if (device->state != DEVICE_STATE_AUTOCONNECT)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
add_autoconnect_bss(device, network, bss);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->connected_bss) {
|
if (device->connected_bss) {
|
||||||
@ -374,9 +370,6 @@ void device_set_scan_results(struct device *device, struct l_queue *bss_list)
|
|||||||
|
|
||||||
l_queue_destroy(device->old_bss_list, bss_free);
|
l_queue_destroy(device->old_bss_list, bss_free);
|
||||||
device->old_bss_list = NULL;
|
device->old_bss_list = NULL;
|
||||||
|
|
||||||
if (device->state == DEVICE_STATE_AUTOCONNECT)
|
|
||||||
device_autoconnect_next(device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, int err,
|
static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, int err,
|
||||||
@ -384,6 +377,7 @@ static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, int err,
|
|||||||
{
|
{
|
||||||
struct device *device = userdata;
|
struct device *device = userdata;
|
||||||
struct l_dbus *dbus = dbus_get_bus();
|
struct l_dbus *dbus = dbus_get_bus();
|
||||||
|
bool autoconnect = device->state == DEVICE_STATE_AUTOCONNECT;
|
||||||
|
|
||||||
if (device->scanning) {
|
if (device->scanning) {
|
||||||
device->scanning = false;
|
device->scanning = false;
|
||||||
@ -398,7 +392,10 @@ static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, int err,
|
|||||||
if (netdev_get_iftype(device->netdev) != NETDEV_IFTYPE_STATION)
|
if (netdev_get_iftype(device->netdev) != NETDEV_IFTYPE_STATION)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
device_set_scan_results(device, bss_list);
|
device_set_scan_results(device, bss_list, autoconnect);
|
||||||
|
|
||||||
|
if (autoconnect)
|
||||||
|
device_autoconnect_next(device);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,8 @@ uint32_t device_add_state_watch(struct device *device,
|
|||||||
device_destroy_func_t destroy);
|
device_destroy_func_t destroy);
|
||||||
bool device_remove_state_watch(struct device *device, uint32_t id);
|
bool device_remove_state_watch(struct device *device, uint32_t id);
|
||||||
|
|
||||||
void device_set_scan_results(struct device *device, struct l_queue *bss_list);
|
void device_set_scan_results(struct device *device, struct l_queue *bss_list,
|
||||||
|
bool add_to_autoconnect);
|
||||||
struct network *device_network_find(struct device *device, const char *ssid,
|
struct network *device_network_find(struct device *device, const char *ssid,
|
||||||
enum security security);
|
enum security security);
|
||||||
|
|
||||||
|
@ -666,7 +666,7 @@ static bool push_button_scan_results(uint32_t wiphy_id, uint32_t ifindex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wsc_cancel_scan(wsc);
|
wsc_cancel_scan(wsc);
|
||||||
device_set_scan_results(wsc->device, bss_list);
|
device_set_scan_results(wsc->device, bss_list, false);
|
||||||
|
|
||||||
l_debug("Found AP to connect to: %s",
|
l_debug("Found AP to connect to: %s",
|
||||||
util_address_to_string(target->addr));
|
util_address_to_string(target->addr));
|
||||||
@ -813,7 +813,7 @@ static bool pin_scan_results(uint32_t wiphy_id, uint32_t ifindex, int err,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wsc_cancel_scan(wsc);
|
wsc_cancel_scan(wsc);
|
||||||
device_set_scan_results(wsc->device, bss_list);
|
device_set_scan_results(wsc->device, bss_list, false);
|
||||||
|
|
||||||
l_debug("Found AP to connect to: %s",
|
l_debug("Found AP to connect to: %s",
|
||||||
util_address_to_string(target->addr));
|
util_address_to_string(target->addr));
|
||||||
|
Loading…
Reference in New Issue
Block a user