All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v5 4/4] dpp: handle protocol errors in ROC timeout
@ 2021-12-17 20:23 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-12-17 20:23 UTC (permalink / raw)
  To: iwd

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

Hi James,

On 12/17/21 13:14, James Prestwood wrote:
> This is a standing TODO of properly handling these timeouts but
> for now just treat any ROC timeout as an error if authenticating
> or configuring.
> ---
>   src/dpp.c | 36 +++++++++++++++++++++++++++++++++---
>   1 file changed, 33 insertions(+), 3 deletions(-)
> 
> diff --git a/src/dpp.c b/src/dpp.c

<snip>

> @@ -1091,6 +1115,12 @@ static void dpp_presence_timeout(int error, void *user_data)
>   	dpp->offchannel_id = offchannel_start(netdev_get_wdev_id(dpp->netdev),
>   			dpp->current_freq, dpp->dwell, dpp_roc_started,
>   			dpp, dpp_presence_timeout);
> +	return;
> +
> +protocol_failed:
> +	dpp_reset(dpp);
> +	dpp_free_auth_data(dpp);

Isn't dpp_reset already calling dpp_free_auth_data?

> +	return;
>   }
>   
>   /*
> 

Regards,
-Denis

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

* [PATCH v5 4/4] dpp: handle protocol errors in ROC timeout
@ 2021-12-17 19:14 James Prestwood
  0 siblings, 0 replies; 2+ messages in thread
From: James Prestwood @ 2021-12-17 19:14 UTC (permalink / raw)
  To: iwd

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

This is a standing TODO of properly handling these timeouts but
for now just treat any ROC timeout as an error if authenticating
or configuring.
---
 src/dpp.c | 36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/src/dpp.c b/src/dpp.c
index cf322e7d..f86ea6bd 100644
--- a/src/dpp.c
+++ b/src/dpp.c
@@ -1070,10 +1070,34 @@ static void dpp_presence_timeout(int error, void *user_data)
 {
 	struct dpp_sm *dpp = user_data;
 
-	if (dpp->state != DPP_STATE_PRESENCE) {
-		l_debug("DPP state changed, stopping presence announcements");
-		dpp->freqs_idx = 0;
+	/*
+	 * If cancelled this is likely due to netdev going down or from Stop().
+	 * Otherwise there was some other problem which is probably not
+	 * recoverable.
+	 */
+	if (error == -ECANCELED)
 		return;
+	else if (error < 0)
+		goto protocol_failed;
+
+	switch (dpp->state) {
+	case DPP_STATE_PRESENCE:
+		break;
+	case DPP_STATE_NOTHING:
+		/* Protocol already terminated */
+		return;
+	case DPP_STATE_AUTHENTICATING:
+	case DPP_STATE_CONFIGURING:
+		/*
+		 * TODO: If either the auth or config protocol is running we
+		 * need to stay on channel until the specified timeouts.
+		 * Unfortunately the kernel makes this very inconvenient since
+		 * there is no way to stay on channel indefinitely or any way
+		 * of knowing what duration the kernel/card actually chooses.
+		 *
+		 * For now just treat this as a failure.
+		 */
+		goto protocol_failed;
 	}
 
 	dpp->freqs_idx++;
@@ -1091,6 +1115,12 @@ static void dpp_presence_timeout(int error, void *user_data)
 	dpp->offchannel_id = offchannel_start(netdev_get_wdev_id(dpp->netdev),
 			dpp->current_freq, dpp->dwell, dpp_roc_started,
 			dpp, dpp_presence_timeout);
+	return;
+
+protocol_failed:
+	dpp_reset(dpp);
+	dpp_free_auth_data(dpp);
+	return;
 }
 
 /*
-- 
2.31.1

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

end of thread, other threads:[~2021-12-17 20:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 20:23 [PATCH v5 4/4] dpp: handle protocol errors in ROC timeout Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2021-12-17 19:14 James Prestwood

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.