Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH 03/10] dpp: don't send StartEnrollee reply until offchannel starts
@ 2022-01-12  0:55 James Prestwood
  0 siblings, 0 replies; 2+ messages in thread
From: James Prestwood @ 2022-01-12  0:55 UTC (permalink / raw)
  To: iwd 

[-- 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 03/10] dpp: don't send StartEnrollee reply until offchannel starts
@ 2022-01-12 15:38 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2022-01-12 15:38 UTC (permalink / raw)
  To: iwd 

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

Hi James,

On 1/11/22 18:55, James Prestwood wrote:
> 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;

We customarily call this member 'pending', so I changed this naming and applied.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-12 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-12  0:55 [PATCH 03/10] dpp: don't send StartEnrollee reply until offchannel starts James Prestwood
  -- strict thread matches above, loose matches on Subject: below --
2022-01-12 15:38 Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox