From: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
To: connman@lists.linux.dev
Cc: john@metanate.com
Subject: [PATCH] wifi: Handle invalid-key case on WPA-SAE authentication failure
Date: Wed, 14 Sep 2022 15:46:10 -0300 [thread overview]
Message-ID: <20220914184610.258763-1-ariel.dalessandro@collabora.com> (raw)
On WPA3-SAE authentication, wpa_supplicant goes directly from
authenticating to disconnected state if the key was invalid.
The above is currently not handled and the `connect-failed` error is
reported on such cases. In order to make the client agent prompt for a
new password, we need to handle this transition and report the
`invalid-key` error.
Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
---
plugins/wifi.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 2a933708..ed7437f5 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2528,6 +2528,25 @@ static bool handle_4way_handshake_failure(GSupplicantInterface *interface,
return false;
}
+static bool handle_sae_authentication_failure(struct connman_network *network,
+ struct wifi_data *wifi)
+{
+ struct wifi_network *network_data = connman_network_get_data(network);
+
+ if (!(network_data->keymgmt & G_SUPPLICANT_KEYMGMT_SAE))
+ return false;
+
+ if (wifi->state != G_SUPPLICANT_STATE_AUTHENTICATING)
+ return false;
+
+ if (wifi->connected)
+ return false;
+
+ connman_network_set_error(network, CONNMAN_NETWORK_ERROR_INVALID_KEY);
+
+ return true;
+}
+
static void interface_state(GSupplicantInterface *interface)
{
struct connman_network *network;
@@ -2625,6 +2644,13 @@ static void interface_state(GSupplicantInterface *interface)
network, wifi))
break;
+ /*
+ * On WPA3-SAE authentication, wpa_supplicant goes directly from
+ * authenticating to disconnected state if the key was invalid.
+ */
+ if (handle_sae_authentication_failure(network, wifi))
+ break;
+
/* See table 8-36 Reason codes in IEEE Std 802.11 */
switch (wifi->disconnect_code) {
case 6: /* Class 2 frame received from nonauthenticated STA */
--
2.37.2
next reply other threads:[~2022-09-14 18:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 18:46 Ariel D'Alessandro [this message]
2022-09-14 18:57 ` [PATCH] wifi: Handle invalid-key case on WPA-SAE authentication failure Ariel D'Alessandro
2022-09-20 12:08 ` Ariel D'Alessandro
2022-09-20 16:06 ` Daniel Wagner
2022-09-20 17:08 ` Daniel Wagner
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=20220914184610.258763-1-ariel.dalessandro@collabora.com \
--to=ariel.dalessandro@collabora.com \
--cc=connman@lists.linux.dev \
--cc=john@metanate.com \
/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 NNTP newsgroup(s).