iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v3 3/4] netdev: handle non-fatal auth-proto returns
Date: Wed, 08 Sep 2021 13:48:04 -0700	[thread overview]
Message-ID: <20210908204805.92005-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20210908204805.92005-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]

This adds -EBADMSG/-ENOMSG to be handled specially by allowing the
frame to be dropped, similar to 0 or -EAGAIN. The difference though
is that a non-zero authenticate status will result in the kernel
not re-transmitting which ultimately could leave IWD in a connecting
state with no way of leaving. Because of this we handle a non-zero
status for these two returns as a failed connection.
---
 src/netdev.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

v3:
 * Only drop the message if the status was successful.

diff --git a/src/netdev.c b/src/netdev.c
index 7909c37e..fc4613e6 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -2717,7 +2717,17 @@ static void netdev_authenticate_event(struct l_genl_msg *msg,
 		ret = auth_proto_rx_authenticate(netdev->ap, frame, frame_len);
 		if (ret == 0 || ret == -EAGAIN)
 			return;
-		else if (ret > 0)
+		else if (ret == -EBADMSG || ret == -ENOMSG) {
+			/*
+			 * Only drop if the status is success. Otherwise
+			 * dropping the message here would prevent the kernel
+			 * from re-transmitting, leaving IWD in this connecting
+			 * state. If this happens the only option is to fail the
+			 * connection here.
+			 */
+			if (status_code == 0)
+				return;
+		} else if (ret > 0)
 			status_code = (uint16_t)ret;
 	}
 
-- 
2.31.1

  parent reply	other threads:[~2021-09-08 20:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 20:48 [PATCH v3 1/4] sae: don't send commit/confirm in confirmed state James Prestwood
2021-09-08 20:48 ` [PATCH v3 2/4] auth-proto: document acceptable return values for auth-protos James Prestwood
2021-09-08 20:48 ` James Prestwood [this message]
2021-09-08 20:48 ` [PATCH v3 4/4] auto-t: add sae test for non-acked commit 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=20210908204805.92005-3-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /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).