diff options
Diffstat (limited to 'wpa_supplicant')
24 files changed, 475 insertions, 80 deletions
diff --git a/wpa_supplicant/Android.bp b/wpa_supplicant/Android.bp index dd4423aa..ca56d143 100644 --- a/wpa_supplicant/Android.bp +++ b/wpa_supplicant/Android.bp @@ -67,7 +67,7 @@ cc_defaults { defaults: ["wpa_supplicant_cflags_defaults"], srcs: [":wpa_supplicant_srcs"], shared_libs: [ - "android.hardware.wifi.supplicant-V2-ndk", + "android.hardware.wifi.supplicant-V3-ndk", "android.system.keystore2-V1-ndk", "libbase", "libbinder_ndk", diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk index 03dc209c..509dbbc0 100644 --- a/wpa_supplicant/Android.mk +++ b/wpa_supplicant/Android.mk @@ -1835,7 +1835,7 @@ ifeq ($(CONFIG_TLS), openssl) PASNOBJS += src/crypto/crypto_openssl.c ifdef TLS_FUNCS PASNOBJS += src/crypto/tls_openssl.c -#PASNOBJS += -lssl -lcrypto +PASNOBJS += src/crypto/tls_openssl_ocsp.c NEED_TLS_PRF_SHA256=y endif endif @@ -1912,8 +1912,13 @@ LOCAL_C_INCLUDES := $(INCLUDES) include $(BUILD_EXECUTABLE) ######################## +# Build wpa_supplicant +# +# $(1): if defined build wpa_supplicant with macsec support (with different executable name wpa_supplicant_macsec +# +define wpa_supplicant_gen + include $(CLEAR_VARS) -LOCAL_MODULE := wpa_supplicant LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD SPDX-license-identifier-BSD-3-Clause SPDX-license-identifier-ISC legacy_unencumbered LOCAL_LICENSE_CONDITIONS := notice unencumbered LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../LICENSE @@ -1945,14 +1950,19 @@ else LOCAL_STATIC_LIBRARIES += libnl_2 endif endif -LOCAL_CFLAGS := $(L_CFLAGS) LOCAL_SRC_FILES := $(OBJS) LOCAL_C_INCLUDES := $(INCLUDES) ifeq ($(DBUS), y) LOCAL_SHARED_LIBRARIES += libdbus endif + +ifneq ($(1),) +# wpa_supplicant for wifi +LOCAL_CFLAGS := $(L_CFLAGS) +LOCAL_MODULE := wpa_supplicant + ifeq ($(WPA_SUPPLICANT_USE_AIDL), y) -LOCAL_SHARED_LIBRARIES += android.hardware.wifi.supplicant-V2-ndk +LOCAL_SHARED_LIBRARIES += android.hardware.wifi.supplicant-V3-ndk LOCAL_SHARED_LIBRARIES += android.system.keystore2-V1-ndk LOCAL_SHARED_LIBRARIES += libutils libbase LOCAL_SHARED_LIBRARIES += libbinder_ndk @@ -1962,7 +1972,37 @@ ifeq ($(WIFI_HIDL_UNIFIED_SUPPLICANT_SERVICE_RC_ENTRY), true) LOCAL_INIT_RC=aidl/android.hardware.wifi.supplicant-service.rc endif endif + +else +# wpa_supplicant for macsec +# remove aidl control interface, standalone +LOCAL_CFLAGS := $(patsubst -DCONFIG_CTRL_IFACE_AIDL,,$(patsubst -DCONFIG_AIDL,,$(L_CFLAGS))) +LOCAL_CFLAGS += -DCONFIG_MACSEC -DCONFIG_DRIVER_MACSEC_LINUX +# config macsec to use AIDL interface for CAK key. +LOCAL_CFLAGS += -DCONFIG_AIDL_MACSEC_PSK_METHODS +LOCAL_SRC_FILES += ../src/drivers/driver_macsec_linux.c \ + ../src/drivers/driver_wired_common.c +LOCAL_SRC_FILES += wpas_kay.c \ + src/pae/ieee802_1x_cp.c \ + src/pae/ieee802_1x_kay.c \ + src/pae/ieee802_1x_key.c \ + src/pae/ieee802_1x_secy_ops.c +LOCAL_SRC_FILES += src/pae/aidl/aidl_psk.cpp +LOCAL_SHARED_LIBRARIES += android.hardware.macsec-V1-ndk \ + libbinder_ndk +LOCAL_C_INCLUDES += $(LOCAL_PATH)/aidl + +ifdef CONFIG_AP +LOCAL_SRC_FILES += src/ap/wpa_auth_kay.c +endif +LOCAL_MODULE := wpa_supplicant_macsec +endif + include $(BUILD_EXECUTABLE) +endef + +$(eval $(call wpa_supplicant_gen,)) +$(eval $(call wpa_supplicant_gen, macsec)) ######################## # @@ -2026,7 +2066,7 @@ LOCAL_SRC_FILES := \ aidl/sta_network.cpp \ aidl/supplicant.cpp LOCAL_SHARED_LIBRARIES := \ - android.hardware.wifi.supplicant-V2-ndk \ + android.hardware.wifi.supplicant-V3-ndk \ android.system.keystore2-V1-ndk \ libbinder_ndk \ libbase \ @@ -2038,13 +2078,20 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := \ include $(BUILD_STATIC_LIBRARY) endif # WPA_SUPPLICANT_USE_AIDL == y -#include $(CLEAR_VARS) -#LOCAL_MODULE = libpasn -#LOCAL_CFLAGS = $(L_CFLAGS) -#LOCAL_SRC_FILES = $(PASNOBJS) -#LOCAL_C_INCLUDES = $(INCLUDES) -#LOCAL_SHARED_LIBRARIES := libc libcutils liblog -#ifeq ($(CONFIG_TLS), openssl) -#LOCAL_SHARED_LIBRARIES := libcrypto libssl -#endif -#include $(BUILD_SHARED_LIBRARY) +ifeq ($(CONFIG_PASN), y) +include $(CLEAR_VARS) +LOCAL_MODULE = libpasn +LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD SPDX-license-identifier-BSD-3-Clause SPDX-license-identifier-ISC legacy_unencumbered +LOCAL_LICENSE_CONDITIONS := notice unencumbered +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../LICENSE +LOCAL_VENDOR_MODULE := true +LOCAL_CFLAGS = $(L_CFLAGS) +LOCAL_SRC_FILES = $(PASNOBJS) +LOCAL_C_INCLUDES = $(INCLUDES) +LOCAL_SHARED_LIBRARIES := libc libcutils liblog +ifeq ($(CONFIG_TLS), openssl) +LOCAL_SHARED_LIBRARIES += libcrypto libssl libkeystore-wifi-hidl +LOCAL_SHARED_LIBRARIES += libkeystore-engine-wifi-hidl +endif +include $(BUILD_SHARED_LIBRARY) +endif # CONFIG_PASN == y diff --git a/wpa_supplicant/aidl/Android.bp b/wpa_supplicant/aidl/Android.bp index d7dcf972..481ad0b3 100644 --- a/wpa_supplicant/aidl/Android.bp +++ b/wpa_supplicant/aidl/Android.bp @@ -33,7 +33,7 @@ cc_library_static { defaults: ["wpa_supplicant_cflags_defaults"], soc_specific: true, shared_libs: [ - "android.hardware.wifi.supplicant-V2-ndk", + "android.hardware.wifi.supplicant-V3-ndk", "android.system.keystore2-V1-ndk", "libbinder_ndk", "libbase", diff --git a/wpa_supplicant/aidl/aidl.cpp b/wpa_supplicant/aidl/aidl.cpp index f221862a..d1cf8913 100644 --- a/wpa_supplicant/aidl/aidl.cpp +++ b/wpa_supplicant/aidl/aidl.cpp @@ -613,7 +613,7 @@ void wpas_aidl_notify_p2p_invitation_result( void wpas_aidl_notify_p2p_provision_discovery( struct wpa_supplicant *wpa_s, const u8 *dev_addr, int request, enum p2p_prov_disc_status status, u16 config_methods, - unsigned int generated_pin) + unsigned int generated_pin, const char *group_ifname) { if (!wpa_s || !dev_addr) return; @@ -628,7 +628,8 @@ void wpas_aidl_notify_p2p_provision_discovery( return; aidl_manager->notifyP2pProvisionDiscovery( - wpa_s, dev_addr, request, status, config_methods, generated_pin); + wpa_s, dev_addr, request, status, config_methods, + generated_pin, group_ifname); } void wpas_aidl_notify_p2p_sd_response( @@ -652,7 +653,8 @@ void wpas_aidl_notify_p2p_sd_response( } void wpas_aidl_notify_ap_sta_authorized( - struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr) + struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr, + const u8 *ip) { if (!wpa_s || !sta) return; @@ -666,7 +668,7 @@ void wpas_aidl_notify_ap_sta_authorized( if (!aidl_manager) return; - aidl_manager->notifyApStaAuthorized(wpa_s, sta, p2p_dev_addr); + aidl_manager->notifyApStaAuthorized(wpa_s, sta, p2p_dev_addr, ip); } void wpas_aidl_notify_ap_sta_deauthorized( diff --git a/wpa_supplicant/aidl/aidl.h b/wpa_supplicant/aidl/aidl.h index dfe5c745..eb1426ac 100644 --- a/wpa_supplicant/aidl/aidl.h +++ b/wpa_supplicant/aidl/aidl.h @@ -95,13 +95,13 @@ extern "C" void wpas_aidl_notify_p2p_provision_discovery( struct wpa_supplicant *wpa_s, const u8 *dev_addr, int request, enum p2p_prov_disc_status status, u16 config_methods, - unsigned int generated_pin); + unsigned int generated_pin, const char *group_ifname); void wpas_aidl_notify_p2p_sd_response( struct wpa_supplicant *wpa_s, const u8 *sa, u16 update_indic, const u8 *tlvs, size_t tlvs_len); void wpas_aidl_notify_ap_sta_authorized( struct wpa_supplicant *wpa_s, const u8 *sta, - const u8 *p2p_dev_addr); + const u8 *p2p_dev_addr, const u8 *ip); void wpas_aidl_notify_ap_sta_deauthorized( struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr); @@ -253,14 +253,15 @@ static void wpas_aidl_notify_p2p_invitation_result( static void wpas_aidl_notify_p2p_provision_discovery( struct wpa_supplicant *wpa_s, const u8 *dev_addr, int request, enum p2p_prov_disc_status status, u16 config_methods, - unsigned int generated_pin) + unsigned int generated_pin, const char *group_ifname) {} static void wpas_aidl_notify_p2p_sd_response( struct wpa_supplicant *wpa_s, const u8 *sa, u16 update_indic, const u8 *tlvs, size_t tlvs_len) {} static void wpas_aidl_notify_ap_sta_authorized( - struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr) + struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr, + const u8 *ip) {} static void wpas_aidl_notify_ap_sta_deauthorized( struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr) diff --git a/wpa_supplicant/aidl/aidl_manager.cpp b/wpa_supplicant/aidl/aidl_manager.cpp index b3baf5b4..cac9ddb6 100644 --- a/wpa_supplicant/aidl/aidl_manager.cpp +++ b/wpa_supplicant/aidl/aidl_manager.cpp @@ -37,11 +37,21 @@ constexpr size_t kGsmRandLenBytes = GSM_RAND_LEN; constexpr size_t kUmtsRandLenBytes = EAP_AKA_RAND_LEN; constexpr size_t kUmtsAutnLenBytes = EAP_AKA_AUTN_LEN; const std::vector<uint8_t> kZeroBssid = {0, 0, 0, 0, 0, 0}; +int32_t aidl_service_version = 0; using aidl::android::hardware::wifi::supplicant::GsmRand; using aidl::android::hardware::wifi::supplicant::KeyMgmtMask; /** + * Check that the AIDL service is running at least the expected version. + * Use to avoid the case where the AIDL interface version + * is greater than the version implemented by the service. + */ +inline int32_t isAidlServiceVersionAtLeast(int32_t expected_version) +{ + return expected_version <= aidl_service_version; +} +/** * Check if the provided |wpa_supplicant| structure represents a P2P iface or * not. */ @@ -407,8 +417,11 @@ int AidlManager::registerAidlService(struct wpa_global *global) { // Create the main aidl service object and register it. wpa_printf(MSG_INFO, "Starting AIDL supplicant"); - wpa_printf(MSG_INFO, "Interface version: %d", Supplicant::version); supplicant_object_ = ndk::SharedRefBase::make<Supplicant>(global); + if (!supplicant_object_->getInterfaceVersion(&aidl_service_version).isOk()) { + aidl_service_version = Supplicant::version; + } + wpa_printf(MSG_INFO, "AIDL Interface version: %d", aidl_service_version); wpa_global_ = global; std::string instance = std::string() + Supplicant::descriptor + "/default"; if (AServiceManager_addService(supplicant_object_->asBinder().get(), @@ -1331,16 +1344,35 @@ void AidlManager::notifyP2pDeviceFound( 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); + if (isAidlServiceVersionAtLeast(3)) { + P2pDeviceFoundEventParams params; + params.srcAddress = macAddrToArray(addr); + params.p2pDeviceAddress = macAddrToArray(info->p2p_device_addr); + params.primaryDeviceType = byteArrToVec(info->pri_dev_type, 8); + params.deviceName = misc_utils::charBufToString(info->device_name); + params.configMethods = info->config_methods; + params.deviceCapabilities = info->dev_capab; + params.groupCapabilities = info->group_capab; + params.wfdDeviceInfo = aidl_peer_wfd_device_info; + params.wfdR2DeviceInfo = aidl_peer_wfd_r2_device_info; + params.vendorElemBytes = aidl_vendor_elems; + callWithEachP2pIfaceCallback( + misc_utils::charBufToString(wpa_s->ifname), + std::bind( + &ISupplicantP2pIfaceCallback::onDeviceFoundWithParams, + std::placeholders::_1, params)); + } else { + 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( @@ -1558,7 +1590,7 @@ void AidlManager::notifyP2pInvitationResult( void AidlManager::notifyP2pProvisionDiscovery( struct wpa_supplicant *wpa_s, const u8 *dev_addr, int request, enum p2p_prov_disc_status status, u16 config_methods, - unsigned int generated_pin) + unsigned int generated_pin, const char *group_ifname) { if (!wpa_s || !dev_addr) return; @@ -1572,15 +1604,33 @@ void AidlManager::notifyP2pProvisionDiscovery( aidl_generated_pin = misc_utils::convertWpsPinToString(generated_pin); } - bool aidl_is_request = (request == 1 ? true : false); - - callWithEachP2pIfaceCallback( - misc_utils::charBufToString(wpa_s->ifname), - std::bind( - &ISupplicantP2pIfaceCallback::onProvisionDiscoveryCompleted, - std::placeholders::_1, macAddrToVec(dev_addr), aidl_is_request, - static_cast<P2pProvDiscStatusCode>(status), - static_cast<WpsConfigMethods>(config_methods), aidl_generated_pin)); + bool aidl_is_request = (request == 1); + + if (isAidlServiceVersionAtLeast(3)) { + P2pProvisionDiscoveryCompletedEventParams params; + params.p2pDeviceAddress = macAddrToArray(dev_addr); + params.isRequest = aidl_is_request; + params.status = static_cast<P2pProvDiscStatusCode>(status); + params.configMethods = static_cast<WpsConfigMethods>(config_methods); + params.generatedPin = aidl_generated_pin; + if (group_ifname != NULL) { + params.groupInterfaceName = misc_utils::charBufToString(group_ifname); + } + callWithEachP2pIfaceCallback( + misc_utils::charBufToString(wpa_s->ifname), + std::bind( + &ISupplicantP2pIfaceCallback::onProvisionDiscoveryCompletedEvent, + std::placeholders::_1, params)); + } else { + // Use legacy callback if interface version < 3 + callWithEachP2pIfaceCallback( + misc_utils::charBufToString(wpa_s->ifname), + std::bind( + &ISupplicantP2pIfaceCallback::onProvisionDiscoveryCompleted, + std::placeholders::_1, macAddrToVec(dev_addr), aidl_is_request, + static_cast<P2pProvDiscStatusCode>(status), + static_cast<WpsConfigMethods>(config_methods), aidl_generated_pin)); + } } void AidlManager::notifyP2pSdResponse( @@ -1603,19 +1653,40 @@ void AidlManager::notifyP2pSdResponse( } void AidlManager::notifyApStaAuthorized( - struct wpa_supplicant *wpa_group_s, const u8 *sta, const u8 *p2p_dev_addr) + struct wpa_supplicant *wpa_group_s, const u8 *sta, const u8 *p2p_dev_addr, + const u8 *ip) { if (!wpa_group_s || !wpa_group_s->parent || !sta) return; wpa_supplicant *wpa_s = getTargetP2pIfaceForGroup(wpa_group_s); if (!wpa_s) return; - callWithEachP2pIfaceCallback( - misc_utils::charBufToString(wpa_s->ifname), - std::bind( - &ISupplicantP2pIfaceCallback::onStaAuthorized, - std::placeholders::_1, macAddrToVec(sta), - p2p_dev_addr ? macAddrToVec(p2p_dev_addr) : kZeroBssid)); + + if (isAidlServiceVersionAtLeast(3)) { + P2pPeerClientJoinedEventParams params; + params.groupInterfaceName = misc_utils::charBufToString(wpa_group_s->ifname); + params.clientInterfaceAddress = macAddrToArray(sta); + params.clientDeviceAddress = p2p_dev_addr ? + macAddrToArray(p2p_dev_addr) : macAddrToArray(kZeroBssid.data()); + int aidl_ip = 0; + if (NULL != ip) { + os_memcpy(&aidl_ip, &ip[0], 4); + } + params.clientIpAddress = aidl_ip; + callWithEachP2pIfaceCallback( + misc_utils::charBufToString(wpa_s->ifname), + std::bind( + &ISupplicantP2pIfaceCallback::onPeerClientJoined, + std::placeholders::_1, params)); + } else { + // Use legacy callback if interface version < 3 + callWithEachP2pIfaceCallback( + misc_utils::charBufToString(wpa_s->ifname), + std::bind( + &ISupplicantP2pIfaceCallback::onStaAuthorized, + std::placeholders::_1, macAddrToVec(sta), + p2p_dev_addr ? macAddrToVec(p2p_dev_addr) : kZeroBssid)); + } } void AidlManager::notifyApStaDeauthorized( @@ -1627,12 +1698,27 @@ void AidlManager::notifyApStaDeauthorized( if (!wpa_s) return; - callWithEachP2pIfaceCallback( - misc_utils::charBufToString(wpa_s->ifname), - std::bind( - &ISupplicantP2pIfaceCallback::onStaDeauthorized, - std::placeholders::_1, macAddrToVec(sta), - p2p_dev_addr ? macAddrToVec(p2p_dev_addr) : kZeroBssid)); + if (isAidlServiceVersionAtLeast(3)) { + P2pPeerClientDisconnectedEventParams params; + params.groupInterfaceName = misc_utils::charBufToString(wpa_group_s->ifname); + params.clientInterfaceAddress = macAddrToArray(sta); + params.clientDeviceAddress = p2p_dev_addr ? + macAddrToArray(p2p_dev_addr) : macAddrToArray(kZeroBssid.data()); + + callWithEachP2pIfaceCallback( + misc_utils::charBufToString(wpa_s->ifname), + std::bind( + &ISupplicantP2pIfaceCallback::onPeerClientDisconnected, + std::placeholders::_1, params)); + } else { + // Use legacy callback if interface version < 3 + callWithEachP2pIfaceCallback( + misc_utils::charBufToString(wpa_s->ifname), + std::bind( + &ISupplicantP2pIfaceCallback::onStaDeauthorized, + std::placeholders::_1, macAddrToVec(sta), + p2p_dev_addr ? macAddrToVec(p2p_dev_addr) : kZeroBssid)); + } } void AidlManager::notifyExtRadioWorkStart( diff --git a/wpa_supplicant/aidl/aidl_manager.h b/wpa_supplicant/aidl/aidl_manager.h index 8f1f1770..cd9d5f6c 100644 --- a/wpa_supplicant/aidl/aidl_manager.h +++ b/wpa_supplicant/aidl/aidl_manager.h @@ -116,13 +116,13 @@ public: void notifyP2pProvisionDiscovery( struct wpa_supplicant *wpa_s, const u8 *dev_addr, int request, enum p2p_prov_disc_status status, u16 config_methods, - unsigned int generated_pin); + unsigned int generated_pin, const char *group_ifname); void notifyP2pSdResponse( struct wpa_supplicant *wpa_s, const u8 *sa, u16 update_indic, const u8 *tlvs, size_t tlvs_len); void notifyApStaAuthorized( struct wpa_supplicant *wpa_s, const u8 *sta, - const u8 *p2p_dev_addr); + const u8 *p2p_dev_addr, const u8 *ip); void notifyApStaDeauthorized( struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr); diff --git a/wpa_supplicant/aidl/android.hardware.wifi.supplicant.xml b/wpa_supplicant/aidl/android.hardware.wifi.supplicant.xml index b80daddf..37cc3af3 100644 --- a/wpa_supplicant/aidl/android.hardware.wifi.supplicant.xml +++ b/wpa_supplicant/aidl/android.hardware.wifi.supplicant.xml @@ -1,7 +1,7 @@ <manifest version="1.0" type="device"> <hal format="aidl"> <name>android.hardware.wifi.supplicant</name> - <version>2</version> + <version>3</version> <fqname>ISupplicant/default</fqname> </hal> </manifest> diff --git a/wpa_supplicant/aidl/p2p_iface.cpp b/wpa_supplicant/aidl/p2p_iface.cpp index 33db802d..ec52b440 100644 --- a/wpa_supplicant/aidl/p2p_iface.cpp +++ b/wpa_supplicant/aidl/p2p_iface.cpp @@ -815,6 +815,21 @@ ndk::ScopedAStatus P2pIface::addGroup( in_ipAddressGo, in_ipAddressMask, in_ipAddressStart, in_ipAddressEnd); } +::ndk::ScopedAStatus P2pIface::connectWithParams( + const P2pConnectInfo& in_connectInfo, std::string* _aidl_return) +{ + return validateAndCall( + this, SupplicantStatusCode::FAILURE_IFACE_INVALID, + &P2pIface::connectWithParamsInternal, _aidl_return, in_connectInfo); +} + +::ndk::ScopedAStatus P2pIface::findWithParams(const P2pDiscoveryInfo& in_discoveryInfo) +{ + return validateAndCall( + this, SupplicantStatusCode::FAILURE_IFACE_INVALID, + &P2pIface::findWithParamsInternal, in_discoveryInfo); +} + std::pair<std::string, ndk::ScopedAStatus> P2pIface::getNameInternal() { return {ifname_, ndk::ScopedAStatus::ok()}; @@ -1852,6 +1867,33 @@ ndk::ScopedAStatus P2pIface::configureEapolIpAddressAllocationParamsInternal( return ndk::ScopedAStatus::ok(); } +std::pair<std::string, ndk::ScopedAStatus> P2pIface::connectWithParamsInternal( + const P2pConnectInfo& connectInfo) +{ + std::vector<uint8_t> peerAddressVec { + connectInfo.peerAddress.begin(), connectInfo.peerAddress.end()}; + return connectInternal(peerAddressVec, connectInfo.provisionMethod, + connectInfo.preSelectedPin, connectInfo.joinExistingGroup, + connectInfo.persistent, connectInfo.goIntent); +} + +ndk::ScopedAStatus P2pIface::findWithParamsInternal(const P2pDiscoveryInfo& discoveryInfo) +{ + switch (discoveryInfo.scanType) { + case P2pScanType::FULL: + return findInternal(discoveryInfo.timeoutInSec); + case P2pScanType::SOCIAL: + return findOnSocialChannelsInternal(discoveryInfo.timeoutInSec); + case P2pScanType::SPECIFIC_FREQ: + return findOnSpecificFrequencyInternal( + discoveryInfo.frequencyMhz, discoveryInfo.timeoutInSec); + default: + wpa_printf(MSG_DEBUG, + "findWithParams received invalid scan type %d", discoveryInfo.scanType); + return createStatus(SupplicantStatusCode::FAILURE_ARGS_INVALID); + } +} + /** * 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 61972f26..c4f036c8 100644 --- a/wpa_supplicant/aidl/p2p_iface.h +++ b/wpa_supplicant/aidl/p2p_iface.h @@ -175,6 +175,9 @@ public: ::ndk::ScopedAStatus configureEapolIpAddressAllocationParams( int32_t in_ipAddressGo, int32_t in_ipAddressMask, int32_t in_ipAddressStart, int32_t in_ipAddressEnd) override; + ::ndk::ScopedAStatus connectWithParams( + const P2pConnectInfo& in_connectInfo, std::string* _aidl_return) override; + ::ndk::ScopedAStatus findWithParams(const P2pDiscoveryInfo& in_discoveryInfo) override; private: // Corresponding worker functions for the AIDL methods. @@ -298,6 +301,9 @@ private: ::ndk::ScopedAStatus configureEapolIpAddressAllocationParamsInternal( uint32_t ipAddressGo, uint32_t ipAddressMask, uint32_t ipAddressStart, uint32_t ipAddressEnd); + std::pair<std::string, ndk::ScopedAStatus> connectWithParamsInternal( + const P2pConnectInfo& connectInfo); + ndk::ScopedAStatus findWithParamsInternal(const P2pDiscoveryInfo& discoveryInfo); 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 fb3ebcd5..78e6cd3c 100644 --- a/wpa_supplicant/aidl/sta_iface.cpp +++ b/wpa_supplicant/aidl/sta_iface.cpp @@ -843,6 +843,18 @@ bool StaIface::isValid() &StaIface::removeQosPolicyForScsInternal, _aidl_return, in_scsPolicyIds); } +::ndk::ScopedAStatus StaIface::configureMscs(const MscsParams& in_params) { + return validateAndCall( + this, SupplicantStatusCode::FAILURE_UNKNOWN, + &StaIface::configureMscsInternal, in_params); +} + +::ndk::ScopedAStatus StaIface::disableMscs() { + return validateAndCall( + this, SupplicantStatusCode::FAILURE_UNKNOWN, + &StaIface::disableMscsInternal); +} + std::pair<std::string, ndk::ScopedAStatus> StaIface::getNameInternal() { return {ifname_, ndk::ScopedAStatus::ok()}; @@ -2427,6 +2439,14 @@ StaIface::removeQosPolicyForScsInternal(const std::vector<uint8_t>& scsPolicyIds ndk::ScopedAStatus::ok()}; } +::ndk::ScopedAStatus StaIface::configureMscsInternal(const MscsParams& params) { + return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED); +} + +::ndk::ScopedAStatus StaIface::disableMscsInternal() { + return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED); +} + /** * 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 db914452..b52c6b0c 100644 --- a/wpa_supplicant/aidl/sta_iface.h +++ b/wpa_supplicant/aidl/sta_iface.h @@ -165,6 +165,8 @@ public: ::ndk::ScopedAStatus removeQosPolicyForScs( const std::vector<uint8_t>& in_scsPolicyIds, std::vector<QosPolicyScsRequestStatus>* _aidl_return) override; + ::ndk::ScopedAStatus configureMscs(const MscsParams& in_params) override; + ::ndk::ScopedAStatus disableMscs() override; private: // Corresponding worker functions for the AIDL methods. @@ -277,6 +279,8 @@ private: std::pair<std::vector<QosPolicyScsRequestStatus>, ndk::ScopedAStatus> removeQosPolicyForScsInternal( const std::vector<uint8_t>& scsPolicyIds); + ::ndk::ScopedAStatus configureMscsInternal(const MscsParams& params); + ::ndk::ScopedAStatus disableMscsInternal(); struct wpa_supplicant* retrieveIfacePtr(); diff --git a/wpa_supplicant/aidl/sta_network.cpp b/wpa_supplicant/aidl/sta_network.cpp index bb3045c8..f373e713 100644 --- a/wpa_supplicant/aidl/sta_network.cpp +++ b/wpa_supplicant/aidl/sta_network.cpp @@ -891,6 +891,21 @@ ndk::ScopedAStatus StaNetwork::getBssid( &StaNetwork::setMinimumTlsVersionEapPhase1ParamInternal, in_tlsVersion); } +::ndk::ScopedAStatus StaNetwork::disableEht() +{ + return validateAndCall( + this, SupplicantStatusCode::FAILURE_NETWORK_INVALID, + &StaNetwork::disableEhtInternal); +} + +::ndk::ScopedAStatus StaNetwork::setVendorData( + const std::vector<common::OuiKeyedData>& in_vendorData) +{ + return validateAndCall( + this, SupplicantStatusCode::FAILURE_NETWORK_INVALID, + &StaNetwork::setVendorDataInternal, in_vendorData); +} + std::pair<uint32_t, ndk::ScopedAStatus> StaNetwork::getIdInternal() { return {network_id_, ndk::ScopedAStatus::ok()}; @@ -2689,15 +2704,32 @@ ndk::ScopedAStatus StaNetwork::setMinimumTlsVersionEapPhase1ParamInternal(TlsVer FALLTHROUGH_INTENDED; case TlsVersion::TLS_V1_1: tlsFlags |= TLS_CONN_DISABLE_TLSv1_0; - FALLTHROUGH_INTENDED; - default: break; + default: + return createStatus(SupplicantStatusCode::FAILURE_UNSUPPORTED); } generateTlsParams(); return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus StaNetwork::disableEhtInternal() +{ + struct wpa_ssid *wpa_ssid = retrieveNetworkPtr(); + if (wpa_ssid == nullptr ) { + return createStatus(SupplicantStatusCode::FAILURE_NETWORK_INVALID); + } + wpa_ssid->disable_eht = 1; + resetInternalStateAfterParamsUpdate(); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus StaNetwork::setVendorDataInternal( + const std::vector<common::OuiKeyedData>& /* vendorData */) { + // Not implemented in the default implementation. + return ndk::ScopedAStatus::ok(); +} + /** * WPA3-Enterprise 192-bit mode workaround to force the connection to EAP-TLSv1.2 due to * interoperability issues in TLSv1.3 which disables the SSL_SIGN_RSA_PKCS1_SHA384 diff --git a/wpa_supplicant/aidl/sta_network.h b/wpa_supplicant/aidl/sta_network.h index 1c24702a..b0cb3dec 100644 --- a/wpa_supplicant/aidl/sta_network.h +++ b/wpa_supplicant/aidl/sta_network.h @@ -178,6 +178,9 @@ public: const std::vector<uint8_t>& in_selectedRcoi) override; ::ndk::ScopedAStatus setMinimumTlsVersionEapPhase1Param( TlsVersion in_tlsVersion) override; + ::ndk::ScopedAStatus disableEht() override; + ::ndk::ScopedAStatus setVendorData( + const std::vector<common::OuiKeyedData>& in_vendorData) override; private: // Corresponding worker functions for the AIDL methods. @@ -310,6 +313,9 @@ private: ndk::ScopedAStatus setRoamingConsortiumSelectionInternal( const std::vector<uint8_t>& selectedRcoi); ndk::ScopedAStatus setMinimumTlsVersionEapPhase1ParamInternal(TlsVersion tlsVersion); + ndk::ScopedAStatus disableEhtInternal(); + ndk::ScopedAStatus setVendorDataInternal( + const std::vector<common::OuiKeyedData>& vendorData); struct wpa_ssid* retrieveNetworkPtr(); struct wpa_supplicant* retrieveIfacePtr(); diff --git a/wpa_supplicant/android.config b/wpa_supplicant/android.config index bfdd53e5..4cc38084 100644 --- a/wpa_supplicant/android.config +++ b/wpa_supplicant/android.config @@ -541,6 +541,9 @@ CONFIG_DPP2=y # WPA3-Personal (SAE) CONFIG_SAE=y +# PASN +CONFIG_PASN=y + # WPA3-Enterprise (SuiteB-192) CONFIG_SUITEB=y CONFIG_SUITEB192=y diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index 9a2598bd..62d2e901 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -856,9 +856,9 @@ static void ap_wps_event_cb(void *ctx, enum wps_event event, static void ap_sta_authorized_cb(void *ctx, const u8 *mac_addr, - int authorized, const u8 *p2p_dev_addr) + int authorized, const u8 *p2p_dev_addr, const u8 *ip) { - wpas_notify_sta_authorized(ctx, mac_addr, authorized, p2p_dev_addr); + wpas_notify_sta_authorized(ctx, mac_addr, authorized, p2p_dev_addr, ip); } diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index b09d51d4..eefae53a 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -5830,6 +5830,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, notify_bss_changes( wpa_s, WPA_BSS_FREQ_CHANGED_FLAG, wpa_s->links[data->ch_switch.link_id].bss); + if (data->ch_switch.freq) + wpas_notify_frequency_changed(wpa_s, data->ch_switch.freq); } break; case EVENT_CH_SWITCH_STARTED: diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c index c6e2dbe2..a20f1c08 100644 --- a/wpa_supplicant/notify.c +++ b/wpa_supplicant/notify.c @@ -793,6 +793,10 @@ void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s, * @status: Valid only in case of response (0 in case of success) * @config_methods: WPS config methods * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method + * @group_ifname: Group interface name of the group owner in case the provision + * discovery request is received with P2P Group ID attribute. + * i.e., valid only when the peer device is joining an + * operating P2P group. * * This can be used to notify: * - Requests or responses @@ -803,7 +807,8 @@ void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s, const u8 *dev_addr, int request, enum p2p_prov_disc_status status, u16 config_methods, - unsigned int generated_pin) + unsigned int generated_pin, + const char *group_ifname) { wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request, status, config_methods, @@ -811,7 +816,7 @@ void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s, wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request, status, config_methods, - generated_pin); + generated_pin, group_ifname); } @@ -863,7 +868,7 @@ void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s, static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, const u8 *sta, - const u8 *p2p_dev_addr) + const u8 *p2p_dev_addr, const u8 *ip) { #ifdef CONFIG_P2P wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr); @@ -882,7 +887,7 @@ static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, /* Notify listeners a new station has been authorized */ wpas_dbus_signal_sta_authorized(wpa_s, sta); - wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr); + wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr, ip); } @@ -902,7 +907,7 @@ static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s, /* Notify listeners a station has been deauthorized */ wpas_dbus_signal_sta_deauthorized(wpa_s, sta); - wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr); + wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr); /* Unregister the station */ wpas_dbus_unregister_sta(wpa_s, sta); } @@ -910,10 +915,10 @@ static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s, void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s, const u8 *mac_addr, int authorized, - const u8 *p2p_dev_addr) + const u8 *p2p_dev_addr, const u8 *ip) { if (authorized) - wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr); + wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr, ip); else wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr); } diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h index c41aa6e1..260f439a 100644 --- a/wpa_supplicant/notify.h +++ b/wpa_supplicant/notify.h @@ -100,7 +100,7 @@ void wpas_notify_resume(struct wpa_global *global); void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s, const u8 *mac_addr, int authorized, - const u8 *p2p_dev_addr); + const u8 *p2p_dev_addr, const u8 *ip); void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s); void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s, const u8 *addr, const struct p2p_peer_info *info, @@ -129,7 +129,8 @@ void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s, const u8 *dev_addr, int request, enum p2p_prov_disc_status status, u16 config_methods, - unsigned int generated_pin); + unsigned int generated_pin, + const char *group_ifname); void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, int persistent, int client, const u8 *ip); diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 09c11e06..db991779 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -2666,6 +2666,7 @@ done: wfd_dev_info_len, wfd_r2_dev_info, wfd_r2_dev_info_len, new_device); os_free(wfd_dev_info); + os_free(wfd_r2_dev_info); } @@ -2904,7 +2905,7 @@ static void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods, wpa_printf(MSG_DEBUG, "P2P: Could not generate PIN"); wpas_notify_p2p_provision_discovery( wpa_s, peer, 0 /* response */, - P2P_PROV_DISC_INFO_UNAVAILABLE, 0, 0); + P2P_PROV_DISC_INFO_UNAVAILABLE, 0, 0, NULL); return; } wpas_prov_disc_local_display(wpa_s, peer, params, @@ -2917,7 +2918,8 @@ static void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods, wpas_notify_p2p_provision_discovery(wpa_s, peer, 1 /* request */, P2P_PROV_DISC_SUCCESS, - config_methods, generated_pin); + config_methods, generated_pin, + group ? group->ifname : NULL); } @@ -2955,7 +2957,7 @@ static void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods) wpa_printf(MSG_DEBUG, "P2P: Could not generate PIN"); wpas_notify_p2p_provision_discovery( wpa_s, peer, 0 /* response */, - P2P_PROV_DISC_INFO_UNAVAILABLE, 0, 0); + P2P_PROV_DISC_INFO_UNAVAILABLE, 0, 0, NULL); return; } wpas_prov_disc_local_display(wpa_s, peer, params, @@ -2966,7 +2968,8 @@ static void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods) wpas_notify_p2p_provision_discovery(wpa_s, peer, 0 /* response */, P2P_PROV_DISC_SUCCESS, - config_methods, generated_pin); + config_methods, generated_pin, + NULL); } @@ -3013,7 +3016,7 @@ static void wpas_prov_disc_fail(void *ctx, const u8 *peer, } wpas_notify_p2p_provision_discovery(wpa_s, peer, 0 /* response */, - status, 0, 0); + status, 0, 0, NULL); } diff --git a/wpa_supplicant/wpa_supplicant/Android.bp b/wpa_supplicant/wpa_supplicant/Android.bp new file mode 100644 index 00000000..b70e5b92 --- /dev/null +++ b/wpa_supplicant/wpa_supplicant/Android.bp @@ -0,0 +1,52 @@ +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +soong_namespace { + +} + +package { + default_applicable_licenses: [ + // Inherits SPDX-license-identifier-BSD-3-Clause + "external_wpa_supplicant_8_license", + ], +} + +soong_config_module_type_import { + from: "frameworks/opt/net/wifi/libwifi_hal/Android.bp", + module_types: ["wifi_cc_defaults"], +} + +wifi_cc_defaults { + name: "lib_vendor_wpa_supplicant", + soong_config_variables: { + board_wlan_device: { + emulator: { + static_libs: ["lib_driver_cmd_simulated_cf_bp"], + }, + // TODO(b/295186835): Convert lib_driver_cmd_* to soong + conditions_default: { + static_libs: ["lib_driver_cmd_fallback"], + }, + } + } +} + +cc_binary { + name: "wpa_supplicant", + defaults: [ + "wpa_supplicant_defaults", + "lib_vendor_wpa_supplicant", + ], +} diff --git a/wpa_supplicant/wpa_supplicant/libdrivercmdfallback/Android.bp b/wpa_supplicant/wpa_supplicant/libdrivercmdfallback/Android.bp new file mode 100644 index 00000000..3fe900b2 --- /dev/null +++ b/wpa_supplicant/wpa_supplicant/libdrivercmdfallback/Android.bp @@ -0,0 +1,32 @@ +// +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library_static { + name: "lib_driver_cmd_fallback", + srcs: ["driver_cmd_nl80211.c"], + header_libs: [ + "wpa_supplicant_headers", + ], + cflags: [ + "-Werror", + "-Wno-unused-parameter", + "-Wno-macro-redefined", + ], + soc_specific: true, +}
\ No newline at end of file diff --git a/wpa_supplicant/wpa_supplicant/libdrivercmdfallback/driver_cmd_nl80211.c b/wpa_supplicant/wpa_supplicant/libdrivercmdfallback/driver_cmd_nl80211.c new file mode 100644 index 00000000..6cdc57a5 --- /dev/null +++ b/wpa_supplicant/wpa_supplicant/libdrivercmdfallback/driver_cmd_nl80211.c @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * Driver interaction with extended Linux CFG8021 + */ + +#include "includes.h" + +#include "common.h" + +int wpa_driver_nl80211_driver_cmd(void* priv, char* cmd, char* buf, + size_t buf_len) { + return 0; +} + +int wpa_driver_set_p2p_noa(void* priv, u8 count, int start, int duration) { + return 0; +} + +int wpa_driver_get_p2p_noa(void* priv, u8* buf, size_t len) { + return 0; +} + +int wpa_driver_set_p2p_ps(void* priv, int legacy_ps, int opp_ps, int ctwindow) { + return -1; +} + +int wpa_driver_set_ap_wps_p2p_ie(void* priv, const struct wpabuf* beacon, + const struct wpabuf* proberesp, + const struct wpabuf* assocresp) { + return 0; +} diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c index bba77773..0047531a 100644 --- a/wpa_supplicant/wpas_glue.c +++ b/wpa_supplicant/wpas_glue.c @@ -380,6 +380,12 @@ static void wpa_supplicant_eapol_cb(struct eapol_sm *eapol, wpa_printf(MSG_DEBUG, "Failed to set PMK to the driver"); } + if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X) { + /* Add PMKSA cache entry */ + wpa_printf(MSG_INFO, "add pmksa entry for the PMK"); + wpa_sm_set_pmk(wpa_s->wpa, pmk, pmk_len, NULL, wpa_sm_get_auth_addr(wpa_s->wpa)); + } + wpa_supplicant_cancel_scan(wpa_s); wpa_supplicant_cancel_auth_timeout(wpa_s); wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); |