Merge "DPP [AIDL]: Add support for DPP-AKM based profile configuration."
diff --git a/hostapd/aidl/aidl.cpp b/hostapd/aidl/aidl.cpp
index 68a7714..e02708c 100644
--- a/hostapd/aidl/aidl.cpp
+++ b/hostapd/aidl/aidl.cpp
@@ -64,8 +64,10 @@
void hostapd_aidl_deinit(struct hapd_interfaces *interfaces)
{
wpa_printf(MSG_INFO, "Deiniting aidl control");
- // Before aidl init, make sure call terminate to clear callback_
- service->terminate();
+ // Before aidl deinit, make sure call terminate to clear callback_
+ if (service) {
+ service->terminate();
+ }
eloop_unregister_read_sock(aidl_fd);
aidl_fd = -1;
}
diff --git a/hostapd/aidl/hostapd.cpp b/hostapd/aidl/hostapd.cpp
index c24e4f7..61539a0 100644
--- a/hostapd/aidl/hostapd.cpp
+++ b/hostapd/aidl/hostapd.cpp
@@ -47,7 +47,7 @@
using android::base::StringPrintf;
using android::base::WriteStringToFile;
using aidl::android::hardware::wifi::hostapd::BandMask;
-using aidl::android::hardware::wifi::hostapd::Bandwidth;
+using aidl::android::hardware::wifi::hostapd::ChannelBandwidth;
using aidl::android::hardware::wifi::hostapd::ChannelParams;
using aidl::android::hardware::wifi::hostapd::EncryptionType;
using aidl::android::hardware::wifi::hostapd::Generation;
@@ -400,7 +400,15 @@
is_6Ghz_band_only ? 1 : 2,
nw_params.passphrase.c_str());
break;
- case EncryptionType::OWE_TRANSITION:
+ 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"
@@ -611,36 +619,36 @@
}
}
-Bandwidth getBandwidth(struct hostapd_config *iconf)
+ChannelBandwidth getChannelBandwidth(struct hostapd_config *iconf)
{
- wpa_printf(MSG_DEBUG, "getBandwidth %d, isHT=%d, isHT40=%d",
+ wpa_printf(MSG_DEBUG, "getChannelBandwidth %d, isHT=%d, isHT40=%d",
iconf->vht_oper_chwidth, iconf->ieee80211n,
iconf->secondary_channel);
switch (iconf->vht_oper_chwidth) {
case CHANWIDTH_80MHZ:
- return Bandwidth::BANDWIDTH_80;
+ return ChannelBandwidth::BANDWIDTH_80;
case CHANWIDTH_80P80MHZ:
- return Bandwidth::BANDWIDTH_80P80;
+ return ChannelBandwidth::BANDWIDTH_80P80;
break;
case CHANWIDTH_160MHZ:
- return Bandwidth::BANDWIDTH_160;
+ return ChannelBandwidth::BANDWIDTH_160;
break;
case CHANWIDTH_USE_HT:
if (iconf->ieee80211n) {
return iconf->secondary_channel != 0 ?
- Bandwidth::BANDWIDTH_40 : Bandwidth::BANDWIDTH_20;
+ ChannelBandwidth::BANDWIDTH_40 : ChannelBandwidth::BANDWIDTH_20;
}
- return Bandwidth::BANDWIDTH_20_NOHT;
+ return ChannelBandwidth::BANDWIDTH_20_NOHT;
case CHANWIDTH_2160MHZ:
- return Bandwidth::BANDWIDTH_2160;
+ return ChannelBandwidth::BANDWIDTH_2160;
case CHANWIDTH_4320MHZ:
- return Bandwidth::BANDWIDTH_4320;
+ return ChannelBandwidth::BANDWIDTH_4320;
case CHANWIDTH_6480MHZ:
- return Bandwidth::BANDWIDTH_6480;
+ return ChannelBandwidth::BANDWIDTH_6480;
case CHANWIDTH_8640MHZ:
- return Bandwidth::BANDWIDTH_8640;
+ return ChannelBandwidth::BANDWIDTH_8640;
default:
- return Bandwidth::BANDWIDTH_INVALID;
+ return ChannelBandwidth::BANDWIDTH_INVALID;
}
}
@@ -836,7 +844,7 @@
iface_params_new.name = managed_interfaces[i];
std::string owe_transition_ifname = "";
- if (nw_params.encryptionType == EncryptionType::OWE_TRANSITION) {
+ 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;
@@ -950,7 +958,7 @@
iface_hapd->conf->bridge : iface_hapd->conf->iface,
info.apIfaceInstance = iface_hapd->conf->iface;
info.freqMhz = iface_hapd->iface->freq;
- info.bandwidth = getBandwidth(iface_hapd->iconf);
+ info.channelBandwidth = getChannelBandwidth(iface_hapd->iconf);
info.generation = getGeneration(iface_hapd->iface->current_mode);
info.apIfaceInstanceMacAddress.assign(iface_hapd->own_addr,
iface_hapd->own_addr + ETH_ALEN);
diff --git a/wpa_supplicant/aidl/aidl_manager.cpp b/wpa_supplicant/aidl/aidl_manager.cpp
index 97c4579..04e84b4 100644
--- a/wpa_supplicant/aidl/aidl_manager.cpp
+++ b/wpa_supplicant/aidl/aidl_manager.cpp
@@ -1194,7 +1194,7 @@
}
}
- std::vector<uint8_t> aidl_peer_wfd_r2_device_info(kWfdR2DeviceInfoLen);
+ std::vector<uint8_t> aidl_peer_wfd_r2_device_info;
if (peer_wfd_r2_device_info) {
if (peer_wfd_r2_device_info_len != kWfdR2DeviceInfoLen) {
wpa_printf(
@@ -1202,33 +1202,31 @@
peer_wfd_r2_device_info_len);
return;
} else {
- os_memcpy(
- aidl_peer_wfd_r2_device_info.data(),
- peer_wfd_r2_device_info, kWfdR2DeviceInfoLen);
+ std::copy(peer_wfd_r2_device_info,
+ peer_wfd_r2_device_info + peer_wfd_r2_device_info_len,
+ std::back_inserter(aidl_peer_wfd_r2_device_info));
}
}
- if (peer_wfd_r2_device_info_len == kWfdR2DeviceInfoLen) {
- const std::function<
- ndk::ScopedAStatus(std::shared_ptr<ISupplicantP2pIfaceCallback>)>
- func = std::bind(
- &ISupplicantP2pIfaceCallback::onR2DeviceFound,
- std::placeholders::_1, macAddrToVec(addr), macAddrToVec(info->p2p_device_addr),
- byteArrToVec(info->pri_dev_type, 8), misc_utils::charBufToString(info->device_name),
- static_cast<WpsConfigMethods>(info->config_methods),
- info->dev_capab, static_cast<P2pGroupCapabilityMask>(info->group_capab), aidl_peer_wfd_device_info,
- aidl_peer_wfd_r2_device_info);
- callWithEachP2pIfaceCallback(misc_utils::charBufToString(wpa_s->ifname), func);
- } else {
- callWithEachP2pIfaceCallback(
- misc_utils::charBufToString(wpa_s->ifname),
- std::bind(
- &ISupplicantP2pIfaceCallback::onDeviceFound,
- std::placeholders::_1, macAddrToVec(addr), macAddrToVec(info->p2p_device_addr),
- byteArrToVec(info->pri_dev_type, 8), misc_utils::charBufToString(info->device_name),
- static_cast<WpsConfigMethods>(info->config_methods),
- info->dev_capab, static_cast<P2pGroupCapabilityMask>(info->group_capab), aidl_peer_wfd_device_info));
+ std::vector<uint8_t> aidl_vendor_elems;
+ if (NULL != info->vendor_elems && wpabuf_len(info->vendor_elems) > 0) {
+ aidl_vendor_elems.reserve(wpabuf_len(info->vendor_elems));
+ std::copy(wpabuf_head_u8(info->vendor_elems),
+ wpabuf_head_u8(info->vendor_elems)
+ + wpabuf_len(info->vendor_elems),
+ std::back_inserter(aidl_vendor_elems));
}
+
+ const std::function<
+ ndk::ScopedAStatus(std::shared_ptr<ISupplicantP2pIfaceCallback>)>
+ func = std::bind(
+ &ISupplicantP2pIfaceCallback::onDeviceFoundWithVendorElements,
+ std::placeholders::_1, macAddrToVec(addr), macAddrToVec(info->p2p_device_addr),
+ byteArrToVec(info->pri_dev_type, 8), misc_utils::charBufToString(info->device_name),
+ static_cast<WpsConfigMethods>(info->config_methods),
+ info->dev_capab, static_cast<P2pGroupCapabilityMask>(info->group_capab), aidl_peer_wfd_device_info,
+ aidl_peer_wfd_r2_device_info, aidl_vendor_elems);
+ callWithEachP2pIfaceCallback(wpa_s->ifname, func);
}
void AidlManager::notifyP2pDeviceLost(
diff --git a/wpa_supplicant/aidl/p2p_iface.cpp b/wpa_supplicant/aidl/p2p_iface.cpp
index 3dcfec8..50d8fb2 100644
--- a/wpa_supplicant/aidl/p2p_iface.cpp
+++ b/wpa_supplicant/aidl/p2p_iface.cpp
@@ -46,6 +46,7 @@
using aidl::android::hardware::wifi::supplicant::ISupplicantP2pIface;
using aidl::android::hardware::wifi::supplicant::ISupplicantStaNetwork;
using aidl::android::hardware::wifi::supplicant::MiracastMode;
+using aidl::android::hardware::wifi::supplicant::P2pFrameTypeMask;
uint8_t convertAidlMiracastModeToInternal(
MiracastMode mode)
@@ -505,6 +506,53 @@
}
+static void updateP2pVendorElem(struct wpa_supplicant* wpa_s, enum wpa_vendor_elem_frame frameType,
+ const std::vector<uint8_t>& vendorElemBytes) {
+
+ wpa_printf(MSG_INFO, "Set vendor elements to frames %d", frameType);
+ struct wpa_supplicant* vendor_elem_wpa_s = wpas_vendor_elem(wpa_s, frameType);
+ if (vendor_elem_wpa_s->vendor_elem[frameType]) {
+ wpabuf_free(vendor_elem_wpa_s->vendor_elem[frameType]);
+ vendor_elem_wpa_s->vendor_elem[frameType] = NULL;
+ }
+ if (vendorElemBytes.size() > 0) {
+ vendor_elem_wpa_s->vendor_elem[frameType] =
+ wpabuf_alloc_copy(vendorElemBytes.data(), vendorElemBytes.size());
+ }
+ wpas_vendor_elem_update(vendor_elem_wpa_s);
+}
+
+uint32_t convertWpaP2pFrameTypeToHalP2pFrameTypeBit(int frameType) {
+ switch (frameType) {
+ case VENDOR_ELEM_PROBE_REQ_P2P:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_PROBE_REQ_P2P);
+ case VENDOR_ELEM_PROBE_RESP_P2P:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_PROBE_RESP_P2P);
+ case VENDOR_ELEM_PROBE_RESP_P2P_GO:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_PROBE_RESP_P2P_GO);
+ case VENDOR_ELEM_BEACON_P2P_GO:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_BEACON_P2P_GO);
+ case VENDOR_ELEM_P2P_PD_REQ:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_P2P_PD_REQ);
+ case VENDOR_ELEM_P2P_PD_RESP:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_P2P_PD_RESP);
+ case VENDOR_ELEM_P2P_GO_NEG_REQ:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_P2P_GO_NEG_REQ);
+ case VENDOR_ELEM_P2P_GO_NEG_RESP:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_P2P_GO_NEG_RESP);
+ case VENDOR_ELEM_P2P_GO_NEG_CONF:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_P2P_GO_NEG_CONF);
+ case VENDOR_ELEM_P2P_INV_REQ:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_P2P_INV_REQ);
+ case VENDOR_ELEM_P2P_INV_RESP:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_P2P_INV_RESP);
+ case VENDOR_ELEM_P2P_ASSOC_REQ:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_P2P_ASSOC_REQ);
+ case VENDOR_ELEM_P2P_ASSOC_RESP:
+ return static_cast<uint32_t>(P2pFrameTypeMask::P2P_FRAME_P2P_ASSOC_RESP);
+ }
+ return 0;
+}
} // namespace
namespace aidl {
@@ -1044,6 +1092,15 @@
in_freq, in_timeoutInSec);
}
+::ndk::ScopedAStatus P2pIface::setVendorElements(
+ P2pFrameTypeMask in_frameTypeMask,
+ const std::vector<uint8_t>& in_vendorElemBytes)
+{
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_IFACE_INVALID,
+ &P2pIface::setVendorElementsInternal, in_frameTypeMask, in_vendorElemBytes);
+}
+
std::pair<std::string, ndk::ScopedAStatus> P2pIface::getNameInternal()
{
return {ifname_, ndk::ScopedAStatus::ok()};
@@ -2066,6 +2123,22 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus P2pIface::setVendorElementsInternal(
+ P2pFrameTypeMask frameTypeMask,
+ const std::vector<uint8_t>& vendorElemBytes)
+{
+ struct wpa_supplicant* wpa_s = retrieveIfacePtr();
+ for (int i = 0; i < NUM_VENDOR_ELEM_FRAMES; i++) {
+ uint32_t bit = convertWpaP2pFrameTypeToHalP2pFrameTypeBit(i);
+ if (0 == bit) continue;
+
+ if (static_cast<uint32_t>(frameTypeMask) & bit) {
+ updateP2pVendorElem(wpa_s, (enum wpa_vendor_elem_frame) i, vendorElemBytes);
+ }
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
/**
* Retrieve the underlying |wpa_supplicant| struct
* pointer for this iface.
diff --git a/wpa_supplicant/aidl/p2p_iface.h b/wpa_supplicant/aidl/p2p_iface.h
index 4cb86b6..5f9903c 100644
--- a/wpa_supplicant/aidl/p2p_iface.h
+++ b/wpa_supplicant/aidl/p2p_iface.h
@@ -169,6 +169,9 @@
::ndk::ScopedAStatus findOnSocialChannels(int32_t in_timeoutInSec) override;
::ndk::ScopedAStatus findOnSpecificFrequency(
int32_t in_freq, int32_t in_timeoutInSec) override;
+ ::ndk::ScopedAStatus setVendorElements(
+ P2pFrameTypeMask in_frameTypeMask,
+ const std::vector<uint8_t>& in_vendorElemBytes) override;
private:
// Corresponding worker functions for the AIDL methods.
@@ -286,6 +289,9 @@
ndk::ScopedAStatus findOnSocialChannelsInternal(uint32_t timeout_in_sec);
ndk::ScopedAStatus findOnSpecificFrequencyInternal(
uint32_t freq, uint32_t timeout_in_sec);
+ ndk::ScopedAStatus setVendorElementsInternal(
+ P2pFrameTypeMask frameTypeMask,
+ const std::vector<uint8_t>& vendorElemBytes);
struct wpa_supplicant* retrieveIfacePtr();
struct wpa_supplicant* retrieveGroupIfacePtr(
diff --git a/wpa_supplicant/aidl/sta_iface.cpp b/wpa_supplicant/aidl/sta_iface.cpp
index fe16aef..084ea2c 100644
--- a/wpa_supplicant/aidl/sta_iface.cpp
+++ b/wpa_supplicant/aidl/sta_iface.cpp
@@ -804,6 +804,12 @@
&StaIface::removeAllQosPoliciesInternal);
}
+::ndk::ScopedAStatus StaIface::getConnectionMloLinksInfo(MloLinksInfo* _aidl_return) {
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_UNKNOWN,
+ &StaIface::getConnectionMloLinksInfoInternal, _aidl_return);
+}
+
std::pair<std::string, ndk::ScopedAStatus> StaIface::getNameInternal()
{
return {ifname_, ndk::ScopedAStatus::ok()};
@@ -1813,6 +1819,12 @@
return ndk::ScopedAStatus::ok();
}
+std::pair<MloLinksInfo, ndk::ScopedAStatus> StaIface::getConnectionMloLinksInfoInternal()
+{
+ MloLinksInfo linksInfo;
+ return {linksInfo, 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 3b4c524..44e3ef5 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/MloLinksInfo.h>
#include <aidl/android/hardware/wifi/supplicant/QosPolicyStatus.h>
#include <aidl/android/hardware/wifi/supplicant/RxFilterType.h>
@@ -154,6 +155,7 @@
::ndk::ScopedAStatus sendQosPolicyResponse(
bool in_morePolicies, const std::vector<QosPolicyStatus>& in_qosPolicyStatusList) override;
::ndk::ScopedAStatus removeAllQosPolicies() override;
+ ::ndk::ScopedAStatus getConnectionMloLinksInfo(MloLinksInfo* _aidl_return) override;
private:
// Corresponding worker functions for the AIDL methods.
@@ -256,7 +258,7 @@
ndk::ScopedAStatus sendQosPolicyResponseInternal(
bool more_policies, const std::vector<QosPolicyStatus>& qos_policy_status_list);
ndk::ScopedAStatus removeAllQosPoliciesInternal();
-
+ std::pair<MloLinksInfo, ndk::ScopedAStatus> getConnectionMloLinksInfoInternal();
struct wpa_supplicant* retrieveIfacePtr();
// Reference to the global wpa_struct. This is assumed to be valid for
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index df3bb35..54d223d 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -8111,7 +8111,7 @@
}
#ifdef CONFIG_P2P
- if (wpa_s->parent == wpa_s &&
+ if ((wpa_s->parent == wpa_s || (wpa_s == wpa_s->p2pdev && wpa_s->p2p_mgmt)) &&
wpa_s->global->p2p &&
!wpa_s->global->p2p_disabled)
p2p_set_vendor_elems(wpa_s->global->p2p, wpa_s->vendor_elem);