mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-09 00:12:36 +01:00
device: change scan command logic
This patch allows alternating between the passive and active scans taking into consideration an existence of the known hidden networks and previous observation of them in the scan results, as well as an ability to randomize the MAC address.
This commit is contained in:
parent
5828073cd5
commit
27e305c9d2
33
src/device.c
33
src/device.c
@ -1759,7 +1759,6 @@ static struct l_dbus_message *device_scan(struct l_dbus *dbus,
|
||||
void *user_data)
|
||||
{
|
||||
struct device *device = user_data;
|
||||
uint32_t id;
|
||||
|
||||
l_debug("Scan called from DBus");
|
||||
|
||||
@ -1773,19 +1772,29 @@ static struct l_dbus_message *device_scan(struct l_dbus *dbus,
|
||||
device->scan_pending = l_dbus_message_ref(message);
|
||||
|
||||
/*
|
||||
* If device is not connected to a BSS use a passive scan to
|
||||
* avoid advertising our address until we support address
|
||||
* randomization (on the devices that support it).
|
||||
* If we're not connected and no hidden networks are seen & configured,
|
||||
* use passive scanning to hide our MAC address
|
||||
*/
|
||||
if (!device->connected_bss)
|
||||
id = scan_passive(device->index, device_scan_triggered,
|
||||
new_scan_results, device, NULL);
|
||||
else
|
||||
id = scan_active(device->index, NULL, 0, device_scan_triggered,
|
||||
new_scan_results, device, NULL);
|
||||
if (!device->connected_bss &&
|
||||
!(device->seen_hidden_networks &&
|
||||
network_info_has_hidden())) {
|
||||
if (!scan_passive(device->index, device_scan_triggered,
|
||||
new_scan_results, device, NULL))
|
||||
return dbus_error_failed(message);
|
||||
} else {
|
||||
struct scan_parameters params;
|
||||
|
||||
if (!id)
|
||||
return dbus_error_failed(message);
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
|
||||
/* If we're connected, HW cannot randomize our MAC */
|
||||
if (!device->connected_bss)
|
||||
params.randomize_mac_addr_hint = true;
|
||||
|
||||
if (!scan_active_full(device->index, ¶ms,
|
||||
device_scan_triggered,
|
||||
new_scan_results, device, NULL))
|
||||
return dbus_error_failed(message);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user