All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.01.org
Subject: [PATCH 5/5] network: Stop autoconnect during agent request or ANQP
Date: Thu, 08 Oct 2020 10:49:11 +0200	[thread overview]
Message-ID: <20201008084911.1046485-5-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20201008084911.1046485-1-andrew.zaborowski@intel.com>

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

Stop autoconnect whenever we're saving a pending DBus message and resume
when we return the error response.

One event that may be unhandled here is when we cancel the agent request
in network_unregister which may happen when the station interface goes
DOWN or when the network goes out of range and expires.
---
 src/network.c | 14 ++++++++++++--
 src/station.c |  1 +
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/network.c b/src/network.c
index 388bc17a..08f855d2 100644
--- a/src/network.c
+++ b/src/network.c
@@ -827,6 +827,7 @@ static void passphrase_callback(enum agent_result result,
 
 err:
 	network_settings_close(network);
+	station_set_autoconnect(station, true);
 }
 
 static struct l_dbus_message *network_connect_psk(struct network *network,
@@ -862,6 +863,8 @@ static struct l_dbus_message *network_connect_psk(struct network *network,
 
 		if (!network->agent_request)
 			return dbus_error_no_agent(message);
+
+		station_set_autoconnect(station, false);
 	} else
 		station_connect_network(station, network, bss, message);
 
@@ -992,8 +995,10 @@ static bool eap_send_agent_req(struct network *network,
 		break;
 	}
 
-	if (network->agent_request)
+	if (network->agent_request) {
+		station_set_autoconnect(network->station, false);
 		return true;
+	}
 
 	eap_secret_request_free(req);
 	return false;
@@ -1071,6 +1076,7 @@ static void eap_secret_done(enum agent_result result,
 	dbus_pending_reply(&message, dbus_error_no_agent(message));
 err:
 	network_settings_close(network);
+	station_set_autoconnect(network->station, true);
 }
 
 static struct l_dbus_message *network_connect_8021x(struct network *network,
@@ -1180,6 +1186,7 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus,
 						l_dbus_message_ref(message);
 			l_debug("Pending ANQP request, delaying connect to %s",
 						network->ssid);
+			station_set_autoconnect(station, false);
 			return NULL;
 		}
 
@@ -1530,6 +1537,7 @@ static void anqp_watch_changed(enum station_anqp_state state,
 			reply = dbus_error_not_configured(
 						network->connect_after_anqp);
 			dbus_pending_reply(&network->connect_after_anqp, reply);
+			station_set_autoconnect(network->station, true);
 			return;
 		}
 
@@ -1537,8 +1545,10 @@ static void anqp_watch_changed(enum station_anqp_state state,
 					network_bss_select(network, true),
 					network->connect_after_anqp);
 
-		if (reply)
+		if (reply) {
 			l_dbus_send(dbus_get_bus(), reply);
+			station_set_autoconnect(network->station, true);
+		}
 
 		l_dbus_message_unref(network->connect_after_anqp);
 		network->connect_after_anqp = NULL;
diff --git a/src/station.c b/src/station.c
index befc4e25..120a11ea 100644
--- a/src/station.c
+++ b/src/station.c
@@ -2520,6 +2520,7 @@ void station_connect_network(struct station *station, struct network *network,
 
 error:
 	l_dbus_send(dbus, dbus_error_from_errno(err, message));
+	station_set_autoconnect(station, true);
 }
 
 static void station_hidden_network_scan_triggered(int err, void *user_data)
-- 
2.25.1

  parent 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 ` [PATCH 2/5] station: Add current hidden network to networks_sorted Andrew Zaborowski
2020-10-08 15:06   ` 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 ` Andrew Zaborowski [this message]
2020-10-08 15:25   ` [PATCH 5/5] network: Stop autoconnect during agent request or ANQP 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-5-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.