Process DPP connection status result
Modified the DPP configuration received callback
function to include the connection status requested
flag.
Added a new callback function to indicate to the
framework that DPP connection status frame is sent
Bug: 235844564
Test: Manual - Ran DPP tests and confirmed that
connection status frame is processed correctly
Change-Id: I7e4af2e88abc16e32856f19750520d74e7736653
diff --git a/src/common/dpp.h b/src/common/dpp.h
index ee29a08..3094be8 100644
--- a/src/common/dpp.h
+++ b/src/common/dpp.h
@@ -296,6 +296,7 @@
enum dpp_status_error auth_resp_status;
enum dpp_status_error conf_resp_status;
enum dpp_status_error force_conf_resp_status;
+ enum dpp_status_error conn_result_status;
u8 peer_mac_addr[ETH_ALEN];
u8 i_nonce[DPP_MAX_NONCE_LEN];
u8 r_nonce[DPP_MAX_NONCE_LEN];
@@ -340,6 +341,7 @@
int connect_on_tx_status;
int waiting_conf_result;
int waiting_conn_status_result;
+ int tx_conn_status_result_started;
int auth_success;
bool reconfig_success;
struct wpabuf *conf_req;
diff --git a/wpa_supplicant/aidl/aidl.cpp b/wpa_supplicant/aidl/aidl.cpp
index a7945cc..715ab60 100644
--- a/wpa_supplicant/aidl/aidl.cpp
+++ b/wpa_supplicant/aidl/aidl.cpp
@@ -671,7 +671,7 @@
}
void wpas_aidl_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
+ struct wpa_ssid *ssid, bool conn_status_requested)
{
if (!wpa_s || !ssid)
return;
@@ -684,7 +684,7 @@
if (!aidl_manager)
return;
- aidl_manager->notifyDppConfigReceived(wpa_s, ssid);
+ aidl_manager->notifyDppConfigReceived(wpa_s, ssid, conn_status_requested);
}
void wpas_aidl_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
@@ -692,6 +692,21 @@
wpas_aidl_notify_dpp_success(wpa_s, DppEventType::CONFIGURATION_SENT);
}
+void wpas_aidl_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
+ enum dpp_status_error result)
+{
+ if (!wpa_s)
+ return;
+
+ wpa_printf(MSG_DEBUG, "wpas_aidl_notify_dpp_connection_status_sent %d ", result);
+
+ AidlManager *aidl_manager = AidlManager::getInstance();
+ if (!aidl_manager)
+ return;
+
+ aidl_manager->notifyDppConnectionStatusSent(wpa_s, result);
+}
+
/* DPP Progress notifications */
void wpas_aidl_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
{
diff --git a/wpa_supplicant/aidl/aidl.h b/wpa_supplicant/aidl/aidl.h
index 2f3c7a0..8865f66 100644
--- a/wpa_supplicant/aidl/aidl.h
+++ b/wpa_supplicant/aidl/aidl.h
@@ -103,8 +103,10 @@
void wpas_aidl_notify_eap_error(
struct wpa_supplicant *wpa_s, int error_code);
void wpas_aidl_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
+ struct wpa_ssid *ssid, bool conn_status_requested);
void wpas_aidl_notify_dpp_config_sent(struct wpa_supplicant *wpa_s);
+ void wpas_aidl_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
+ enum dpp_status_error result);
void wpas_aidl_notify_dpp_auth_success(struct wpa_supplicant *wpa_s);
void wpas_aidl_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s);
void wpas_aidl_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s);
@@ -252,12 +254,13 @@
struct wpa_supplicant *wpa_s, int error_code)
{}
static void wpas_aidl_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
+ struct wpa_ssid *ssid, bool conn_status_requested)
{}
-static void wpas_aidl_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
static void wpas_aidl_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
{}
+void wpas_aidl_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
+ enum dpp_status_error result)
+{}
static void wpas_aidl_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
{}
static void wpas_aidl_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
diff --git a/wpa_supplicant/aidl/aidl_manager.cpp b/wpa_supplicant/aidl/aidl_manager.cpp
index 33ad650..9a1a83d 100644
--- a/wpa_supplicant/aidl/aidl_manager.cpp
+++ b/wpa_supplicant/aidl/aidl_manager.cpp
@@ -1570,19 +1570,18 @@
* @param config Configuration object
*/
void AidlManager::notifyDppConfigReceived(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *config)
+ struct wpa_ssid *config, bool conn_status_requested)
{
- DppAkm securityAkm;
- DppConnectionKeys aidl_keys{};
std::string aidl_ifname = misc_utils::charBufToString(wpa_s->ifname);
+ DppConfigurationData aidl_dpp_config_data = {};
if ((config->key_mgmt & WPA_KEY_MGMT_SAE) &&
(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SAE)) {
- securityAkm = DppAkm::SAE;
+ aidl_dpp_config_data.securityAkm = DppAkm::SAE;
} else if (config->key_mgmt & WPA_KEY_MGMT_PSK) {
- securityAkm = DppAkm::PSK;
+ aidl_dpp_config_data.securityAkm = DppAkm::PSK;
} else if (config->key_mgmt & WPA_KEY_MGMT_DPP) {
- securityAkm = DppAkm::DPP;
+ aidl_dpp_config_data.securityAkm = DppAkm::DPP;
} else {
/* Unsupported AKM */
wpa_printf(MSG_ERROR, "DPP: Error: Unsupported AKM 0x%X",
@@ -1591,29 +1590,31 @@
return;
}
- std::string passphrase = misc_utils::charBufToString(config->passphrase);
+ aidl_dpp_config_data.password = misc_utils::charBufToString(config->passphrase);
+ aidl_dpp_config_data.psk = byteArrToVec(config->psk, 32);
std::vector<uint8_t> aidl_ssid(
config->ssid,
config->ssid + config->ssid_len);
+ aidl_dpp_config_data.ssid = aidl_ssid;
- if (securityAkm == DppAkm::DPP) {
+ if (aidl_dpp_config_data.securityAkm == DppAkm::DPP) {
std::string connector_str = misc_utils::charBufToString(config->dpp_connector);
- aidl_keys.connector = std::vector<uint8_t>(connector_str.begin(),
- connector_str.end());
- aidl_keys.cSign = byteArrToVec(config->dpp_csign, config->dpp_csign_len);
- aidl_keys.netAccessKey = byteArrToVec(config->dpp_netaccesskey,
- config->dpp_netaccesskey_len);
+ aidl_dpp_config_data.dppConnectionKeys.connector
+ = std::vector<uint8_t>(connector_str.begin(), connector_str.end());
+ aidl_dpp_config_data.dppConnectionKeys.cSign
+ = byteArrToVec(config->dpp_csign, config->dpp_csign_len);
+ aidl_dpp_config_data.dppConnectionKeys.netAccessKey
+ = byteArrToVec(config->dpp_netaccesskey, config->dpp_netaccesskey_len);
}
+ aidl_dpp_config_data.connStatusRequested = conn_status_requested;
/* At this point, the network is already registered, notify about new
* received configuration
*/
callWithEachStaIfaceCallback(aidl_ifname,
std::bind(
- &ISupplicantStaIfaceCallback::onDppSuccessConfigReceived,
- std::placeholders::_1, aidl_ssid, passphrase,
- byteArrToVec(config->psk, 32), securityAkm,
- aidl_keys));
+ &ISupplicantStaIfaceCallback::onDppConfigReceived,
+ std::placeholders::_1, aidl_dpp_config_data));
}
/**
@@ -1630,6 +1631,55 @@
std::placeholders::_1));
}
+DppStatusErrorCode convertSupplicantDppStatusErrorCodeToAidl(
+ enum dpp_status_error code)
+{
+ switch (code) {
+ case DPP_STATUS_OK:
+ return DppStatusErrorCode::SUCCESS;
+ case DPP_STATUS_NOT_COMPATIBLE:
+ return DppStatusErrorCode::NOT_COMPATIBLE;
+ case DPP_STATUS_AUTH_FAILURE:
+ return DppStatusErrorCode::AUTH_FAILURE;
+ case DPP_STATUS_UNWRAP_FAILURE:
+ return DppStatusErrorCode::UNWRAP_FAILURE;
+ case DPP_STATUS_BAD_GROUP:
+ return DppStatusErrorCode::BAD_GROUP;
+ case DPP_STATUS_CONFIGURE_FAILURE:
+ return DppStatusErrorCode::CONFIGURE_FAILURE;
+ case DPP_STATUS_RESPONSE_PENDING:
+ return DppStatusErrorCode::RESPONSE_PENDING;
+ case DPP_STATUS_INVALID_CONNECTOR:
+ return DppStatusErrorCode::INVALID_CONNECTOR;
+ case DPP_STATUS_CONFIG_REJECTED:
+ return DppStatusErrorCode::CONFIG_REJECTED;
+ case DPP_STATUS_NO_MATCH:
+ return DppStatusErrorCode::NO_MATCH;
+ case DPP_STATUS_NO_AP:
+ return DppStatusErrorCode::NO_AP;
+ case DPP_STATUS_CONFIGURE_PENDING:
+ return DppStatusErrorCode::CONFIGURE_PENDING;
+ case DPP_STATUS_CSR_NEEDED:
+ return DppStatusErrorCode::CSR_NEEDED;
+ case DPP_STATUS_CSR_BAD:
+ return DppStatusErrorCode::CSR_BAD;
+ case DPP_STATUS_NEW_KEY_NEEDED:
+ return DppStatusErrorCode::NEW_KEY_NEEDED;
+ default:
+ return DppStatusErrorCode::UNKNOWN;
+ }
+}
+
+void AidlManager::notifyDppConnectionStatusSent(struct wpa_supplicant *wpa_s,
+ enum dpp_status_error result)
+{
+ std::string aidl_ifname = misc_utils::charBufToString(wpa_s->ifname);
+ callWithEachStaIfaceCallback(aidl_ifname,
+ std::bind(&ISupplicantStaIfaceCallback::onDppConnectionStatusResultSent,
+ std::placeholders::_1,
+ convertSupplicantDppStatusErrorCodeToAidl(result)));
+}
+
/**
* Notify listener about a DPP failure event
*
diff --git a/wpa_supplicant/aidl/aidl_manager.h b/wpa_supplicant/aidl/aidl_manager.h
index 1ed6899..c29f957 100644
--- a/wpa_supplicant/aidl/aidl_manager.h
+++ b/wpa_supplicant/aidl/aidl_manager.h
@@ -125,8 +125,11 @@
const u8 *p2p_dev_addr);
void notifyEapError(struct wpa_supplicant *wpa_s, int error_code);
void notifyDppConfigReceived(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *config);
+ struct wpa_ssid *config,
+ bool conn_status_requested);
void notifyDppConfigSent(struct wpa_supplicant *wpa_s);
+ void notifyDppConnectionStatusSent(struct wpa_supplicant *wpa_s,
+ enum dpp_status_error result);
void notifyDppSuccess(struct wpa_supplicant *wpa_s, DppEventType code);
void notifyDppFailure(struct wpa_supplicant *wpa_s,
DppFailureCode code);
diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c
index 55dcd70..593da3a 100644
--- a/wpa_supplicant/dpp_supplicant.c
+++ b/wpa_supplicant/dpp_supplicant.c
@@ -419,12 +419,21 @@
DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d",
MAC2STR(auth->peer_mac_addr), auth->curr_freq,
DPP_PA_CONNECTION_STATUS_RESULT);
- offchannel_send_action(wpa_s, auth->curr_freq,
- auth->peer_mac_addr, wpa_s->own_addr, broadcast,
- wpabuf_head(msg), wpabuf_len(msg),
- 500, wpas_dpp_tx_status, 0);
+ if (offchannel_send_action(wpa_s, auth->curr_freq,
+ auth->peer_mac_addr, wpa_s->own_addr, broadcast,
+ wpabuf_head(msg), wpabuf_len(msg),
+ 500, wpas_dpp_tx_status, 0) < 0) {
+ wpas_notify_dpp_connection_status_sent(wpa_s, result);
+ wpabuf_free(msg);
+ dpp_auth_deinit(wpa_s->dpp_auth);
+ wpa_s->dpp_auth = NULL;
+ return;
+ }
+
wpabuf_free(msg);
+ auth->conn_result_status = result;
+ auth->tx_conn_status_result_started = 1;
/* This exchange will be terminated in the TX status handler */
auth->remove_on_tx_status = 1;
@@ -491,6 +500,9 @@
#endif /* CONFIG_DPP2 */
if (wpa_s->dpp_auth->remove_on_tx_status) {
+ if (auth->tx_conn_status_result_started) {
+ wpas_notify_dpp_connection_status_sent(wpa_s, auth->conn_result_status);
+ }
wpa_printf(MSG_DEBUG,
"DPP: Terminate authentication exchange due to a request to do so on TX status");
eloop_cancel_timeout(wpas_dpp_init_timeout, wpa_s, NULL);
@@ -1476,7 +1488,7 @@
wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_NETWORK_ID "%d", ssid->id);
- wpas_notify_dpp_config_received(wpa_s, ssid);
+ wpas_notify_dpp_config_received(wpa_s, ssid, auth->conn_status_requested ? 1 : 0);
if (wpa_s->conf->dpp_config_processing == 2)
ssid->disabled = 0;
@@ -1829,7 +1841,7 @@
wpabuf_free(msg);
/* This exchange will be terminated in the TX status handler */
- if (wpa_s->conf->dpp_config_processing < 2 ||
+ if (wpa_s->conf->dpp_config_processing < 1 ||
wpa_s->dpp_conf_backup_received)
auth->remove_on_tx_status = 1;
return;
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index a544c94..1ad8dca 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -1103,13 +1103,13 @@
/* DPP Success notifications */
void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid)
+ struct wpa_ssid *ssid, bool conn_status_requested)
{
#ifdef CONFIG_DPP
if (!wpa_s)
return;
- wpas_aidl_notify_dpp_config_received(wpa_s, ssid);
+ wpas_aidl_notify_dpp_config_received(wpa_s, ssid, conn_status_requested);
#endif /* CONFIG_DPP */
}
@@ -1123,6 +1123,17 @@
#endif /* CONFIG_DPP */
}
+void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
+ enum dpp_status_error result)
+{
+#ifdef CONFIG_DPP2
+ if (!wpa_s)
+ return;
+
+ wpas_aidl_notify_dpp_connection_status_sent(wpa_s, result);
+#endif /* CONFIG_DPP2 */
+}
+
/* DPP Progress notifications */
void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
{
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index 996be84..9957a04 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -180,8 +180,10 @@
void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
struct wpa_supplicant *wpa_s, const char *url);
void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
- struct wpa_ssid *ssid);
+ struct wpa_ssid *ssid, bool conn_status_requested);
void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s);
+void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
+ enum dpp_status_error result);
void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s);
void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s);
void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s);