Revert "Revert "[wpa_supplicant] cumilative patch from commit 3a..."
Revert submission 28102966-revert-26533062-Supplicant_merge_June24-CUATTSRBBR
Reason for revert: Fixed the regression issue (ag/28389573)
Reverted changes: /q/submissionid:28102966-revert-26533062-Supplicant_merge_June24-CUATTSRBBR
Bug: 329004037
Test: Turn ON/OFF SoftAp multiple times
Change-Id: Ibfff2a847be5678f1a6d77e28506a05936812a91
diff --git a/src/common/dpp_tcp.c b/src/common/dpp_tcp.c
index d226a8a..2fad3e1 100644
--- a/src/common/dpp_tcp.c
+++ b/src/common/dpp_tcp.c
@@ -563,7 +563,7 @@
struct dpp_connection *conn;
dl_list_for_each(conn, &ctrl->conn, struct dpp_connection, list) {
- if (os_memcmp(src, conn->mac_addr, ETH_ALEN) == 0)
+ if (ether_addr_equal(src, conn->mac_addr))
return conn;
if ((type == DPP_PA_PKEX_EXCHANGE_RESP ||
type == DPP_PA_AUTHENTICATION_RESP) &&
@@ -661,7 +661,7 @@
struct dpp_connection *conn;
dl_list_for_each(conn, &ctrl->conn, struct dpp_connection, list) {
- if (os_memcmp(src, conn->mac_addr, ETH_ALEN) == 0)
+ if (ether_addr_equal(src, conn->mac_addr))
return conn;
}
@@ -2601,7 +2601,8 @@
}
-static void dpp_tcp_send_conn_status_msg(struct dpp_connection *conn,
+static void dpp_tcp_send_conn_status_msg(struct dpp_global *dpp,
+ struct dpp_connection *conn,
enum dpp_status_error result,
const u8 *ssid, size_t ssid_len,
const char *channel_list)
@@ -2609,6 +2610,7 @@
struct dpp_authentication *auth = conn->auth;
int res;
struct wpabuf *msg;
+ struct dpp_connection *c;
auth->conn_status_requested = 0;
@@ -2627,8 +2629,16 @@
return;
}
- /* This exchange will be terminated in the TX status handler */
- conn->on_tcp_tx_complete_remove = 1;
+ /* conn might have been removed during the dpp_tcp_send_msg() call, so
+ * need to check that it is still present before modifying it. */
+ dl_list_for_each(c, &dpp->tcp_init, struct dpp_connection, list) {
+ if (conn == c) {
+ /* This exchange will be terminated in the TX status
+ * handler */
+ conn->on_tcp_tx_complete_remove = 1;
+ break;
+ }
+ }
}
@@ -2641,7 +2651,7 @@
dl_list_for_each(conn, &dpp->tcp_init, struct dpp_connection, list) {
if (conn->auth && conn->auth->conn_status_requested) {
- dpp_tcp_send_conn_status_msg(conn, result, ssid,
+ dpp_tcp_send_conn_status_msg(dpp, conn, result, ssid,
ssid_len, channel_list);
break;
}