Merge "Wifi: WAPI HAL skeleton"
diff --git a/hostapd/Android.mk b/hostapd/Android.mk
index d0b6b85..eb01da5 100644
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -1119,6 +1119,7 @@
LOCAL_MODULE_TAGS := optional
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_VINTF_FRAGMENTS := android.hardware.wifi.hostapd.xml
ifdef CONFIG_DRIVER_CUSTOM
LOCAL_STATIC_LIBRARIES := libCustomWifi
endif
@@ -1136,6 +1137,7 @@
ifeq ($(HOSTAPD_USE_HIDL), y)
LOCAL_SHARED_LIBRARIES += android.hardware.wifi.hostapd@1.0
LOCAL_SHARED_LIBRARIES += android.hardware.wifi.hostapd@1.1
+LOCAL_SHARED_LIBRARIES += android.hardware.wifi.hostapd@1.2
LOCAL_SHARED_LIBRARIES += libbase libhidlbase libutils
LOCAL_STATIC_LIBRARIES += libhostapd_hidl
endif
@@ -1178,13 +1180,14 @@
LOCAL_CPPFLAGS := $(L_CPPFLAGS)
LOCAL_CFLAGS := $(L_CFLAGS)
LOCAL_C_INCLUDES := $(INCLUDES)
-HIDL_INTERFACE_VERSION = 1.1
+HIDL_INTERFACE_VERSION = 1.2
LOCAL_SRC_FILES := \
hidl/$(HIDL_INTERFACE_VERSION)/hidl.cpp \
hidl/$(HIDL_INTERFACE_VERSION)/hostapd.cpp
LOCAL_SHARED_LIBRARIES := \
android.hardware.wifi.hostapd@1.0 \
android.hardware.wifi.hostapd@1.1 \
+ android.hardware.wifi.hostapd@1.2 \
libbase \
libhidlbase \
libutils \
diff --git a/hostapd/android.hardware.wifi.hostapd.xml b/hostapd/android.hardware.wifi.hostapd.xml
new file mode 100644
index 0000000..4dc1701
--- /dev/null
+++ b/hostapd/android.hardware.wifi.hostapd.xml
@@ -0,0 +1,11 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.wifi.hostapd</name>
+ <transport>hwbinder</transport>
+ <version>1.2</version>
+ <interface>
+ <name>IHostapd</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/hostapd/hidl/1.1/hostapd.h b/hostapd/hidl/1.1/hostapd.h
deleted file mode 100644
index e2b4ba8..0000000
--- a/hostapd/hidl/1.1/hostapd.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * hidl interface for wpa_hostapd daemon
- * Copyright (c) 2004-2018, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2018, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef HOSTAPD_HIDL_SUPPLICANT_H
-#define HOSTAPD_HIDL_SUPPLICANT_H
-
-#include <string>
-
-#include <android-base/macros.h>
-
-#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
-#include <android/hardware/wifi/hostapd/1.1/IHostapdCallback.h>
-
-extern "C"
-{
-#include "utils/common.h"
-#include "utils/includes.h"
-#include "utils/wpa_debug.h"
-#include "ap/hostapd.h"
-}
-
-namespace android {
-namespace hardware {
-namespace wifi {
-namespace hostapd {
-namespace V1_1 {
-namespace implementation {
-using namespace android::hardware::wifi::hostapd::V1_0;
-
-/**
- * Implementation of the hostapd hidl object. This hidl
- * object is used core for global control operations on
- * hostapd.
- */
-class Hostapd : public V1_1::IHostapd
-{
-public:
- Hostapd(hapd_interfaces* interfaces);
- ~Hostapd() override = default;
-
- // Hidl methods exposed.
- Return<void> addAccessPoint(
- const V1_0::IHostapd::IfaceParams& iface_params,
- const NetworkParams& nw_params, addAccessPoint_cb _hidl_cb) override;
- Return<void> addAccessPoint_1_1(
- const IfaceParams& iface_params, const NetworkParams& nw_params,
- addAccessPoint_cb _hidl_cb) override;
- Return<void> removeAccessPoint(
- const hidl_string& iface_name,
- removeAccessPoint_cb _hidl_cb) override;
- Return<void> terminate() override;
- Return<void> registerCallback(
- const sp<IHostapdCallback>& callback,
- registerCallback_cb _hidl_cb) override;
-
-private:
- // Corresponding worker functions for the HIDL methods.
- HostapdStatus addAccessPointInternal(
- const V1_0::IHostapd::IfaceParams& iface_params,
- const NetworkParams& nw_params);
- HostapdStatus addAccessPointInternal_1_1(
- const IfaceParams& IfaceParams, const NetworkParams& nw_params);
- HostapdStatus removeAccessPointInternal(const std::string& iface_name);
- HostapdStatus registerCallbackInternal(
- const sp<IHostapdCallback>& callback);
-
- // Raw pointer to the global structure maintained by the core.
- struct hapd_interfaces* interfaces_;
- // Callbacks registered.
- std::vector<sp<IHostapdCallback>> callbacks_;
-
- DISALLOW_COPY_AND_ASSIGN(Hostapd);
-};
-} // namespace implementation
-} // namespace V1_1
-} // namespace hostapd
-} // namespace wifi
-} // namespace hardware
-} // namespace android
-
-#endif // HOSTAPD_HIDL_SUPPLICANT_H
diff --git a/hostapd/hidl/1.1/hidl.cpp b/hostapd/hidl/1.2/hidl.cpp
similarity index 93%
rename from hostapd/hidl/1.1/hidl.cpp
rename to hostapd/hidl/1.2/hidl.cpp
index 2051e7b..4bde312 100644
--- a/hostapd/hidl/1.1/hidl.cpp
+++ b/hostapd/hidl/1.2/hidl.cpp
@@ -22,8 +22,8 @@
using android::hardware::configureRpcThreadpool;
using android::hardware::IPCThreadState;
-using android::hardware::wifi::hostapd::V1_1::IHostapd;
-using android::hardware::wifi::hostapd::V1_1::implementation::Hostapd;
+using android::hardware::wifi::hostapd::V1_2::IHostapd;
+using android::hardware::wifi::hostapd::V1_2::implementation::Hostapd;
// This file is a bridge between the hostapd code written in 'C' and the HIDL
// interface in C++. So, using "C" style static globals here!
diff --git a/hostapd/hidl/1.1/hidl.h b/hostapd/hidl/1.2/hidl.h
similarity index 100%
rename from hostapd/hidl/1.1/hidl.h
rename to hostapd/hidl/1.2/hidl.h
diff --git a/hostapd/hidl/1.1/hidl_return_util.h b/hostapd/hidl/1.2/hidl_return_util.h
similarity index 83%
rename from hostapd/hidl/1.1/hidl_return_util.h
rename to hostapd/hidl/1.2/hidl_return_util.h
index d914ee2..81742f8 100644
--- a/hostapd/hidl/1.1/hidl_return_util.h
+++ b/hostapd/hidl/1.2/hidl_return_util.h
@@ -16,7 +16,7 @@
namespace hardware {
namespace wifi {
namespace hostapd {
-namespace V1_1 {
+namespace V1_2 {
namespace implementation {
namespace hidl_return_util {
@@ -25,18 +25,17 @@
* HIDL interface object.
*/
// Use for HIDL methods which return only an instance of HostapdStatus.
-template <typename ObjT, typename WorkFuncT, typename... Args>
+template <typename ObjT, typename WorkFuncT, typename StatusT, typename... Args>
Return<void> call(
ObjT* obj, WorkFuncT&& work,
- const std::function<void(const HostapdStatus&)>& hidl_cb, Args&&... args)
+ const std::function<void(const StatusT&)>& hidl_cb, Args&&... args)
{
hidl_cb((obj->*work)(std::forward<Args>(args)...));
return Void();
}
-
} // namespace hidl_return_util
} // namespace implementation
-} // namespace V1_1
+} // namespace V1_2
} // namespace hostapd
} // namespace wifi
} // namespace hardware
diff --git a/hostapd/hidl/1.1/hostapd.cpp b/hostapd/hidl/1.2/hostapd.cpp
similarity index 67%
rename from hostapd/hidl/1.1/hostapd.cpp
rename to hostapd/hidl/1.2/hostapd.cpp
index 0298537..2b7fd15 100644
--- a/hostapd/hidl/1.1/hostapd.cpp
+++ b/hostapd/hidl/1.2/hostapd.cpp
@@ -33,7 +33,7 @@
using android::base::RemoveFileIfExists;
using android::base::StringPrintf;
using android::base::WriteStringToFile;
-using android::hardware::wifi::hostapd::V1_1::IHostapd;
+using android::hardware::wifi::hostapd::V1_2::IHostapd;
std::string WriteHostapdConfig(
const std::string& interface_name, const std::string& config)
@@ -126,13 +126,13 @@
}
std::string channel_config_as_string;
- if (iface_params.V1_0.channelParams.enableAcs) {
+ if (iface_params.V1_1.V1_0.channelParams.enableAcs) {
std::string chanlist_as_string;
for (const auto &range :
- iface_params.channelParams.acsChannelRanges) {
+ iface_params.V1_1.channelParams.acsChannelRanges) {
if (range.start != range.end) {
chanlist_as_string +=
- StringPrintf("%d-%d ", range.start, range.end);
+ StringPrintf("%d-%d ", range.start, range.end);
} else {
chanlist_as_string += StringPrintf("%d ", range.start);
}
@@ -141,39 +141,47 @@
"channel=0\n"
"acs_exclude_dfs=%d\n"
"chanlist=%s",
- iface_params.V1_0.channelParams.acsShouldExcludeDfs,
+ iface_params.V1_1.V1_0.channelParams.acsShouldExcludeDfs,
chanlist_as_string.c_str());
} else {
channel_config_as_string = StringPrintf(
- "channel=%d", iface_params.V1_0.channelParams.channel);
+ "channel=%d", iface_params.V1_1.V1_0.channelParams.channel);
}
// Hw Mode String
+ // TODO: b/146186687 Still missing the handling when 6GHz band is included
std::string hw_mode_as_string;
std::string ht_cap_vht_oper_chwidth_as_string;
- switch (iface_params.V1_0.channelParams.band) {
- case IHostapd::Band::BAND_2_4_GHZ:
- hw_mode_as_string = "hw_mode=g";
- break;
- case IHostapd::Band::BAND_5_GHZ:
- hw_mode_as_string = "hw_mode=a";
- if (iface_params.V1_0.channelParams.enableAcs) {
- ht_cap_vht_oper_chwidth_as_string =
- "ht_capab=[HT40+]\n"
- "vht_oper_chwidth=1";
+ unsigned int band = 0;
+ if (iface_params.V1_1.V1_0.channelParams.enableAcs) {
+ band |= iface_params.channelParams.bandMask;
+ } else {
+ band |= iface_params.V1_1.V1_0.channelParams.band;
+ }
+
+ if ((band & IHostapd::BandMask::BAND_2_GHZ) != 0) {
+ if ((band & IHostapd::BandMask::BAND_5_GHZ) != 0) {
+ hw_mode_as_string = "hw_mode=any";
+ if (iface_params.V1_1.V1_0.channelParams.enableAcs) {
+ ht_cap_vht_oper_chwidth_as_string =
+ "ht_capab=[HT40+]\n"
+ "vht_oper_chwidth=1";
+ }
+ } else {
+ hw_mode_as_string = "hw_mode=g";
}
- break;
- case IHostapd::Band::BAND_ANY:
- hw_mode_as_string = "hw_mode=any";
- if (iface_params.V1_0.channelParams.enableAcs) {
- ht_cap_vht_oper_chwidth_as_string =
- "ht_capab=[HT40+]\n"
- "vht_oper_chwidth=1";
+ } else {
+ if ((band & IHostapd::BandMask::BAND_5_GHZ) != 0) {
+ hw_mode_as_string = "hw_mode=a";
+ if (iface_params.V1_1.V1_0.channelParams.enableAcs) {
+ ht_cap_vht_oper_chwidth_as_string =
+ "ht_capab=[HT40+]\n"
+ "vht_oper_chwidth=1";
+ }
+ } else {
+ wpa_printf(MSG_ERROR, "Invalid band");
+ return "";
}
- break;
- default:
- wpa_printf(MSG_ERROR, "Invalid band");
- return "";
}
return StringPrintf(
@@ -187,15 +195,17 @@
"%s\n"
"ieee80211n=%d\n"
"ieee80211ac=%d\n"
+ "ieee80211ax=%d\n"
"%s\n"
"%s\n"
"ignore_broadcast_ssid=%d\n"
"wowlan_triggers=any\n"
"%s\n",
- iface_params.V1_0.ifaceName.c_str(), ssid_as_string.c_str(),
+ iface_params.V1_1.V1_0.ifaceName.c_str(), ssid_as_string.c_str(),
channel_config_as_string.c_str(),
- iface_params.V1_0.hwModeParams.enable80211N ? 1 : 0,
- iface_params.V1_0.hwModeParams.enable80211AC ? 1 : 0,
+ iface_params.V1_1.V1_0.hwModeParams.enable80211N ? 1 : 0,
+ iface_params.V1_1.V1_0.hwModeParams.enable80211AC ? 1 : 0,
+ iface_params.hwModeParams.enable80211AX ? 1 : 0,
hw_mode_as_string.c_str(), ht_cap_vht_oper_chwidth_as_string.c_str(),
nw_params.isHidden ? 1 : 0, encryption_config_as_string.c_str());
}
@@ -224,7 +234,7 @@
namespace hardware {
namespace wifi {
namespace hostapd {
-namespace V1_1 {
+namespace V1_2 {
namespace implementation {
using hidl_return_util::call;
using namespace android::hardware::wifi::hostapd::V1_0;
@@ -242,14 +252,23 @@
}
Return<void> Hostapd::addAccessPoint_1_1(
- const IfaceParams& iface_params, const NetworkParams& nw_params,
- addAccessPoint_cb _hidl_cb)
+ const V1_1::IHostapd::IfaceParams& iface_params,
+ const NetworkParams& nw_params, addAccessPoint_cb _hidl_cb)
{
return call(
this, &Hostapd::addAccessPointInternal_1_1, _hidl_cb, iface_params,
nw_params);
}
+Return<void> Hostapd::addAccessPoint_1_2(
+ const IfaceParams& iface_params, const NetworkParams& nw_params,
+ addAccessPoint_1_2_cb _hidl_cb)
+{
+ return call(
+ this, &Hostapd::addAccessPointInternal_1_2, _hidl_cb, iface_params,
+ nw_params);
+}
+
Return<void> Hostapd::removeAccessPoint(
const hidl_string& iface_name, removeAccessPoint_cb _hidl_cb)
{
@@ -265,26 +284,43 @@
}
Return<void> Hostapd::registerCallback(
- const sp<IHostapdCallback>& callback, registerCallback_cb _hidl_cb)
+ const sp<V1_1::IHostapdCallback>& callback, registerCallback_cb _hidl_cb)
{
return call(
this, &Hostapd::registerCallbackInternal, _hidl_cb, callback);
}
-HostapdStatus Hostapd::addAccessPointInternal(
+Return<void> Hostapd::forceClientDisconnect(
+ const hidl_string& iface_name, const hidl_array<uint8_t, 6>& client_address,
+ V1_2::Ieee80211ReasonCode reason_code, forceClientDisconnect_cb _hidl_cb)
+{
+ return call(
+ this, &Hostapd::forceClientDisconnectInternal, _hidl_cb, iface_name,
+ client_address, reason_code);
+}
+
+
+V1_0::HostapdStatus Hostapd::addAccessPointInternal(
const V1_0::IHostapd::IfaceParams& iface_params,
const NetworkParams& nw_params)
{
- return {HostapdStatusCode::FAILURE_UNKNOWN, ""};
+ return {V1_0::HostapdStatusCode::FAILURE_UNKNOWN, ""};
}
-HostapdStatus Hostapd::addAccessPointInternal_1_1(
+V1_0::HostapdStatus Hostapd::addAccessPointInternal_1_1(
+ const V1_1::IHostapd::IfaceParams& iface_params,
+ const NetworkParams& nw_params)
+{
+ return {V1_0::HostapdStatusCode::FAILURE_UNKNOWN, ""};
+}
+
+HostapdStatus Hostapd::addAccessPointInternal_1_2(
const IfaceParams& iface_params, const NetworkParams& nw_params)
{
- if (hostapd_get_iface(interfaces_, iface_params.V1_0.ifaceName.c_str())) {
+ if (hostapd_get_iface(interfaces_, iface_params.V1_1.V1_0.ifaceName.c_str())) {
wpa_printf(
MSG_ERROR, "Interface %s already present",
- iface_params.V1_0.ifaceName.c_str());
+ iface_params.V1_1.V1_0.ifaceName.c_str());
return {HostapdStatusCode::FAILURE_IFACE_EXISTS, ""};
}
const auto conf_params = CreateHostapdConfig(iface_params, nw_params);
@@ -293,13 +329,13 @@
return {HostapdStatusCode::FAILURE_ARGS_INVALID, ""};
}
const auto conf_file_path =
- WriteHostapdConfig(iface_params.V1_0.ifaceName, conf_params);
+ WriteHostapdConfig(iface_params.V1_1.V1_0.ifaceName, conf_params);
if (conf_file_path.empty()) {
wpa_printf(MSG_ERROR, "Failed to write config file");
return {HostapdStatusCode::FAILURE_UNKNOWN, ""};
}
std::string add_iface_param_str = StringPrintf(
- "%s config=%s", iface_params.V1_0.ifaceName.c_str(),
+ "%s config=%s", iface_params.V1_1.V1_0.ifaceName.c_str(),
conf_file_path.c_str());
std::vector<char> add_iface_param_vec(
add_iface_param_str.begin(), add_iface_param_str.end() + 1);
@@ -310,7 +346,7 @@
return {HostapdStatusCode::FAILURE_UNKNOWN, ""};
}
struct hostapd_data* iface_hapd =
- hostapd_get_iface(interfaces_, iface_params.V1_0.ifaceName.c_str());
+ hostapd_get_iface(interfaces_, iface_params.V1_1.V1_0.ifaceName.c_str());
WPA_ASSERT(iface_hapd != nullptr && iface_hapd->iface != nullptr);
// Register the setup complete callbacks
on_setup_complete_internal_callback =
@@ -332,13 +368,13 @@
if (hostapd_enable_iface(iface_hapd->iface) < 0) {
wpa_printf(
MSG_ERROR, "Enabling interface %s failed",
- iface_params.V1_0.ifaceName.c_str());
+ iface_params.V1_1.V1_0.ifaceName.c_str());
return {HostapdStatusCode::FAILURE_UNKNOWN, ""};
}
return {HostapdStatusCode::SUCCESS, ""};
}
-HostapdStatus Hostapd::removeAccessPointInternal(const std::string& iface_name)
+V1_0::HostapdStatus Hostapd::removeAccessPointInternal(const std::string& iface_name)
{
std::vector<char> remove_iface_param_vec(
iface_name.begin(), iface_name.end() + 1);
@@ -347,20 +383,42 @@
wpa_printf(
MSG_ERROR, "Removing interface %s failed",
iface_name.c_str());
- return {HostapdStatusCode::FAILURE_UNKNOWN, ""};
+ return {V1_0::HostapdStatusCode::FAILURE_UNKNOWN, ""};
}
- return {HostapdStatusCode::SUCCESS, ""};
+ return {V1_0::HostapdStatusCode::SUCCESS, ""};
}
-HostapdStatus Hostapd::registerCallbackInternal(
- const sp<IHostapdCallback>& callback)
+V1_0::HostapdStatus Hostapd::registerCallbackInternal(
+ const sp<V1_1::IHostapdCallback>& callback)
{
callbacks_.push_back(callback);
- return {HostapdStatusCode::SUCCESS, ""};
+ return {V1_0::HostapdStatusCode::SUCCESS, ""};
+}
+
+V1_2::HostapdStatus Hostapd::forceClientDisconnectInternal(const std::string& iface_name,
+ const std::array<uint8_t, 6>& client_address, V1_2::Ieee80211ReasonCode reason_code)
+{
+ struct hostapd_data *hapd = hostapd_get_iface(interfaces_, iface_name.c_str());
+ struct sta_info *sta;
+ if (!hapd) {
+ wpa_printf(MSG_ERROR, "Interface %s doesn't exist", iface_name.c_str());
+ return {V1_2::HostapdStatusCode::FAILURE_IFACE_UNKNOWN, ""};
+ }
+ for (sta = hapd->sta_list; sta; sta = sta->next) {
+ int res;
+ res = memcmp(sta->addr, client_address.data(), ETH_ALEN);
+ if (res == 0) {
+ wpa_printf(MSG_INFO, "Force client:" MACSTR " disconnect with reason: %d",
+ MAC2STR(client_address.data()), (uint16_t) reason_code);
+ ap_sta_disconnect(hapd, sta, sta->addr, (uint16_t) reason_code);
+ return {V1_2::HostapdStatusCode::SUCCESS, ""};
+ }
+ }
+ return {V1_2::HostapdStatusCode::FAILURE_CLIENT_UNKNOWN, ""};
}
} // namespace implementation
-} // namespace V1_1
+} // namespace V1_2
} // namespace hostapd
} // namespace wifi
} // namespace hardware
diff --git a/hostapd/hidl/1.2/hostapd.h b/hostapd/hidl/1.2/hostapd.h
new file mode 100644
index 0000000..eea00cb
--- /dev/null
+++ b/hostapd/hidl/1.2/hostapd.h
@@ -0,0 +1,100 @@
+/*
+ * hidl interface for wpa_hostapd daemon
+ * Copyright (c) 2004-2018, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2018, Roshan Pius <rpius@google.com>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef HOSTAPD_HIDL_SUPPLICANT_H
+#define HOSTAPD_HIDL_SUPPLICANT_H
+
+#include <string>
+
+#include <android-base/macros.h>
+
+#include <android/hardware/wifi/hostapd/1.2/IHostapd.h>
+#include <android/hardware/wifi/hostapd/1.1/IHostapdCallback.h>
+
+extern "C"
+{
+#include "utils/common.h"
+#include "utils/includes.h"
+#include "utils/wpa_debug.h"
+#include "ap/hostapd.h"
+#include "ap/sta_info.h"
+}
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace hostapd {
+namespace V1_2 {
+namespace implementation {
+using namespace android::hardware::wifi::hostapd::V1_0;
+
+/**
+ * Implementation of the hostapd hidl object. This hidl
+ * object is used core for global control operations on
+ * hostapd.
+ */
+class Hostapd : public V1_2::IHostapd
+{
+public:
+ Hostapd(hapd_interfaces* interfaces);
+ ~Hostapd() override = default;
+
+ // Hidl methods exposed.
+ Return<void> addAccessPoint(
+ const V1_0::IHostapd::IfaceParams& iface_params,
+ const V1_0::IHostapd::NetworkParams& nw_params, addAccessPoint_cb _hidl_cb) override;
+ Return<void> addAccessPoint_1_1(
+ const V1_1::IHostapd::IfaceParams& iface_params,
+ const V1_0::IHostapd::NetworkParams& nw_params, addAccessPoint_cb _hidl_cb) override;
+ Return<void> addAccessPoint_1_2(
+ const V1_2::IHostapd::IfaceParams& iface_params, const NetworkParams& nw_params,
+ addAccessPoint_1_2_cb _hidl_cb) override;
+ Return<void> removeAccessPoint(
+ const hidl_string& iface_name,
+ removeAccessPoint_cb _hidl_cb) override;
+ Return<void> terminate() override;
+ Return<void> registerCallback(
+ const sp<V1_1::IHostapdCallback>& callback,
+ registerCallback_cb _hidl_cb) override;
+ Return<void>forceClientDisconnect(
+ const hidl_string& iface_name,
+ const hidl_array<uint8_t, 6>& client_address,
+ V1_2::Ieee80211ReasonCode reason_code, forceClientDisconnect_cb _hidl_cb) override;
+private:
+ // Corresponding worker functions for the HIDL methods.
+ V1_0::HostapdStatus addAccessPointInternal(
+ const V1_0::IHostapd::IfaceParams& iface_params,
+ const V1_0::IHostapd::NetworkParams& nw_params);
+ V1_0::HostapdStatus addAccessPointInternal_1_1(
+ const V1_1::IHostapd::IfaceParams& IfaceParams,
+ const V1_0::IHostapd::NetworkParams& nw_params);
+ V1_2::HostapdStatus addAccessPointInternal_1_2(
+ const V1_2::IHostapd::IfaceParams& IfaceParams,
+ const V1_0::IHostapd::NetworkParams& nw_params);
+ V1_0::HostapdStatus removeAccessPointInternal(const std::string& iface_name);
+ V1_0::HostapdStatus registerCallbackInternal(
+ const sp<V1_1::IHostapdCallback>& callback);
+ V1_2::HostapdStatus forceClientDisconnectInternal(
+ const std::string& iface_name,
+ const std::array<uint8_t, 6>& client_address,
+ V1_2::Ieee80211ReasonCode reason_code);
+ // Raw pointer to the global structure maintained by the core.
+ struct hapd_interfaces* interfaces_;
+ // Callbacks registered.
+ std::vector<sp<V1_1::IHostapdCallback>> callbacks_;
+ DISALLOW_COPY_AND_ASSIGN(Hostapd);
+};
+} // namespace implementation
+} // namespace V1_2
+} // namespace hostapd
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // HOSTAPD_HIDL_SUPPLICANT_H
diff --git a/hostapd/hostapd.android.rc b/hostapd/hostapd.android.rc
index c8792d6..512ca0d 100644
--- a/hostapd/hostapd.android.rc
+++ b/hostapd/hostapd.android.rc
@@ -14,6 +14,7 @@
service hostapd /vendor/bin/hw/hostapd
interface android.hardware.wifi.hostapd@1.0::IHostapd default
interface android.hardware.wifi.hostapd@1.1::IHostapd default
+ interface android.hardware.wifi.hostapd@1.2::IHostapd default
class main
capabilities NET_ADMIN NET_RAW
user wifi
diff --git a/wpa_supplicant/hidl/1.3/p2p_iface.cpp b/wpa_supplicant/hidl/1.3/p2p_iface.cpp
index 225305d..12459f8 100644
--- a/wpa_supplicant/hidl/1.3/p2p_iface.cpp
+++ b/wpa_supplicant/hidl/1.3/p2p_iface.cpp
@@ -225,7 +225,7 @@
size_t ielen;
unsigned int bands;
- if (!wpa_s->global->p2p) {
+ if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled) {
wpa_printf(MSG_ERROR,
"P2P: P2P interface is gone, cancel join scan");
return -ENXIO;
@@ -1635,6 +1635,10 @@
int vht = wpa_s->conf->p2p_go_vht;
int ht40 = wpa_s->conf->p2p_go_ht40 || vht;
+ if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled) {
+ return {SupplicantStatusCode::FAILURE_IFACE_DISABLED, ""};
+ }
+
if (!isSsidValid(ssid)) {
return {SupplicantStatusCode::FAILURE_ARGS_INVALID, "SSID is invalid."};
}
@@ -1644,10 +1648,6 @@
}
if (!joinExistingGroup) {
- if (wpa_s->global->p2p == NULL) {
- return {SupplicantStatusCode::FAILURE_IFACE_DISABLED, ""};
- }
-
struct p2p_data *p2p = wpa_s->global->p2p;
os_memcpy(p2p->ssid, ssid.data(), ssid.size());
p2p->ssid_len = ssid.size();
@@ -1692,6 +1692,9 @@
pending_join_scan_callback =
[wpa_s, ssid, freq]() {
+ if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled) {
+ return;
+ }
int ret = joinScanReq(wpa_s, ssid, freq);
// for BUSY case, the scan might be occupied by WiFi.
// Do not give up immediately, but try again later.
@@ -1708,7 +1711,7 @@
};
pending_scan_res_join_callback = [wpa_s, ssid, passphrase, peer_address, this]() {
- if (wpa_s->global->p2p_disabled) {
+ if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled) {
return;
}