From: James Prestwood <prestwoj at gmail.com>
To: iwd at lists.01.org
Subject: [PATCH v2 6/6] dpp: allow config response handling without station
Date: Fri, 07 Jan 2022 16:13:33 -0800 [thread overview]
Message-ID: <20220108001333.723634-6-prestwoj@gmail.com> (raw)
In-Reply-To: 20220108001333.723634-1-prestwoj@gmail.com
[-- Attachment #1: Type: text/plain, Size: 1675 bytes --]
If the device is not in station mode DPP can still write out
the credentials and finish without attempting to connect or
scan.
---
src/dpp.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/dpp.c b/src/dpp.c
index 35807a8c..84e89f6c 100644
--- a/src/dpp.c
+++ b/src/dpp.c
@@ -496,7 +496,7 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
_auto_(l_free) uint8_t *unwrapped = NULL;
struct dpp_configuration *config;
struct station *station = station_find(netdev_get_ifindex(dpp->netdev));
- struct network *network;
+ struct network *network = NULL;
struct scan_bss *bss = NULL;
char ssid[33];
@@ -622,18 +622,24 @@ static void dpp_handle_config_response_frame(const struct mmpdu_header *frame,
return;
}
- memcpy(ssid, config->ssid, config->ssid_len);
- ssid[config->ssid_len] = '\0';
+ /*
+ * 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);
+ ssid[config->ssid_len] = '\0';
- network = station_network_find(station, ssid, SECURITY_PSK);
- if (network)
- bss = network_bss_select(network, true);
+ network = station_network_find(station, ssid, SECURITY_PSK);
+ if (network)
+ bss = network_bss_select(network, true);
+ }
dpp_write_config(config, network);
if (network && bss)
__station_connect_network(station, network, bss);
- else {
+ else if (station) {
dpp->connect_scan_id = scan_active(dpp->wdev_id, NULL, 0,
dpp_scan_triggered,
dpp_scan_results, dpp,
--
2.31.1
reply other threads:[~2022-01-08 0:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220108001333.723634-6-prestwoj@gmail.com \
--to=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