mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-29 05:39:24 +01:00
dpp: use the config's SSID to process scan results
The scan result handling was fragile because it assumed the kernel would only give results matching the requested SSID. This isn't something we should assume so instead keep the configuration object around until after the scan and use the target SSID to lookup the network.
This commit is contained in:
parent
fa14ac125e
commit
6a60cb5a32
17
src/dpp.c
17
src/dpp.c
@ -856,7 +856,6 @@ static bool dpp_scan_results(int err, struct l_queue *bss_list,
|
|||||||
struct dpp_sm *dpp = userdata;
|
struct dpp_sm *dpp = userdata;
|
||||||
struct station *station = station_find(netdev_get_ifindex(dpp->netdev));
|
struct station *station = station_find(netdev_get_ifindex(dpp->netdev));
|
||||||
struct scan_bss *bss;
|
struct scan_bss *bss;
|
||||||
char ssid[33];
|
|
||||||
struct network *network;
|
struct network *network;
|
||||||
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@ -872,18 +871,18 @@ static bool dpp_scan_results(int err, struct l_queue *bss_list,
|
|||||||
if (L_WARN_ON(station_get_connected_network(station)))
|
if (L_WARN_ON(station_get_connected_network(station)))
|
||||||
goto reset;
|
goto reset;
|
||||||
|
|
||||||
/* Purely for grabbing the SSID */
|
|
||||||
bss = l_queue_peek_head(bss_list);
|
|
||||||
|
|
||||||
memcpy(ssid, bss->ssid, bss->ssid_len);
|
|
||||||
ssid[bss->ssid_len] = '\0';
|
|
||||||
|
|
||||||
station_set_scan_results(station, bss_list, freqs, false);
|
station_set_scan_results(station, bss_list, freqs, false);
|
||||||
|
|
||||||
network = station_network_find(station, ssid, SECURITY_PSK);
|
network = station_network_find(station, dpp->config->ssid,
|
||||||
|
SECURITY_PSK);
|
||||||
|
|
||||||
dpp_reset(dpp);
|
dpp_reset(dpp);
|
||||||
|
|
||||||
|
if (!network) {
|
||||||
|
l_debug("Network was not found after scanning");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bss = network_bss_select(network, true);
|
bss = network_bss_select(network, true);
|
||||||
network_autoconnect(network, bss);
|
network_autoconnect(network, bss);
|
||||||
|
|
||||||
@ -1084,7 +1083,7 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
|
|||||||
dpp_scan_results, dpp,
|
dpp_scan_results, dpp,
|
||||||
dpp_scan_destroy);
|
dpp_scan_destroy);
|
||||||
if (dpp->connect_scan_id) {
|
if (dpp->connect_scan_id) {
|
||||||
dpp_configuration_free(config);
|
dpp->config = config;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user