Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj at gmail.com>
To: iwd at lists.01.org
Subject: [PATCH 03/10] dpp: don't send StartEnrollee reply until offchannel starts
Date: Tue, 11 Jan 2022 16:55:51 -0800	[thread overview]
Message-ID: <20220112005558.1158405-3-prestwoj@gmail.com> (raw)
In-Reply-To: 20220112005558.1158405-1-prestwoj@gmail.com

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

IWD may be in the middle of some long operation, e.g. scanning.
If the URI is returned before IWD is ready, a configurator could
start sending frames and IWD either wont receive them, or will
be unable to respond quickly.
---
 src/dpp.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/dpp.c b/src/dpp.c
index 98d2a75c..c10ec978 100644
--- a/src/dpp.c
+++ b/src/dpp.c
@@ -118,6 +118,8 @@ struct dpp_sm {
 
 	struct dpp_configuration *config;
 	uint32_t connect_scan_id;
+
+	struct l_dbus_message *message;
 };
 
 static void dpp_free_auth_data(struct dpp_sm *dpp)
@@ -1257,6 +1259,15 @@ static void dpp_roc_started(void *user_data)
 
 	switch (dpp->state) {
 	case DPP_STATE_PRESENCE:
+		if (dpp->message) {
+			struct l_dbus_message *reply =
+				l_dbus_message_new_method_return(dpp->message);
+
+			l_dbus_message_set_arguments(reply, "s", dpp->uri);
+
+			dbus_pending_reply(&dpp->message, reply);
+		}
+
 		dpp_presence_announce(dpp);
 		break;
 	case DPP_STATE_AUTHENTICATING:
@@ -1694,7 +1705,6 @@ static struct l_dbus_message *dpp_dbus_start_enrollee(struct l_dbus *dbus,
 {
 	struct dpp_sm *dpp = user_data;
 	uint32_t freq = band_channel_to_freq(6, BAND_FREQ_2_4_GHZ);
-	struct l_dbus_message *reply;
 	struct station *station = station_find(netdev_get_ifindex(dpp->netdev));
 
 	if (dpp->state != DPP_STATE_NOTHING)
@@ -1720,6 +1730,8 @@ static struct l_dbus_message *dpp_dbus_start_enrollee(struct l_dbus *dbus,
 
 	l_debug("DPP Start Enrollee: %s", dpp->uri);
 
+	dpp->message = l_dbus_message_ref(message);
+
 	/*
 	 * Going off spec here. Select a single channel to send presence
 	 * announcements on. This will be advertised in the URI. The full
@@ -1727,11 +1739,7 @@ static struct l_dbus_message *dpp_dbus_start_enrollee(struct l_dbus *dbus,
 	 */
 	dpp_start_presence(dpp, &freq, 1);
 
-	reply = l_dbus_message_new_method_return(message);
-
-	l_dbus_message_set_arguments(reply, "s", dpp->uri);
-
-	return reply;
+	return NULL;
 }
 
 static struct l_dbus_message *dpp_dbus_start_configurator(struct l_dbus *dbus,
-- 
2.31.1

             reply	other threads:[~2022-01-12  0:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12  0:55 James Prestwood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-01-12 15:38 [PATCH 03/10] dpp: don't send StartEnrollee reply until offchannel starts 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=20220112005558.1158405-3-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