Notify the framework when an auxiliary event
occurs in wpa_supplicant.
Auxiliary events include:
- EAP_METHOD_SELECTED
- SSID_TEMP_DISABLED
- OPEN_SSL_FAILURE
Bug: 226140098
Bug: 165342942
Test: Manual test - trigger events and check that
onAuxilliaryEvent callback was called.
Change-Id: Ia1f137ddc1a4d91049668d6436652a0ad749c74f
diff --git a/wpa_supplicant/aidl/aidl.cpp b/wpa_supplicant/aidl/aidl.cpp
index f078e71..eb38497 100644
--- a/wpa_supplicant/aidl/aidl.cpp
+++ b/wpa_supplicant/aidl/aidl.cpp
@@ -22,6 +22,7 @@
}
using aidl::android::hardware::wifi::supplicant::AidlManager;
+using aidl::android::hardware::wifi::supplicant::AuxiliarySupplicantEventCode;
using aidl::android::hardware::wifi::supplicant::DppEventType;
using aidl::android::hardware::wifi::supplicant::DppFailureCode;
using aidl::android::hardware::wifi::supplicant::DppProgressCode;
@@ -961,3 +962,42 @@
cert_hash,
cert);
}
+
+void wpas_aidl_notify_auxiliary_event(struct wpa_supplicant *wpa_s,
+ AuxiliarySupplicantEventCode event_code, const char *reason_string)
+{
+ if (!wpa_s)
+ return;
+
+ AidlManager *aidl_manager = AidlManager::getInstance();
+ if (!aidl_manager)
+ return;
+
+ wpa_printf(MSG_DEBUG, "Notify auxiliary event, code=%d",
+ static_cast<int>(event_code));
+ aidl_manager->notifyAuxiliaryEvent(wpa_s, event_code, reason_string);
+}
+
+void wpas_aidl_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
+ const char *reason_string)
+{
+ wpas_aidl_notify_auxiliary_event(wpa_s,
+ AuxiliarySupplicantEventCode::EAP_METHOD_SELECTED,
+ reason_string);
+}
+
+void wpas_aidl_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
+ const char *reason_string)
+{
+ wpas_aidl_notify_auxiliary_event(wpa_s,
+ AuxiliarySupplicantEventCode::SSID_TEMP_DISABLED,
+ reason_string);
+}
+
+void wpas_aidl_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
+ const char *reason_string)
+{
+ wpas_aidl_notify_auxiliary_event(wpa_s,
+ AuxiliarySupplicantEventCode::OPEN_SSL_FAILURE,
+ reason_string);
+}
diff --git a/wpa_supplicant/aidl/aidl.h b/wpa_supplicant/aidl/aidl.h
index 71275e3..fcd462b 100644
--- a/wpa_supplicant/aidl/aidl.h
+++ b/wpa_supplicant/aidl/aidl.h
@@ -133,6 +133,12 @@
int num_altsubject,
const char *cert_hash,
const struct wpabuf *cert);
+ void wpas_aidl_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
+ const char *reason_string);
+ void wpas_aidl_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
+ const char *reason_string);
+ void wpas_aidl_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
+ const char *reason_string);
#else // CONFIG_CTRL_IFACE_AIDL
static inline int wpas_aidl_register_interface(struct wpa_supplicant *wpa_s)
{
@@ -293,6 +299,15 @@
const char *cert_hash,
const struct wpabuf *cert)
{}
+void wpas_aidl_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
+ const char *reason_string)
+{}
+void wpas_aidl_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
+ const char *reason_string)
+{}
+void wpas_aidl_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
+ const char *reason_string)
+{}
#endif // CONFIG_CTRL_IFACE_AIDL
#ifdef _cplusplus
diff --git a/wpa_supplicant/aidl/aidl_manager.cpp b/wpa_supplicant/aidl/aidl_manager.cpp
index f9f0412..e18292a 100644
--- a/wpa_supplicant/aidl/aidl_manager.cpp
+++ b/wpa_supplicant/aidl/aidl_manager.cpp
@@ -1546,7 +1546,8 @@
misc_utils::charBufToString(wpa_s->ifname),
std::bind(
&ISupplicantStaIfaceCallback::onEapFailure,
- std::placeholders::_1, std::vector<uint8_t>(), error_code));
+ std::placeholders::_1,
+ macAddrToVec(wpa_s->bssid), error_code));
}
/**
@@ -1967,6 +1968,22 @@
misc_utils::charBufToString(wpa_s->ifname), current_ssid->id, func);
}
+void AidlManager::notifyAuxiliaryEvent(struct wpa_supplicant *wpa_s,
+ AuxiliarySupplicantEventCode event_code, const char *reason_string)
+{
+ if (!wpa_s)
+ return;
+
+ const std::function<
+ ndk::ScopedAStatus(std::shared_ptr<ISupplicantStaIfaceCallback>)>
+ func = std::bind(
+ &ISupplicantStaIfaceCallback::onAuxiliarySupplicantEvent,
+ std::placeholders::_1, event_code, macAddrToVec(wpa_s->bssid),
+ misc_utils::charBufToString(reason_string));
+ callWithEachStaIfaceCallback(
+ misc_utils::charBufToString(wpa_s->ifname), func);
+}
+
/**
* Retrieve the |ISupplicantP2pIface| aidl object reference using the provided
* ifname.
diff --git a/wpa_supplicant/aidl/aidl_manager.h b/wpa_supplicant/aidl/aidl_manager.h
index babb2cc..15f8e28 100644
--- a/wpa_supplicant/aidl/aidl_manager.h
+++ b/wpa_supplicant/aidl/aidl_manager.h
@@ -150,6 +150,9 @@
int num_altsubject,
const char *cert_hash,
const struct wpabuf *cert);
+ void notifyAuxiliaryEvent(struct wpa_supplicant *wpa_s,
+ AuxiliarySupplicantEventCode event_code,
+ const char *reason_string);
// Methods called from aidl objects.
void notifyExtRadioWorkStart(struct wpa_supplicant *wpa_s, uint32_t id);