From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.01.org
Subject: [PATCH 1/2] station: Fix autoconnect loops
Date: Mon, 10 May 2021 12:12:03 +0200 [thread overview]
Message-ID: <20210510101204.175551-1-andrew.zaborowski@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2476 bytes --]
Make sure we process the result of a connect attempt both in a D-Bus
triggered connection and during autoconnect. Until now we'd only call
station_connect_cb() on NETDEV_EVENT_DISCONNECT_BY_{AP,SME} if
station->connect_pending was non-NULL, i.e. only in the D-Bus method.
As a result we were never blacklisting BSSes and never calling
network_connect_failed() (to set ask_passphrase) during autoconnect.
Use station->netdev_connected to keep track of whether the event
actually happens in the handshake (as opposed to netconfig for example)
to avoid calling network_connect_failed() with the "in_handshake"
parameter set to true. Arguably we might want to call
netdev_connect_failed() or at least temporarily blacklist/downrank
the bss if the connection breaks during netconfig but I kept the
current logic in this commit.
We might also want to call station_reassociate_cb() if we're in a
reassociation but this wouldn't currently make much difference (and we
don't seem to have any flag to know that we're in a reassociation right
now.)
---
src/station.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/station.c b/src/station.c
index 479f81f5..e503f636 100644
--- a/src/station.c
+++ b/src/station.c
@@ -113,6 +113,7 @@ struct station {
bool ap_directed_roaming : 1;
bool scanning : 1;
bool autoconnect : 1;
+ bool netdev_connected : 1;
};
struct anqp_entry {
@@ -1339,6 +1340,7 @@ static void station_reset_connection_state(struct station *station)
l_queue_insert(station->networks_sorted, station->connected_network,
network_rank_compare, NULL);
+ station->netdev_connected = false;
station->connected_bss = NULL;
station->connected_network = NULL;
@@ -1370,7 +1372,9 @@ static void station_disconnect_event(struct station *station, void *event_data)
{
l_debug("%u", netdev_get_ifindex(station->netdev));
- if (station->connect_pending)
+ if (station->connect_pending ||
+ (station->state == STATION_STATE_CONNECTING &&
+ !station->netdev_connected))
station_connect_cb(station->netdev,
NETDEV_RESULT_HANDSHAKE_FAILED,
event_data, station);
@@ -2554,6 +2558,7 @@ static void station_connect_cb(struct netdev *netdev, enum netdev_result result,
l_warn("Could not request neighbor report");
}
+ station->netdev_connected = true;
network_connected(station->connected_network);
if (station->netconfig)
--
2.27.0
next 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 Andrew Zaborowski [this message]
2021-05-10 10:12 ` [PATCH 2/2] netdev: Pass a reason code with NETDEV_EVENT_DISCONNECT_BY_* Andrew Zaborowski
2021-05-11 16:36 ` 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-1-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.