Merge "Wifi: DPP STA Enrollee-Responder mode"
diff --git a/hostapd/hidl/1.3/hostapd.cpp b/hostapd/hidl/1.3/hostapd.cpp
index 6450a9f..ce20cea 100644
--- a/hostapd/hidl/1.3/hostapd.cpp
+++ b/hostapd/hidl/1.3/hostapd.cpp
@@ -263,7 +263,8 @@
}
std::string CreateHostapdConfig(
- const android::hardware::wifi::hostapd::V1_2::IHostapd::IfaceParams& iface_params,
+ const android::hardware::wifi::hostapd::V1_3::IHostapd::IfaceParams& iface_params,
+ const android::hardware::wifi::hostapd::V1_3::IHostapd::ChannelParams& channelParams,
const IHostapd::NetworkParams& nw_params,
const std::string br_name)
{
@@ -286,7 +287,7 @@
// Encryption config string
uint32_t band = 0;
- band |= iface_params.channelParams.bandMask;
+ band |= channelParams.V1_2.bandMask;
bool is_6Ghz_band_only = band == static_cast<uint32_t>(IHostapd::BandMask::BAND_6_GHZ);
std::string encryption_config_as_string;
switch (nw_params.V1_2.encryptionType) {
@@ -365,10 +366,10 @@
std::string channel_config_as_string;
bool isFirst = true;
- if (iface_params.V1_1.V1_0.channelParams.enableAcs) {
+ if (channelParams.enableAcs) {
std::string freqList_as_string;
for (const auto &range :
- iface_params.channelParams.acsChannelFreqRangesMhz) {
+ channelParams.V1_2.acsChannelFreqRangesMhz) {
if (!isFirst) {
freqList_as_string += ",";
}
@@ -385,18 +386,18 @@
"channel=0\n"
"acs_exclude_dfs=%d\n"
"freqlist=%s",
- iface_params.V1_1.V1_0.channelParams.acsShouldExcludeDfs,
+ iface_params.V1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs,
freqList_as_string.c_str());
} else {
int op_class = getOpClassForChannel(
- iface_params.V1_1.V1_0.channelParams.channel,
+ channelParams.channel,
band,
- iface_params.V1_1.V1_0.hwModeParams.enable80211N,
- iface_params.V1_1.V1_0.hwModeParams.enable80211AC);
+ iface_params.V1_2.V1_1.V1_0.hwModeParams.enable80211N,
+ iface_params.V1_2.V1_1.V1_0.hwModeParams.enable80211AC);
channel_config_as_string = StringPrintf(
"channel=%d\n"
"op_class=%d",
- iface_params.V1_1.V1_0.channelParams.channel, op_class);
+ channelParams.channel, op_class);
}
std::string hw_mode_as_string;
@@ -406,7 +407,7 @@
if (((band & IHostapd::BandMask::BAND_5_GHZ) != 0)
|| ((band & IHostapd::BandMask::BAND_6_GHZ) != 0)) {
hw_mode_as_string = "hw_mode=any";
- if (iface_params.V1_1.V1_0.hwModeParams.enable80211AC) {
+ if (iface_params.V1_2.V1_1.V1_0.hwModeParams.enable80211AC) {
ht_cap_vht_oper_chwidth_as_string =
"ht_capab=[HT40+]\n"
"vht_oper_chwidth=1";
@@ -418,7 +419,7 @@
if (((band & IHostapd::BandMask::BAND_5_GHZ) != 0)
|| ((band & IHostapd::BandMask::BAND_6_GHZ) != 0)) {
hw_mode_as_string = "hw_mode=a";
- if (iface_params.V1_1.V1_0.hwModeParams.enable80211AC) {
+ if (iface_params.V1_2.V1_1.V1_0.hwModeParams.enable80211AC) {
ht_cap_vht_oper_chwidth_as_string =
"ht_capab=[HT40+]\n"
"vht_oper_chwidth=1";
@@ -431,17 +432,17 @@
std::string he_params_as_string;
#ifdef CONFIG_IEEE80211AX
- if (iface_params.hwModeParams.enable80211AX) {
+ if (iface_params.V1_2.hwModeParams.enable80211AX) {
he_params_as_string = StringPrintf(
"ieee80211ax=1\n"
"he_su_beamformer=%d\n"
"he_su_beamformee=%d\n"
"he_mu_beamformer=%d\n"
"he_twt_required=%d\n",
- iface_params.hwModeParams.enableHeSingleUserBeamformer ? 1 : 0,
- iface_params.hwModeParams.enableHeSingleUserBeamformee ? 1 : 0,
- iface_params.hwModeParams.enableHeMultiUserBeamformer ? 1 : 0,
- iface_params.hwModeParams.enableHeTargetWakeTime ? 1 : 0);
+ iface_params.V1_2.hwModeParams.enableHeSingleUserBeamformer ? 1 : 0,
+ iface_params.V1_2.hwModeParams.enableHeSingleUserBeamformee ? 1 : 0,
+ iface_params.V1_2.hwModeParams.enableHeMultiUserBeamformer ? 1 : 0,
+ iface_params.V1_2.hwModeParams.enableHeTargetWakeTime ? 1 : 0);
} else {
he_params_as_string = "ieee80211ax=0";
}
@@ -485,10 +486,10 @@
#endif /* CONFIG_INTERWORKING */
"%s\n"
"%s\n",
- iface_params.V1_1.V1_0.ifaceName.c_str(), ssid_as_string.c_str(),
+ iface_params.V1_2.V1_1.V1_0.ifaceName.c_str(), ssid_as_string.c_str(),
channel_config_as_string.c_str(),
- iface_params.V1_1.V1_0.hwModeParams.enable80211N ? 1 : 0,
- iface_params.V1_1.V1_0.hwModeParams.enable80211AC ? 1 : 0,
+ iface_params.V1_2.V1_1.V1_0.hwModeParams.enable80211N ? 1 : 0,
+ iface_params.V1_2.V1_1.V1_0.hwModeParams.enable80211AC ? 1 : 0,
he_params_as_string.c_str(),
hw_mode_as_string.c_str(), ht_cap_vht_oper_chwidth_as_string.c_str(),
nw_params.V1_2.V1_0.isHidden ? 1 : 0,
@@ -657,6 +658,9 @@
Return<void> Hostapd::terminate()
{
wpa_printf(MSG_INFO, "Terminating...");
+ // Clear the callback to avoid IPCThreadState shutdown during the
+ // callback event.
+ callbacks_.clear();
eloop_terminate();
return Void();
}
@@ -711,22 +715,6 @@
return {V1_2::HostapdStatusCode::FAILURE_UNKNOWN, ""};
}
-V1_2::IHostapd::IfaceParams prepareIfaceParams1_2From1_3(const std::string interfaceName,
- const V1_3::IHostapd::IfaceParams iface_1_3,
- const V1_3::IHostapd::ChannelParams channelParams_1_3)
-{
- // Using HIDL 1.2 iface_params to enable the AP
- V1_2::IHostapd::IfaceParams iface_params_1_2 = iface_1_3.V1_2;
- iface_params_1_2.V1_1.V1_0.ifaceName = interfaceName;
- // Prepare bandMask & acsChannelFreqRangesMhz
- iface_params_1_2.channelParams = channelParams_1_3.V1_2;
- // Prepare channel
- iface_params_1_2.V1_1.V1_0.channelParams.channel = channelParams_1_3.channel;
- // Prepare enableAcs
- iface_params_1_2.V1_1.V1_0.channelParams.enableAcs = channelParams_1_3.enableAcs;
- return iface_params_1_2;
-}
-
V1_2::HostapdStatus Hostapd::addAccessPointInternal_1_3(
const V1_3::IHostapd::IfaceParams& iface_params,
const V1_3::IHostapd::NetworkParams& nw_params)
@@ -736,9 +724,7 @@
// Single AP
wpa_printf(MSG_INFO, "AddSingleAccessPoint, iface=%s",
iface_params.V1_2.V1_1.V1_0.ifaceName.c_str());
- return addSingleAccessPoint(
- prepareIfaceParams1_2From1_3(iface_params.V1_2.V1_1.V1_0.ifaceName,
- iface_params, iface_params.channelParamsList[0]),
+ return addSingleAccessPoint(iface_params, iface_params.channelParamsList[0],
nw_params, "");
} else if (channelParamsListSize == 2) {
// Concurrent APs
@@ -767,10 +753,10 @@
}
// start BSS on specified bands
for (std::size_t i = 0; i < channelParamsListSize; i ++) {
+ V1_3::IHostapd::IfaceParams iface_params_new = iface_params;
+ iface_params_new.V1_2.V1_1.V1_0.ifaceName = managed_interfaces[i];
V1_2::HostapdStatus status = addSingleAccessPoint(
- prepareIfaceParams1_2From1_3(managed_interfaces[i], iface_params,
- iface_params.channelParamsList[i]),
- nw_params, br_name);
+ iface_params_new, iface_params.channelParamsList[i], nw_params, br_name);
if (status.code != V1_2::HostapdStatusCode::SUCCESS) {
wpa_printf(MSG_ERROR, "Failed to addAccessPoint %s",
managed_interfaces[i].c_str());
@@ -783,29 +769,30 @@
}
V1_2::HostapdStatus Hostapd::addSingleAccessPoint(
- const V1_2::IHostapd::IfaceParams& iface_params,
+ const V1_3::IHostapd::IfaceParams& iface_params,
+ const V1_3::IHostapd::ChannelParams& channelParams,
const V1_3::IHostapd::NetworkParams& nw_params,
const std::string br_name)
{
- if (hostapd_get_iface(interfaces_, iface_params.V1_1.V1_0.ifaceName.c_str())) {
+ if (hostapd_get_iface(interfaces_, iface_params.V1_2.V1_1.V1_0.ifaceName.c_str())) {
wpa_printf(
MSG_ERROR, "Interface %s already present",
- iface_params.V1_1.V1_0.ifaceName.c_str());
+ iface_params.V1_2.V1_1.V1_0.ifaceName.c_str());
return {V1_2::HostapdStatusCode::FAILURE_IFACE_EXISTS, ""};
}
- const auto conf_params = CreateHostapdConfig(iface_params, nw_params, br_name);
+ const auto conf_params = CreateHostapdConfig(iface_params, channelParams, nw_params, br_name);
if (conf_params.empty()) {
wpa_printf(MSG_ERROR, "Failed to create config params");
return {V1_2::HostapdStatusCode::FAILURE_ARGS_INVALID, ""};
}
const auto conf_file_path =
- WriteHostapdConfig(iface_params.V1_1.V1_0.ifaceName, conf_params);
+ WriteHostapdConfig(iface_params.V1_2.V1_1.V1_0.ifaceName, conf_params);
if (conf_file_path.empty()) {
wpa_printf(MSG_ERROR, "Failed to write config file");
return {V1_2::HostapdStatusCode::FAILURE_UNKNOWN, ""};
}
std::string add_iface_param_str = StringPrintf(
- "%s config=%s", iface_params.V1_1.V1_0.ifaceName.c_str(),
+ "%s config=%s", iface_params.V1_2.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);
@@ -816,7 +803,7 @@
return {V1_2::HostapdStatusCode::FAILURE_UNKNOWN, ""};
}
struct hostapd_data* iface_hapd =
- hostapd_get_iface(interfaces_, iface_params.V1_1.V1_0.ifaceName.c_str());
+ hostapd_get_iface(interfaces_, iface_params.V1_2.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 =
@@ -854,7 +841,9 @@
enum wpa_msg_type type, const char *txt,
size_t len) {
wpa_printf(MSG_DEBUG, "Receive wpa msg : %s", txt);
- if (os_strncmp(txt, WPA_EVENT_CHANNEL_SWITCH,
+ if (os_strncmp(txt, AP_EVENT_ENABLED,
+ strlen(AP_EVENT_ENABLED)) == 0 ||
+ os_strncmp(txt, WPA_EVENT_CHANNEL_SWITCH,
strlen(WPA_EVENT_CHANNEL_SWITCH)) == 0) {
for (const auto &callback : callbacks_) {
callback->onApInstanceInfoChanged(
@@ -878,7 +867,7 @@
if (hostapd_enable_iface(iface_hapd->iface) < 0) {
wpa_printf(
MSG_ERROR, "Enabling interface %s failed",
- iface_params.V1_1.V1_0.ifaceName.c_str());
+ iface_params.V1_2.V1_1.V1_0.ifaceName.c_str());
return {V1_2::HostapdStatusCode::FAILURE_UNKNOWN, ""};
}
return {V1_2::HostapdStatusCode::SUCCESS, ""};
diff --git a/hostapd/hidl/1.3/hostapd.h b/hostapd/hidl/1.3/hostapd.h
index ceec080..dc45932 100644
--- a/hostapd/hidl/1.3/hostapd.h
+++ b/hostapd/hidl/1.3/hostapd.h
@@ -105,7 +105,8 @@
const V1_3::IHostapd::IfaceParams& IfaceParams,
const V1_3::IHostapd::NetworkParams& nw_params);
V1_2::HostapdStatus addSingleAccessPoint(
- const V1_2::IHostapd::IfaceParams& IfaceParams,
+ const V1_3::IHostapd::IfaceParams& IfaceParams,
+ const V1_3::IHostapd::ChannelParams& channelParams,
const V1_3::IHostapd::NetworkParams& nw_params,
std::string br_name);
V1_2::HostapdStatus addConcurrentAccessPoints(
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 6ddfb1e..360ca60 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -8,6 +8,7 @@
#include "includes.h"
+#include <log/log.h>
#include "common.h"
#include "eloop.h"
#include "common/defs.h"
@@ -453,6 +454,10 @@
dev->info.config_methods = cli->config_methods;
os_memcpy(dev->info.pri_dev_type, cli->pri_dev_type, 8);
dev->info.wps_sec_dev_type_list_len = 8 * cli->num_sec_dev_types;
+ if (dev->info.wps_sec_dev_type_list_len > WPS_SEC_DEV_TYPE_MAX_LEN) {
+ android_errorWriteLog(0x534e4554, "172937525");
+ dev->info.wps_sec_dev_type_list_len = WPS_SEC_DEV_TYPE_MAX_LEN;
+ }
os_memcpy(dev->info.wps_sec_dev_type_list, cli->sec_dev_types,
dev->info.wps_sec_dev_type_list_len);
}
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index a4892e7..ac88a7d 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -44,6 +44,27 @@
#endif /* CONFIG_WPS */
+static bool is_chanwidth160_supported(struct hostapd_hw_modes *mode,
+ struct hostapd_config *conf)
+{
+#ifdef CONFIG_IEEE80211AX
+ if (conf->ieee80211ax) {
+ struct he_capabilities *he_cap;
+
+ he_cap = &mode->he_capab[IEEE80211_MODE_AP];
+ if (he_cap->phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] &
+ (HE_PHYCAP_CHANNEL_WIDTH_SET_80PLUS80MHZ_IN_5G |
+ HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G))
+ return true;
+ }
+#endif /* CONFIG_IEEE80211AX */
+ if (mode->vht_capab & (VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
+ VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ))
+ return true;
+ return false;
+}
+
+
static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid,
struct hostapd_config *conf,
@@ -105,7 +126,7 @@
*/
hostapd_set_oper_chwidth(conf, CHANWIDTH_160MHZ);
center_chan = wpas_p2p_get_vht160_center(wpa_s, mode, channel);
- if (center_chan) {
+ if (center_chan && is_chanwidth160_supported(mode, conf)) {
wpa_printf(MSG_DEBUG,
"VHT center channel %u for auto-selected 160 MHz bandwidth",
center_chan);