3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 23:09:34 +01:00

dpp: handle protocol errors in ROC timeout

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.
This commit is contained in:
James Prestwood 2021-12-17 13:29:52 -08:00 committed by Denis Kenzior
parent 926c8bb9bd
commit d2240c4a62

View File

@ -1076,10 +1076,34 @@ static void dpp_presence_timeout(int error, void *user_data)
{ {
struct dpp_sm *dpp = user_data; struct dpp_sm *dpp = user_data;
if (dpp->state != DPP_STATE_PRESENCE) { /*
l_debug("DPP state changed, stopping presence announcements"); * If cancelled this is likely due to netdev going down or from Stop().
dpp->freqs_idx = 0; * Otherwise there was some other problem which is probably not
* recoverable.
*/
if (error == -ECANCELED)
return; 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++; 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->offchannel_id = offchannel_start(netdev_get_wdev_id(dpp->netdev),
dpp->current_freq, dpp->dwell, dpp_roc_started, dpp->current_freq, dpp->dwell, dpp_roc_started,
dpp, dpp_presence_timeout); dpp, dpp_presence_timeout);
return;
protocol_failed:
dpp_reset(dpp);
return;
} }
/* /*