modify wpa hdi of sta and p2p for single Thread

Signed-off-by: liuxiyao223 <liuxiyao223@huawei.com>
Change-Id: Icae8acd2c5baf3da70350cc4aa8ae62d95ea791c
This commit is contained in:
liuxiyao223 2024-02-22 15:35:52 +08:00
parent 05d61cc3b2
commit 871b24d2a6
8 changed files with 90 additions and 23 deletions

View File

@ -74,6 +74,15 @@
]
},
"name":"//third_party/wpa_supplicant/wpa_supplicant-2.9_standard:wpa"
},
{
"header": {
"header_base" : "//third_party/wpa_supplicant/wpa_supplicant-2.9_standard/",
"header_files": [
"src/common/wpa_ctrl.h"
]
},
"name":"//third_party/wpa_supplicant/wpa_supplicant-2.9_standard:wpa_client_vendor"
}
],
"test": []

View File

@ -112,6 +112,14 @@ wpa_client_base_include_dirs = [
"//base/startup/init/interfaces/innerkits/include/syspara",
]
wpa_client_vendor_base_include_dirs = [
"$WPA_ROOT_DIR/src",
"$WPA_ROOT_DIR/src/utils",
"$WPA_ROOT_DIR/src/drivers",
"$WPA_ROOT_DIR/wpa_supplicant",
"$WPA_ROOT_DIR/build/include",
]
wpa_client_base_cflags = [
"-UANDROID",
"-fsigned-char",
@ -176,6 +184,48 @@ ohos_shared_library("wpa_client") {
install_images = [ "system" ]
}
ohos_shared_library("wpa_client_vendor") {
sanitize = {
cfi = true
integer_overflow = true
debug = false
blocklist = "./wpa_blocklist.txt"
}
output_name = "wpa_client_vendor"
sources = wpa_client_base_sources
include_dirs = wpa_client_vendor_base_include_dirs
cflags = wpa_client_base_cflags
if ("${CONFIG_CTRL_IFACE}" == "udp") {
cflags += [ "-DCONFIG_CTRL_IFACE_UDP" ]
} else {
cflags += [ "-DCONFIG_CTRL_IFACE_UNIX" ]
}
external_deps = [ "init:libbegetutil" ]
if (wpa_supplicant_config_hilog) {
external_deps += [ "hilog:libhilog" ]
}
if ("${CONFIG_DRIVER}" == "nl80211") {
include_dirs += [ "$WPA_ROOT_DIR/libnl/include/libnl3" ]
cflags += [
"-DCONFIG_DRIVER_NL80211",
"-DCONFIG_LIBNL32",
]
} else {
cflags += [
"-DCONFIG_DRIVER_HDF",
"-DCONFIG_OHOS_P2P",
]
}
configs = [ ":wpa_warnings" ]
part_name = "wpa_supplicant"
subsystem_name = "thirdparty"
install_images = [ "chipset_base_dir" ]
}
ohos_shared_library("wpa_client_updater") {
sanitize = {
cfi = true

View File

@ -42,9 +42,11 @@
#include "wps_hostapd.h"
#include "hostapd_client.h"
#ifdef CONFIG_VENDOR_EXT
#include "wpa_supplicant_i.h"
#include "vendor_ext.h"
#endif
#if defined(CONFIG_LIBWPA_VENDOR) || defined(CONFIG_VENDOR_EXT)
#include "wpa_supplicant_i.h"
#endif
static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
struct sta_info *sta);
@ -1357,10 +1359,15 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
struct P2pStaConnectStateParam p2pStaConnectStateParam;
p2pStaConnectStateParam.state = 1;
os_memcpy(p2pStaConnectStateParam.srcAddress, sta->addr, ETH_ALEN);
os_memcpy(p2pStaConnectStateParam.p2pDeviceAddress, dev_addr, ETH_ALEN);
if (dev_addr) {
os_memcpy(p2pStaConnectStateParam.p2pDeviceAddress, dev_addr, ETH_ALEN);
} else {
wpa_printf(MSG_INFO, "dev_addr is null");
}
wpa_printf(MSG_INFO, "WPA_EVENT_STA_CONNECT_STATE 1 " MACSTR_SEC " p2p_dev_addr=" MACSTR_SEC,
MAC2STR_SEC(p2pStaConnectStateParam.srcAddress), MAC2STR_SEC(p2pStaConnectStateParam.p2pDeviceAddress));
WpaEventReport(hapd->iface->config_fname, WPA_EVENT_STA_CONNECT_STATE, (void *) &p2pStaConnectStateParam);
WpaEventReport(((struct wpa_supplicant *) hapd->msg_ctx)->ifname, WPA_EVENT_STA_CONNECT_STATE,
(void *) &p2pStaConnectStateParam);
#endif
wpa_printf(MSG_INFO, AP_STA_CONNECTED);
@ -1396,10 +1403,15 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
struct P2pStaConnectStateParam p2pStaConnectStateParam;
p2pStaConnectStateParam.state = 0;
os_memcpy(p2pStaConnectStateParam.srcAddress, sta->addr, ETH_ALEN);
os_memcpy(p2pStaConnectStateParam.p2pDeviceAddress, dev_addr, ETH_ALEN);
if (dev_addr) {
os_memcpy(p2pStaConnectStateParam.p2pDeviceAddress, dev_addr, ETH_ALEN);
} else {
wpa_printf(MSG_INFO, "dev_addr is null for sta_connect_state 0");
}
wpa_printf(MSG_INFO, "WPA_EVENT_STA_CONNECT_STATE 0 " MACSTR_SEC " p2p_dev_addr=" MACSTR_SEC,
MAC2STR_SEC(p2pStaConnectStateParam.srcAddress), MAC2STR_SEC(p2pStaConnectStateParam.p2pDeviceAddress));
WpaEventReport(hapd->iface->config_fname, WPA_EVENT_STA_CONNECT_STATE, (void *) &p2pStaConnectStateParam);
WpaEventReport(((struct wpa_supplicant *) hapd->msg_ctx)->ifname, WPA_EVENT_STA_CONNECT_STATE,
(void *) &p2pStaConnectStateParam);
#endif
wpa_printf(MSG_INFO, AP_STA_DISCONNECTED);

View File

@ -1345,7 +1345,7 @@ void eloop_run(void)
eloop_sock_table_dispatch(eloop.kqueue_events, res);
#endif /* CONFIG_ELOOP_KQUEUE */
}
wpa_printf(MSG_INFO, "eloop_terminate set eloop.terminate = 0");
eloop.terminate = 0;
out:
#ifdef CONFIG_ELOOP_SELECT
@ -1360,6 +1360,7 @@ out:
void eloop_terminate(void)
{
eloop.terminate = 1;
wpa_printf(MSG_INFO, "eloop_terminate set eloop.terminate = 1");
}

View File

@ -3003,7 +3003,7 @@ static int wpa_supplicant_ctrl_iface_scan_result(
#ifdef CONFIG_OPEN_HARMONY_PATCH
const u8 *infoEle;
#endif
wpa_printf(MSG_INFO, "enter wpa_supplicant_ctrl_iface_scan_result");
mesh = wpa_bss_get_ie(bss, WLAN_EID_MESH_ID);
p2p = wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE);
if (!p2p)

View File

@ -126,6 +126,7 @@ enum p2p_group_removal_reason {
P2P_GROUP_REMOVAL_GO_LEAVE_CHANNEL
};
#ifdef CONFIG_LIBWPA_VENDOR
enum prov_disc_type {
PROV_DISC_TYPE_SHOW_PIN,
PROV_DISC_TYPE_ENTER_PIN,
@ -133,6 +134,7 @@ enum prov_disc_type {
PROV_DISC_TYPE_PBC_RESP,
PROV_DISC_TYPE_FAILURE,
};
#endif
static void wpas_p2p_long_listen_timeout(void *eloop_ctx, void *timeout_ctx);
static struct wpa_supplicant *
@ -1459,7 +1461,11 @@ static void wpas_p2p_group_started(struct wpa_supplicant *wpa_s,
os_memcpy(p2pGroupStartedParam.groupIfName, wpa_s->ifname, WIFI_P2P_GROUP_IFNAME_LENGTH);
os_memcpy(p2pGroupStartedParam.ssid, ssid_txt, WIFI_SSID_LENGTH);
os_memcpy(p2pGroupStartedParam.psk, psk_txt, WIFI_P2P_PASSWORD_SIZE);
os_memcpy(p2pGroupStartedParam.passphrase, passphrase, WIFI_P2P_PASSWORD_SIZE);
if (passphrase) {
os_memcpy(p2pGroupStartedParam.passphrase, passphrase, WIFI_P2P_PASSWORD_SIZE);
} else {
wpa_printf(MSG_INFO, "wpas_p2p_group_started passphrase is null");
}
os_memcpy(p2pGroupStartedParam.goDeviceAddress, go_dev_addr, ETH_ALEN);
wpa_printf(MSG_INFO, "WPA_EVENT_GROUP_START ssid=%s ", p2pGroupStartedParam.ssid);
WpaEventReport(wpa_s->ifname, WPA_EVENT_GROUP_START, (void *) &p2pGroupStartedParam);

View File

@ -1514,16 +1514,7 @@ void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec)
} else {
wpa_dbg(wpa_s, MSG_INFO, "Setting scan request: %d.%06d sec",
sec, usec);
#ifdef CONFIG_LIBWPA_VENDOR
if (sec == 0 && usec == 0) {
wpa_dbg(wpa_s, MSG_INFO, "call wpa_supplicant_scan immediately");
wpa_supplicant_scan(wpa_s, NULL);
} else {
eloop_register_timeout(sec, usec, wpa_supplicant_scan, wpa_s, NULL);
}
#else
eloop_register_timeout(sec, usec, wpa_supplicant_scan, wpa_s, NULL);
#endif
}
}

