From: James Prestwood <prestwoj@gmail.com>
To: Denis Kenzior <denkenz@gmail.com>, iwd@lists.linux.dev
Subject: Re: [PATCH v3 3/4] dpp: fix fragile scan/connecting logic
Date: Thu, 16 Nov 2023 07:51:11 -0800 [thread overview]
Message-ID: <1770d2fa-eeb8-4997-9d1f-2f2ecf11c3d1@gmail.com> (raw)
In-Reply-To: <805ef134-6b99-4f5e-aad8-be5cff7de444@gmail.com>
Hi Denis,
On 11/16/23 07:18, Denis Kenzior wrote:
> Hi James,
>
> On 11/13/23 11:54, James Prestwood wrote:
>> The post-DPP connection was never done quite right due to station's
>> state being unknown. The state is now tracked in DPP by a previous
>> patch but the scan path in DPP is still wrong.
>>
>> It relies on station autoconnect logic which has the potential to
>> connect to a different network than what was configured with DPP.
>> Its unlikely but still could happen in theory. In addition the scan
>> was not selectively filtering results by the SSID that DPP
>> configured.
>>
>> This fixes the above problems by first filtering the scan by the
>> SSID. Then setting the scan results into station without triggering
>> autoconnect. And finally using network_autoconnect() directly
>> instead of relying on station to choose the SSID.
>> ---
>> src/dpp.c | 44 +++++++++++++++++++++++++++++++++++++++++---
>> 1 file changed, 41 insertions(+), 3 deletions(-)
>>
>
> All 4 applied, but one comment:
>
>> diff --git a/src/dpp.c b/src/dpp.c
>> index 06ae2929..a95f93e2 100644
>> --- a/src/dpp.c
>> +++ b/src/dpp.c
>> @@ -853,13 +853,42 @@ 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)
>> - return false;
>> + goto reset;
>> +
>> + if (!bss_list || l_queue_length(bss_list) == 0)
>> + goto reset;
>> +
>> + /*
>> + * The station watch _should_ detect this and reset, which
>> cancels the
>> + * scan. But just in case...
>> + */
>> + if (L_WARN_ON(station_get_connected_network(station)))
>> + goto reset;
>> +
>> + /* Purely for grabbing the SSID */
>> + bss = l_queue_peek_head(bss_list);
>> - station_set_scan_results(station, bss_list, freqs, true);
>> + memcpy(ssid, bss->ssid, bss->ssid_len);
>> + ssid[bss->ssid_len] = '\0';
>
> Are you sure this SSID is UTF8? station_set_scan_results will filter
> any SSIDs that are not.
Good catch, I hadn't considered that. BUT in theory this shouldn't
happen since utf8 is verified when parsing the configuration object.
Either way, I still sent a patch because an extra check doesn't hurt,
and its results coming from the kernel so I'd rather avoid a crash if
something ever changed in the future.
Thanks,
James
next prev parent reply other threads:[~2023-11-16 15:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 17:53 [PATCH v3 1/4] dpp: remove duplicate connected network check James Prestwood
2023-11-13 17:53 ` [PATCH v3 2/4] dpp: add station watch to DPP James Prestwood
2023-11-13 17:54 ` [PATCH v3 3/4] dpp: fix fragile scan/connecting logic James Prestwood
2023-11-16 15:18 ` Denis Kenzior
2023-11-16 15:51 ` James Prestwood [this message]
2023-11-13 17:54 ` [PATCH v3 4/4] dpp: scan to pick up extra frequencies when enrolling James Prestwood
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=1770d2fa-eeb8-4997-9d1f-2f2ecf11c3d1@gmail.com \
--to=prestwoj@gmail.com \
--cc=denkenz@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).