wpa/hostapd(hidl): Implementation of terminate
These invoke the same functions as the "TERMINATE" string command in the
socket interface. The terminate command aborts the daemon (& cleans up
hwbinder, etc).
Bug: 72394251
Test: Compiles
Change-Id: I23238ff103aa7198e86827c23e7ce77922e17049
diff --git a/hostapd/hidl/1.0/hostapd.cpp b/hostapd/hidl/1.0/hostapd.cpp
index 04e2840..3878037 100644
--- a/hostapd/hidl/1.0/hostapd.cpp
+++ b/hostapd/hidl/1.0/hostapd.cpp
@@ -17,6 +17,11 @@
#include "hostapd.h"
#include "hidl_return_util.h"
+extern "C"
+{
+#include "utils/eloop.h"
+}
+
// The HIDL implementation for hostapd creates a hostapd.conf dynamically for
// each interface. This file can then be used to hook onto the normal config
// file parsing logic in hostapd code. Helps us to avoid duplication of code
@@ -198,6 +203,12 @@
this, &Hostapd::removeAccessPointInternal, _hidl_cb, iface_name);
}
+Return<void> Hostapd::terminate() {
+ wpa_printf(MSG_INFO, "Terminating...");
+ eloop_terminate();
+ return Void();
+}
+
HostapdStatus Hostapd::addAccessPointInternal(
const IfaceParams& iface_params, const NetworkParams& nw_params)
{
diff --git a/hostapd/hidl/1.0/hostapd.h b/hostapd/hidl/1.0/hostapd.h
index d4f632e..7985fd9 100644
--- a/hostapd/hidl/1.0/hostapd.h
+++ b/hostapd/hidl/1.0/hostapd.h
@@ -49,6 +49,7 @@
Return<void> removeAccessPoint(
const hidl_string& iface_name,
removeAccessPoint_cb _hidl_cb) override;
+ Return<void> terminate() override;
private:
// Corresponding worker functions for the HIDL methods.
diff --git a/wpa_supplicant/hidl/1.1/supplicant.cpp b/wpa_supplicant/hidl/1.1/supplicant.cpp
index 950f0c7..f84ec10 100644
--- a/wpa_supplicant/hidl/1.1/supplicant.cpp
+++ b/wpa_supplicant/hidl/1.1/supplicant.cpp
@@ -118,6 +118,12 @@
return ((wpa_debug_show_keys != 0) ? true : false);
}
+Return<void> Supplicant::terminate() {
+ wpa_printf(MSG_INFO, "Terminating...");
+ wpa_supplicant_terminate_proc(wpa_global_);
+ return Void();
+}
+
std::pair<SupplicantStatus, sp<ISupplicantIface>>
Supplicant::addInterfaceInternal(const IfaceInfo& iface_info)
{
diff --git a/wpa_supplicant/hidl/1.1/supplicant.h b/wpa_supplicant/hidl/1.1/supplicant.h
index 75fb0db..327e061 100644
--- a/wpa_supplicant/hidl/1.1/supplicant.h
+++ b/wpa_supplicant/hidl/1.1/supplicant.h
@@ -62,6 +62,7 @@
Return<bool> isDebugShowKeysEnabled() override;
Return<void> setConcurrencyPriority(
IfaceType type, setConcurrencyPriority_cb _hidl_cb) override;
+ Return<void> terminate() override;
private:
// Corresponding worker functions for the HIDL methods.