All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.01.org
Subject: [PATCH 2/2] netdev: Pass a reason code with NETDEV_EVENT_DISCONNECT_BY_*
Date: Mon, 10 May 2021 12:12:04 +0200	[thread overview]
Message-ID: <20210510101204.175551-2-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20210510101204.175551-1-andrew.zaborowski@intel.com>

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

Station callbacks expect a reason code (as opposed to status codes) with
this event type.  This shouldn't matter a lot because
station_disconnect_event() only actually looks at the value during
connection establishment so usually the "result" parameter is going to
be HANDSHAKE_FAILED meaning that we'd already be getting a reason code
in status_or_reason, but there could be corner cases where we got a
different "result".
---
 src/netdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/netdev.c b/src/netdev.c
index 4fbe813a..6c063df5 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -771,10 +771,15 @@ static void netdev_connect_failed(struct netdev *netdev,
 
 	if (connect_cb)
 		connect_cb(netdev, result, &status_or_reason, connect_data);
-	else if (event_filter)
+	else if (event_filter) {
+		/* NETDEV_EVENT_DISCONNECT_BY_SME expects a reason code */
+		if (result != NETDEV_RESULT_HANDSHAKE_FAILED)
+			status_or_reason = MMPDU_REASON_CODE_UNSPECIFIED;
+
 		event_filter(netdev, NETDEV_EVENT_DISCONNECT_BY_SME,
 				&status_or_reason,
 				connect_data);
+	}
 }
 
 static void netdev_disconnect_cb(struct l_genl_msg *msg, void *user_data)
-- 
2.27.0

  reply	other threads:[~2021-05-10 10:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 10:12 [PATCH 1/2] station: Fix autoconnect loops Andrew Zaborowski
2021-05-10 10:12 ` Andrew Zaborowski [this message]
2021-05-11 16:36   ` [PATCH 2/2] netdev: Pass a reason code with NETDEV_EVENT_DISCONNECT_BY_* Denis Kenzior
2021-05-11 21:56     ` Andrew Zaborowski
2021-05-11 22:34       ` Denis Kenzior
2021-05-11 22:57         ` Andrew Zaborowski
2021-05-11 23:27           ` Denis Kenzior
2021-05-11 16:32 ` [PATCH 1/2] station: Fix autoconnect loops James Prestwood
2021-05-11 21:41   ` Andrew Zaborowski

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=20210510101204.175551-2-andrew.zaborowski@intel.com \
    --to=andrew.zaborowski@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.