commit ad1e5252f3bbc2768768cff95d683a56752b3f2e
parent f717480c1805bf5bb0c8fd1e86ac176f0f541c47
Author: James Prestwood <prestwoj@gmail.com>
Date: Mon, 28 Mar 2022 10:28:40 -0700
dpp: fail if disconnected during DPP protocol
If the connected BSS is NULL IWD was disconnected and this should
trigger a protocol termination.
Diffstat:
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/dpp.c b/src/dpp.c
@@ -1294,7 +1294,7 @@ static void dpp_presence_announce(struct dpp_sm *dpp)
dpp_send_frame(dpp, iov, 2, dpp->current_freq);
}
-static void dpp_send_authenticate_request(struct dpp_sm *dpp)
+static bool dpp_send_authenticate_request(struct dpp_sm *dpp)
{
uint8_t hdr[32];
uint8_t attrs[256];
@@ -1305,6 +1305,12 @@ static void dpp_send_authenticate_request(struct dpp_sm *dpp)
struct station *station = station_find(netdev_get_ifindex(dpp->netdev));
struct scan_bss *bss = station_get_connected_bss(station);
+ /* Got disconnected by the time the peer was discovered */
+ if (!bss) {
+ dpp_reset(dpp);
+ return false;
+ }
+
l_ecc_point_get_data(dpp->own_proto_public, i_proto_key,
sizeof(i_proto_key));
@@ -1337,6 +1343,8 @@ static void dpp_send_authenticate_request(struct dpp_sm *dpp)
iov[1].iov_len = ptr - attrs;
dpp_send_frame(dpp, iov, 2, dpp->current_freq);
+
+ return true;
}
static void dpp_roc_started(void *user_data)
@@ -1948,7 +1956,8 @@ static void dpp_handle_presence_announcement(struct dpp_sm *dpp,
dpp->state = DPP_STATE_AUTHENTICATING;
- dpp_send_authenticate_request(dpp);
+ if (!dpp_send_authenticate_request(dpp))
+ return;
/*
* Should we wait for an ACK then go offchannel?