From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v3 3/3] dpp: use the config's SSID to process scan results
Date: Thu, 16 Nov 2023 11:15:28 -0800 [thread overview]
Message-ID: <20231116191528.364340-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20231116191528.364340-1-prestwoj@gmail.com>
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.
---
src/dpp.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/dpp.c b/src/dpp.c
index 907f3bf5..f8d76805 100644
--- a/src/dpp.c
+++ b/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 station *station = station_find(netdev_get_ifindex(dpp->netdev));
struct scan_bss *bss;
- char ssid[33];
struct network *network;
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)))
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);
- network = station_network_find(station, ssid, SECURITY_PSK);
+ network = station_network_find(station, dpp->config->ssid,
+ SECURITY_PSK);
dpp_reset(dpp);
+ if (!network) {
+ l_debug("Network was not found after scanning");
+ return true;
+ }
+
bss = network_bss_select(network, true);
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_destroy);
if (dpp->connect_scan_id) {
- dpp_configuration_free(config);
+ dpp->config = config;
return;
}
}
--
2.34.1
next prev parent reply other threads:[~2023-11-16 19:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 19:15 [PATCH v3 1/3] dpp-util: store SSID as string, not raw buffer James Prestwood
2023-11-16 19:15 ` [PATCH v3 2/3] dpp: use the new config->ssid member James Prestwood
2023-11-16 19:15 ` James Prestwood [this message]
2023-11-17 15:48 ` [PATCH v3 1/3] dpp-util: store SSID as string, not raw buffer Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231116191528.364340-3-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox