public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 2/4] netdev: fail the connection if sending external auth fails
Date: Tue, 11 Feb 2025 11:26:54 -0800	[thread overview]
Message-ID: <20250211192656.83157-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20250211192656.83157-1-prestwoj@gmail.com>

This prevents IWD from hanging after external auth fails. In addition
(as described in the comment) unless IWD actually issues a disconnect
the driver/kernel gets into a state where it no longer accepts any
commands, for example:

Received error during CMD_TRIGGER_SCAN: Resource temporarily unavailable (11)
---
 src/netdev.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/netdev.c b/src/netdev.c
index 7af3c39a..611fb597 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -3468,11 +3468,22 @@ static void netdev_external_auth_sae_tx_authenticate(const uint8_t *body,
 
 static void netdev_external_auth_cb(struct l_genl_msg *msg, void *user_data)
 {
+	struct netdev *netdev = user_data;
 	int error = l_genl_msg_get_error(msg);
 
-	if (error < 0)
+	if (error < 0) {
 		l_debug("Failed to send External Auth: %s(%d)",
 				strerror(-error), -error);
+
+		/*
+		 * Without an explicit disconnect here brcmfmac gets into a
+		 * broken state and returns "Resource temporarily unavailable
+		 * for any subsequent scans/commands
+		 */
+		netdev_disconnect_and_fail_connection(netdev,
+					NETDEV_RESULT_AUTHENTICATION_FAILED,
+					MMPDU_REASON_CODE_UNSPECIFIED);
+	}
 }
 
 static void netdev_send_external_auth(struct netdev *netdev,
-- 
2.34.1


  reply	other threads:[~2025-02-11 19:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11 19:26 [PATCH 1/4] eap: initialize vendor_id/vendor_type to zero James Prestwood
2025-02-11 19:26 ` James Prestwood [this message]
2025-02-11 19:26 ` [PATCH 3/4] wiphy: clean up some spammy prints James Prestwood
2025-02-11 19:26 ` [PATCH 4/4] station: print security of network when connecting 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=20250211192656.83157-2-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