3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

dpp: allow config response handling without station

If the device is not in station mode DPP can still write out
the credentials and finish without attempting to connect or
scan.
This commit is contained in:
James Prestwood 2022-01-07 16:13:33 -08:00 committed by Denis Kenzior
parent e6ecc078a1
commit 82818d7454

View File

@ -496,7 +496,7 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
_auto_(l_free) uint8_t *unwrapped = NULL; _auto_(l_free) uint8_t *unwrapped = NULL;
struct dpp_configuration *config; struct dpp_configuration *config;
struct station *station = station_find(netdev_get_ifindex(dpp->netdev)); struct station *station = station_find(netdev_get_ifindex(dpp->netdev));
struct network *network; struct network *network = NULL;
struct scan_bss *bss = NULL; struct scan_bss *bss = NULL;
char ssid[33]; char ssid[33];
@ -622,18 +622,24 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
return; return;
} }
/*
* We should have a station device, but if not DPP can write the
* credentials out and be done
*/
if (station) {
memcpy(ssid, config->ssid, config->ssid_len); memcpy(ssid, config->ssid, config->ssid_len);
ssid[config->ssid_len] = '\0'; ssid[config->ssid_len] = '\0';
network = station_network_find(station, ssid, SECURITY_PSK); network = station_network_find(station, ssid, SECURITY_PSK);
if (network) if (network)
bss = network_bss_select(network, true); bss = network_bss_select(network, true);
}
dpp_write_config(config, network); dpp_write_config(config, network);
if (network && bss) if (network && bss)
__station_connect_network(station, network, bss); __station_connect_network(station, network, bss);
else { else if (station) {
dpp->connect_scan_id = scan_active(dpp->wdev_id, NULL, 0, dpp->connect_scan_id = scan_active(dpp->wdev_id, NULL, 0,
dpp_scan_triggered, dpp_scan_triggered,
dpp_scan_results, dpp, dpp_scan_results, dpp,