All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.01.org
Subject: [PATCH 2/5] station: Add current hidden network to networks_sorted
Date: Thu, 08 Oct 2020 10:49:08 +0200	[thread overview]
Message-ID: <20201008084911.1046485-2-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20201008084911.1046485-1-andrew.zaborowski@intel.com>

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

Update station->networks_sorted with new networks added inside
station_hidden_network_scan_results() because we rely on
station->networks being in sync with station->networks_sorted.
Otherwise station_set_scan_results may crash.

Optimally a generic scan shouldn't happen while we're connecting to a
new hidden network because the generic scan doesn't know about the
hidden network's SSID and will not include the SSID in the probe request
so it can at most expire the BSS we're trying to connect to.  However we
can't easily tell whether we're in the middle of a Connect() or
ConnectHiddenNetwork() call as mentioned in the previous commit, so we
have to accept that we may trigger a new scan while waiting for secrets
from the agent.  Thus the BSS discovered in the active scan for the
hidden SSID may expire if the agent request takes too long but we this
change at least we don't crash.
---
 src/station.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/station.c b/src/station.c
index 6ac9e53b..b70d3416 100644
--- a/src/station.c
+++ b/src/station.c
@@ -2572,11 +2572,16 @@ static bool station_hidden_network_scan_results(int err,
 					memcmp(bss->ssid, ssid, ssid_len))
 			goto next;
 
-		if (station_add_seen_bss(station, bss)) {
-			l_queue_push_tail(station->bss_list, bss);
+		network = station_add_seen_bss(station, bss);
+		if (!network)
+			goto next;
 
-			continue;
-		}
+		l_queue_push_tail(station->bss_list, bss);
+		network_rank_update(network, false);
+		l_queue_remove(station->networks_sorted, network);
+		l_queue_insert(station->networks_sorted, network,
+				network_rank_compare, NULL);
+		continue;
 
 next:
 		scan_bss_free(bss);
-- 
2.25.1

  reply	other threads:[~2020-10-08  8:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08  8:49 [PATCH 1/5] station: Make Disconnect() cancel ConnectHiddenNetwork() Andrew Zaborowski
2020-10-08  8:49 ` Andrew Zaborowski [this message]
2020-10-08 15:06   ` [PATCH 2/5] station: Add current hidden network to networks_sorted Denis Kenzior
2020-10-08 20:56     ` Andrew Zaborowski
2020-10-08  8:49 ` [PATCH 3/5] network: Check if network busy before new connection Andrew Zaborowski
2020-10-08 15:08   ` Denis Kenzior
2020-10-08  8:49 ` [PATCH 4/5] station: Stop autoconnect for the hidden SSID scan Andrew Zaborowski
2020-10-08  8:49 ` [PATCH 5/5] network: Stop autoconnect during agent request or ANQP Andrew Zaborowski
2020-10-08 15:25   ` Denis Kenzior
2020-10-08 14:12 ` [PATCH 1/5] station: Make Disconnect() cancel ConnectHiddenNetwork() 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=20201008084911.1046485-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.