View File

@ -1118,6 +1118,7 @@ void wpa_supplicant_terminate_proc(struct wpa_global *global)
#ifdef CONFIG_WPS
struct wpa_supplicant *wpa_s = global->ifaces;
while (wpa_s) {
wpa_dbg(wpa_s, MSG_INFO, "enter wpa_supplicant_terminate_proc");
struct wpa_supplicant *next = wpa_s->next;
if (wpas_wps_terminate_pending(wpa_s) == 1)
pending = 1;
@ -1129,8 +1130,10 @@ void wpa_supplicant_terminate_proc(struct wpa_global *global)
wpa_s = next;
}
#endif /* CONFIG_WPS */
if (pending)
if (pending) {
wpa_dbg(wpa_s, MSG_INFO, "wpa_supplicant_terminate_proc pending = 1");
return;
}
eloop_terminate();
}
@ -6452,12 +6455,7 @@ void radio_work_check_next(struct wpa_supplicant *wpa_s)
return;
}
eloop_cancel_timeout(radio_start_next_work, radio, NULL);
#ifdef CONFIG_LIBWPA_VENDOR
wpa_printf(MSG_INFO, "Call radio_start_next_work immediately");
radio_start_next_work(radio, NULL);
#else
eloop_register_timeout(0, 0, radio_start_next_work, radio, NULL);
#endif
}