public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj at gmail.com>
To: iwd at lists.01.org
Subject: [PATCH v2 1/2] netdev: always honor disconnect events if issued by AP
Date: Tue, 23 Nov 2021 10:17:31 -0800	[thread overview]
Message-ID: <20211123181732.3617090-1-prestwoj@gmail.com> (raw)

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

The disconnect event handler was mistakenly bailing out if FT or
reassociation was going on. This was done because a disconnect
event is sent by the kernel when CMD_AUTH/CMD_ASSOC is used.

The problem is an AP could also disconnect IWD which should never
be ignored.

To fix this always parse the disconnect event and, if issued by
the AP, always notify watchers of the disconnect.
---
 src/netdev.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/netdev.c b/src/netdev.c
index 96e473a9..e35a8b82 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -1165,8 +1165,7 @@ static void netdev_disconnect_event(struct l_genl_msg *msg,
 
 	l_debug("");
 
-	if (!netdev->connected || netdev->disconnect_cmd_id > 0 ||
-			netdev->in_ft || netdev->in_reassoc)
+	if (!netdev->connected || netdev->disconnect_cmd_id > 0)
 		return;
 
 	if (!l_genl_attr_init(&attr, msg)) {
@@ -1190,6 +1189,13 @@ static void netdev_disconnect_event(struct l_genl_msg *msg,
 		}
 	}
 
+	/*
+	 * Only ignore this event if issued by the kernel since this is
+	 * normal when using CMD_AUTH/ASSOC.
+	 */
+	if (!disconnect_by_ap && (netdev->in_ft || netdev->in_reassoc))
+		return;
+
 	l_info("Received Deauthentication event, reason: %hu, from_ap: %s",
 			reason_code, disconnect_by_ap ? "true" : "false");
 
@@ -3171,6 +3177,7 @@ static void netdev_associate_event(struct l_genl_msg *msg,
 
 	if (!netdev->ap) {
 		netdev->associated = true;
+		netdev->in_reassoc = false;
 		return;
 	}
 
-- 
2.31.1

             reply	other threads:[~2021-11-23 18:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 18:17 James Prestwood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-11-23 18:19 [PATCH v2 1/2] netdev: always honor disconnect events if issued by AP Denis Kenzior

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=20211123181732.3617090-1-prestwoj@gmail.com \
    --to=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