From: James Prestwood <prestwoj at gmail.com>
To: iwd at lists.01.org
Subject: [PATCH v6 2/2] dpp: handle protocol errors in ROC timeout
Date: Fri, 17 Dec 2021 13:29:52 -0800 [thread overview]
Message-ID: <20211217212952.228229-2-prestwoj@gmail.com> (raw)
In-Reply-To: 20211217212952.228229-1-prestwoj@gmail.com
[-- Attachment #1: Type: text/plain, Size: 1931 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 | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
v6:
* Removed unneeded call to dpp_free_auth_data
diff --git a/src/dpp.c b/src/dpp.c
index c703de75..5e125265 100644
--- a/src/dpp.c
+++ b/src/dpp.c
@@ -1076,10 +1076,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++;
@@ -1097,6 +1121,11 @@ 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);
+ return;
}
/*
--
2.31.1
reply other threads:[~2021-12-17 21:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211217212952.228229-2-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