Merge changes from topic "t-p2p-vendor-extras"
* changes:
p2p: implement new HAL API to pass vendor extras
p2p: set p2p probe response vendor information elements for p2p dev interface
diff --git a/hostapd/Android.mk b/hostapd/Android.mk
index 8449d16..54548aa 100644
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -42,6 +42,10 @@
L_CFLAGS += -DANDROID_LIB_STUB
endif
+ifeq ($(BOARD_HOSTAPD_CONFIG_80211W_MFP_OPTIONAL),true)
+L_CFLAGS += -DENABLE_HOSTAPD_CONFIG_80211W_MFP_OPTIONAL
+endif
+
# Use Android specific directory for control interface sockets
L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/vendor/wifi/hostapd/sockets\"
L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/vendor/wifi/hostapd/ctrl\"
diff --git a/hostapd/aidl/hostapd.cpp b/hostapd/aidl/hostapd.cpp
index 7874785..515fda1 100644
--- a/hostapd/aidl/hostapd.cpp
+++ b/hostapd/aidl/hostapd.cpp
@@ -298,7 +298,8 @@
const IfaceParams& iface_params,
const ChannelParams& channelParams,
const NetworkParams& nw_params,
- const std::string br_name)
+ const std::string br_name,
+ const std::string owe_transition_ifname)
{
if (nw_params.ssid.size() >
static_cast<uint32_t>(
@@ -355,6 +356,9 @@
encryption_config_as_string = StringPrintf(
"wpa=2\n"
"rsn_pairwise=%s\n"
+#ifdef ENABLE_HOSTAPD_CONFIG_80211W_MFP_OPTIONAL
+ "ieee80211w=1\n"
+#endif
"wpa_passphrase=%s",
is_60Ghz_band_only ? "GCMP" : "CCMP",
nw_params.passphrase.c_str());
@@ -396,6 +400,22 @@
is_6Ghz_band_only ? 1 : 2,
nw_params.passphrase.c_str());
break;
+ case EncryptionType::WPA3_OWE_TRANSITION:
+ encryption_config_as_string = StringPrintf(
+ "wpa=2\n"
+ "rsn_pairwise=%s\n"
+ "wpa_key_mgmt=OWE\n"
+ "ieee80211w=2",
+ is_60Ghz_band_only ? "GCMP" : "CCMP");
+ break;
+ case EncryptionType::WPA3_OWE:
+ encryption_config_as_string = StringPrintf(
+ "wpa=2\n"
+ "rsn_pairwise=%s\n"
+ "wpa_key_mgmt=OWE\n"
+ "ieee80211w=2",
+ is_60Ghz_band_only ? "GCMP" : "CCMP");
+ break;
default:
wpa_printf(MSG_ERROR, "Unknown encryption type");
return "";
@@ -525,6 +545,12 @@
vendor_elements_as_string = StringPrintf("vendor_elements=%s", ss.str().c_str());
}
+ std::string owe_transition_ifname_as_string;
+ if (!owe_transition_ifname.empty()) {
+ owe_transition_ifname_as_string = StringPrintf(
+ "owe_transition_ifname=%s", owe_transition_ifname.c_str());
+ }
+
return StringPrintf(
"interface=%s\n"
"driver=nl80211\n"
@@ -548,6 +574,7 @@
"%s\n"
"%s\n"
"%s\n"
+ "%s\n"
"%s\n",
iface_params.name.c_str(), ssid_as_string.c_str(),
channel_config_as_string.c_str(),
@@ -561,6 +588,7 @@
#endif /* CONFIG_INTERWORKING */
encryption_config_as_string.c_str(),
bridge_as_string.c_str(),
+ owe_transition_ifname_as_string.c_str(),
enable_edmg_as_string.c_str(),
edmg_channel_as_string.c_str(),
vendor_elements_as_string.c_str());
@@ -771,7 +799,7 @@
wpa_printf(MSG_INFO, "AddSingleAccessPoint, iface=%s",
iface_params.name.c_str());
return addSingleAccessPoint(iface_params, iface_params.channelParams[0],
- nw_params, "");
+ nw_params, "", "");
} else if (channelParamsSize == 2) {
// Concurrent APs
wpa_printf(MSG_INFO, "AddDualAccessPoint, iface=%s",
@@ -781,6 +809,18 @@
return createStatus(HostapdStatusCode::FAILURE_ARGS_INVALID);
}
+std::vector<uint8_t> generateRandomOweSsid()
+{
+ u8 random[8] = {0};
+ os_get_random(random, 8);
+
+ std::string ssid = StringPrintf("Owe-%s", random);
+ wpa_printf(MSG_INFO, "Generated OWE SSID: %s", ssid.c_str());
+ std::vector<uint8_t> vssid(ssid.begin(), ssid.end());
+
+ return vssid;
+}
+
::ndk::ScopedAStatus Hostapd::addConcurrentAccessPoints(
const IfaceParams& iface_params, const NetworkParams& nw_params)
{
@@ -800,9 +840,24 @@
// start BSS on specified bands
for (std::size_t i = 0; i < channelParamsListSize; i ++) {
IfaceParams iface_params_new = iface_params;
+ NetworkParams nw_params_new = nw_params;
iface_params_new.name = managed_interfaces[i];
+
+ std::string owe_transition_ifname = "";
+ if (nw_params.encryptionType == EncryptionType::WPA3_OWE_TRANSITION) {
+ if (i == 0 && i+1 < channelParamsListSize) {
+ owe_transition_ifname = managed_interfaces[i+1];
+ nw_params_new.encryptionType = EncryptionType::NONE;
+ } else {
+ owe_transition_ifname = managed_interfaces[0];
+ nw_params_new.isHidden = true;
+ nw_params_new.ssid = generateRandomOweSsid();
+ }
+ }
+
ndk::ScopedAStatus status = addSingleAccessPoint(
- iface_params_new, iface_params.channelParams[i], nw_params, br_name);
+ iface_params_new, iface_params.channelParams[i], nw_params_new,
+ br_name, owe_transition_ifname);
if (!status.isOk()) {
wpa_printf(MSG_ERROR, "Failed to addAccessPoint %s",
managed_interfaces[i].c_str());
@@ -818,7 +873,8 @@
const IfaceParams& iface_params,
const ChannelParams& channelParams,
const NetworkParams& nw_params,
- const std::string br_name)
+ const std::string br_name,
+ const std::string owe_transition_ifname)
{
if (hostapd_get_iface(interfaces_, iface_params.name.c_str())) {
wpa_printf(
@@ -826,7 +882,8 @@
iface_params.name.c_str());
return createStatus(HostapdStatusCode::FAILURE_IFACE_EXISTS);
}
- const auto conf_params = CreateHostapdConfig(iface_params, channelParams, nw_params, br_name);
+ const auto conf_params = CreateHostapdConfig(iface_params, channelParams, nw_params,
+ br_name, owe_transition_ifname);
if (conf_params.empty()) {
wpa_printf(MSG_ERROR, "Failed to create config params");
return createStatus(HostapdStatusCode::FAILURE_ARGS_INVALID);
diff --git a/hostapd/aidl/hostapd.h b/hostapd/aidl/hostapd.h
index 18a7a23..ffdbd8e 100644
--- a/hostapd/aidl/hostapd.h
+++ b/hostapd/aidl/hostapd.h
@@ -64,7 +64,8 @@
const IfaceParams& IfaceParams,
const ChannelParams& channelParams,
const NetworkParams& nw_params,
- std::string br_name);
+ std::string br_name,
+ std::string owe_transition_ifname);
::ndk::ScopedAStatus addConcurrentAccessPoints(
const IfaceParams& IfaceParams,
const NetworkParams& nw_params);
diff --git a/wpa_supplicant/aidl/sta_iface.cpp b/wpa_supplicant/aidl/sta_iface.cpp
index abde780..9b967e4 100644
--- a/wpa_supplicant/aidl/sta_iface.cpp
+++ b/wpa_supplicant/aidl/sta_iface.cpp
@@ -770,6 +770,31 @@
&StaIface::setMboCellularDataStatusInternal, in_available);
}
+::ndk::ScopedAStatus StaIface::setQosPolicyFeatureEnabled(
+ bool in_enable)
+{
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_UNKNOWN,
+ &StaIface::setQosPolicyFeatureEnabledInternal, in_enable);
+}
+
+::ndk::ScopedAStatus StaIface::sendQosPolicyResponse(
+ bool in_morePolicies,
+ const std::vector<QosPolicyStatus>& in_qosPolicyStatusList)
+{
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_UNKNOWN,
+ &StaIface::sendQosPolicyResponseInternal, in_morePolicies,
+ in_qosPolicyStatusList);
+}
+
+::ndk::ScopedAStatus StaIface::removeAllQosPolicies()
+{
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_UNKNOWN,
+ &StaIface::removeAllQosPoliciesInternal);
+}
+
std::pair<std::string, ndk::ScopedAStatus> StaIface::getNameInternal()
{
return {ifname_, ndk::ScopedAStatus::ok()};
@@ -1742,6 +1767,22 @@
ndk::ScopedAStatus::ok()};
}
+ndk::ScopedAStatus StaIface::setQosPolicyFeatureEnabledInternal(bool enable)
+{
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus StaIface::sendQosPolicyResponseInternal(
+ bool more_policies, const std::vector<QosPolicyStatus>& qos_policy_status_list)
+{
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus StaIface::removeAllQosPoliciesInternal()
+{
+ return ndk::ScopedAStatus::ok();
+}
+
/**
* Retrieve the underlying |wpa_supplicant| struct
* pointer for this iface.
diff --git a/wpa_supplicant/aidl/sta_iface.h b/wpa_supplicant/aidl/sta_iface.h
index 98c3187..0853b7e 100644
--- a/wpa_supplicant/aidl/sta_iface.h
+++ b/wpa_supplicant/aidl/sta_iface.h
@@ -20,6 +20,7 @@
#include <aidl/android/hardware/wifi/supplicant/Hs20AnqpSubtypes.h>
#include <aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.h>
#include <aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.h>
+#include <aidl/android/hardware/wifi/supplicant/QosPolicyStatus.h>
#include <aidl/android/hardware/wifi/supplicant/RxFilterType.h>
extern "C"
@@ -145,6 +146,10 @@
DppResponderBootstrapInfo* _aidl_return) override;
::ndk::ScopedAStatus startDppEnrolleeResponder(int32_t in_listenChannel) override;
::ndk::ScopedAStatus stopDppResponder(int32_t in_ownBootstrapId) override;
+ ::ndk::ScopedAStatus setQosPolicyFeatureEnabled(bool in_enable) override;
+ ::ndk::ScopedAStatus sendQosPolicyResponse(
+ bool in_morePolicies, const std::vector<QosPolicyStatus>& in_qosPolicyStatusList) override;
+ ::ndk::ScopedAStatus removeAllQosPolicies() override;
private:
// Corresponding worker functions for the AIDL methods.
@@ -241,6 +246,10 @@
DppCurve curve);
ndk::ScopedAStatus startDppEnrolleeResponderInternal(uint32_t listen_channel);
ndk::ScopedAStatus stopDppResponderInternal(uint32_t own_bootstrap_id);
+ ndk::ScopedAStatus setQosPolicyFeatureEnabledInternal(bool enable);
+ ndk::ScopedAStatus sendQosPolicyResponseInternal(
+ bool more_policies, const std::vector<QosPolicyStatus>& qos_policy_status_list);
+ ndk::ScopedAStatus removeAllQosPoliciesInternal();
struct wpa_supplicant* retrieveIfacePtr();
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 36f4d3c..5a771e8 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -663,7 +663,11 @@
}
#ifdef CONFIG_HS20
- if (is_hs20_config(wpa_s) && is_hs20_network(wpa_s, ssid, bss)) {
+ if (is_hs20_network(wpa_s, ssid, bss)
+#ifndef ANDROID /* Android does not use the native HS 2.0 config */
+ && is_hs20_config(wpa_s)
+#endif /* ANDROID */
+ ) {
struct wpabuf *hs20;
hs20 = wpabuf_alloc(20 + MAX_ROAMING_CONS_OI_LEN);
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 674e194..54d223d 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3046,7 +3046,11 @@
}
#ifdef CONFIG_HS20
- if (is_hs20_config(wpa_s) && is_hs20_network(wpa_s, ssid, bss)) {
+ if (is_hs20_network(wpa_s, ssid, bss)
+#ifndef ANDROID /* Android does not use the native HS 2.0 config */
+ && is_hs20_config(wpa_s)
+#endif /* ANDROID */
+ ) {
struct wpabuf *hs20;
hs20 = wpabuf_alloc(20 + MAX_ROAMING_CONS_OI_LEN);