diff options
-rw-r--r-- | hs20/client/osu_client.c | 3 | ||||
-rw-r--r-- | src/eap_peer/eap_proxy_qmi.c | 45 | ||||
-rw-r--r-- | wpa_supplicant/Android.mk | 34 | ||||
-rw-r--r-- | wpa_supplicant/bss.c | 6 | ||||
-rw-r--r-- | wpa_supplicant/events.c | 54 | ||||
-rw-r--r-- | wpa_supplicant/scan.c | 7 | ||||
-rw-r--r-- | wpa_supplicant/wpa_supplicant.c | 33 | ||||
-rw-r--r-- | wpa_supplicant/wpa_supplicant_conf.mk | 2 | ||||
-rw-r--r-- | wpa_supplicant/wpa_supplicant_template.conf | 2 |
9 files changed, 166 insertions, 20 deletions
diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c index 6e875efa..a43bd91a 100644 --- a/hs20/client/osu_client.c +++ b/hs20/client/osu_client.c @@ -2229,8 +2229,7 @@ static int cmd_osu_select(struct hs20_osu_client *ctx, const char *dir, fprintf(f, "</table></a><br><small>BSSID: %s<br>\n" "SSID: %s<br>\n", last->bssid, last->osu_ssid); - if (last->osu_nai) - fprintf(f, "NAI: %s<br>\n", last->osu_nai); + fprintf(f, "NAI: %s<br>\n", last->osu_nai); fprintf(f, "URL: %s<br>\n" "methods:%s%s<br>\n" "</small></p>\n", diff --git a/src/eap_peer/eap_proxy_qmi.c b/src/eap_peer/eap_proxy_qmi.c index 6198baa0..fc469e64 100644 --- a/src/eap_peer/eap_proxy_qmi.c +++ b/src/eap_peer/eap_proxy_qmi.c @@ -382,16 +382,16 @@ static Boolean wpa_qmi_read_card_imsi(int sim_num, wpa_uim_struct_type *wpa_uim) qmi_read_trans_req.session_information.aid_len = 0; /* For USIM*/ - if ((wpa_uim[sim_num].card_info[wpa_uim[sim_num].card_ready_idx].app_type == - UIM_APP_TYPE_USIM_V01)) { + if (wpa_uim[sim_num].card_info[wpa_uim[sim_num].card_ready_idx].app_type == + UIM_APP_TYPE_USIM_V01) { qmi_read_trans_req.file_id.path[0] = 0x00; qmi_read_trans_req.file_id.path[1] = 0x3F; qmi_read_trans_req.file_id.path[2] = 0xFF; qmi_read_trans_req.file_id.path[3] = 0x7F; } else /* For SIM*/ - if ((wpa_uim[sim_num].card_info[wpa_uim[sim_num].card_ready_idx].app_type == - UIM_APP_TYPE_SIM_V01)) { + if (wpa_uim[sim_num].card_info[wpa_uim[sim_num].card_ready_idx].app_type == + UIM_APP_TYPE_SIM_V01) { qmi_read_trans_req.file_id.path[0] = 0x00; qmi_read_trans_req.file_id.path[1] = 0x3F; qmi_read_trans_req.file_id.path[2] = 0x20; @@ -571,14 +571,14 @@ static void eap_proxy_post_init(struct eap_proxy_sm *eap_proxy) eap_proxy->proxy_state = EAP_PROXY_DISABLED; wpa_printf(MSG_ERROR, "eap_proxy: No Modem support for this target" " number of modems is %d", mdm_detect_info.num_modems); - return NULL; + return; } wpa_printf(MSG_DEBUG, "eap_proxy: num_modems = %d", mdm_detect_info.num_modems); if(eap_modem_compatible(&mdm_detect_info) == FALSE) { eap_proxy->proxy_state = EAP_PROXY_DISABLED; wpa_printf(MSG_ERROR, "eap_proxy: build does not support EAP-SIM feature"); - return NULL; + return; } #endif /* CONFIG_EAP_PROXY_MDM_DETECT */ @@ -613,7 +613,7 @@ static void eap_proxy_post_init(struct eap_proxy_sm *eap_proxy) os_memset(&eap_os_params, 0, sizeof(qmi_client_os_params)); qmiErrorCode = qmi_client_init_instance(uim_get_service_object_v01(), - QMI_CLIENT_INSTANCE_ANY, + (unsigned int)QMI_CLIENT_INSTANCE_ANY, wpa_qmi_client_indication_cb, eap_proxy, &eap_os_params, 10000, @@ -667,7 +667,7 @@ static void eap_proxy_post_init(struct eap_proxy_sm *eap_proxy) if ( flag == FALSE ) { eap_proxy->proxy_state = EAP_PROXY_DISABLED; wpa_printf(MSG_ERROR, "eap_proxy: flag = %d proxy init failed\n", flag); - return NULL; + return; } eap_proxy->proxy_state = EAP_PROXY_IDLE; @@ -677,7 +677,7 @@ static void eap_proxy_post_init(struct eap_proxy_sm *eap_proxy) eap_proxy_eapol_sm_set_bool(eap_proxy, EAPOL_eapResp, FALSE); eap_proxy_eapol_sm_set_bool(eap_proxy, EAPOL_eapNoResp, FALSE); wpa_printf (MSG_ERROR, "eap_proxy: Eap_proxy initialized successfully tid is %d \n", gettid()); - return NULL; + return; } @@ -924,6 +924,7 @@ static void handle_qmi_eap_reply( eap_proxy->qmi_state = QMI_STATE_RESP_TIME_OUT; return; } +#ifdef QMI_AUTH_EAP_REQ_PACKET_EXT_MAX_V01 if((QMI_AUTH_SEND_EAP_PACKET_REQ_V01 != msg_id) && (QMI_AUTH_SEND_EAP_PACKET_EXT_REQ_V01 != msg_id)) { @@ -931,10 +932,21 @@ static void handle_qmi_eap_reply( eap_proxy->qmi_state = QMI_STATE_RESP_TIME_OUT; return; } +#else + if(QMI_AUTH_SEND_EAP_PACKET_REQ_V01 != msg_id) + { + wpa_printf(MSG_ERROR, "eap_proxy: Invalid msgId =%d\n", msg_id); + eap_proxy->qmi_state = QMI_STATE_RESP_TIME_OUT; + return; + } +#endif /* ensure the reply packet exists */ - if (rspData->eap_response_pkt_len <= 0 || - rspData->eap_response_pkt_len > QMI_AUTH_EAP_RESP_PACKET_EXT_MAX_V01) { + if (rspData->eap_response_pkt_len <= 0 +#ifdef QMI_AUTH_EAP_REQ_PACKET_EXT_MAX_V01 + || rspData->eap_response_pkt_len > QMI_AUTH_EAP_RESP_PACKET_EXT_MAX_V01 +#endif + ) { wpa_printf(MSG_ERROR, "eap_proxy: Reply packet is of" "invalid length %d error %d result %d\n", rspData->eap_response_pkt_len, rspData->resp.error, rspData->resp.result); @@ -976,15 +988,16 @@ static enum eap_proxy_status eap_proxy_process(struct eap_proxy_sm *eap_proxy, u8 *eapReqData, int eapReqDataLen, struct eap_sm *eap_sm) { struct eap_hdr *hdr; - int qmiErrorCode; + int qmiErrorCode = 0; enum eap_proxy_status proxy_status = EAP_PROXY_SUCCESS; auth_send_eap_packet_req_msg_v01 eap_send_packet_req; auth_send_eap_packet_resp_msg_v01 eap_send_packet_resp; qmi_txn_handle async_txn_hdl = 0; +#ifdef QMI_AUTH_EAP_REQ_PACKET_EXT_MAX_V01 auth_send_eap_packet_ext_req_msg_v01 eap_send_packet_ext_req; auth_send_eap_packet_ext_resp_msg_v01 eap_send_packet_ext_resp; - +#endif hdr = (struct eap_hdr *)eapReqData; if ((EAP_CODE_REQUEST == hdr->code) && @@ -1020,11 +1033,13 @@ static enum eap_proxy_status eap_proxy_process(struct eap_proxy_sm *eap_proxy, os_memset(&eap_send_packet_resp, 0, sizeof(auth_send_eap_packet_resp_msg_v01)); eap_send_packet_req.eap_request_pkt_len = eapReqDataLen ; memcpy(eap_send_packet_req.eap_request_pkt, eapReqData, eapReqDataLen); +#ifdef QMI_AUTH_EAP_REQ_PACKET_EXT_MAX_V01 } else if (eapReqDataLen <= QMI_AUTH_EAP_REQ_PACKET_EXT_MAX_V01) { os_memset(&eap_send_packet_ext_req, 0, sizeof(auth_send_eap_packet_ext_req_msg_v01)); os_memset(&eap_send_packet_ext_resp, 0, sizeof(auth_send_eap_packet_ext_resp_msg_v01)); eap_send_packet_ext_req.eap_request_ext_pkt_len = eapReqDataLen; memcpy(eap_send_packet_ext_req.eap_request_ext_pkt, eapReqData, eapReqDataLen); +#endif } else { wpa_printf(MSG_ERROR, "eap_proxy: Error in eap_send_packet_req\n"); return EAP_PROXY_FAILURE; @@ -1050,6 +1065,7 @@ static enum eap_proxy_status eap_proxy_process(struct eap_proxy_sm *eap_proxy, sizeof(auth_send_eap_packet_resp_msg_v01), &handle_qmi_eap_reply, eap_proxy, &async_txn_hdl); +#ifdef QMI_AUTH_EAP_REQ_PACKET_EXT_MAX_V01 } else if(eapReqDataLen <= QMI_AUTH_EAP_REQ_PACKET_EXT_MAX_V01) { qmiErrorCode = qmi_client_send_msg_async( eap_proxy->qmi_auth_svc_client_ptr[eap_proxy->user_selected_sim], @@ -1060,6 +1076,7 @@ static enum eap_proxy_status eap_proxy_process(struct eap_proxy_sm *eap_proxy, sizeof(auth_send_eap_packet_ext_resp_msg_v01), &handle_qmi_eap_reply, eap_proxy, &async_txn_hdl); +#endif } if (QMI_NO_ERR != qmiErrorCode) { @@ -1427,6 +1444,8 @@ static char bin_to_hexchar(u8 ch) } return ch + 'a' - 10; } + +extern struct eap_peer_config * eap_get_config(struct eap_sm *sm) __attribute__((weak)); static Boolean eap_proxy_build_identity(struct eap_proxy_sm *eap_proxy, u8 id, struct eap_sm *eap_sm) { struct eap_hdr *resp; diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk index fa0000bb..a6410a6a 100644 --- a/wpa_supplicant/Android.mk +++ b/wpa_supplicant/Android.mk @@ -557,7 +557,11 @@ endif ifdef CONFIG_EAP_PROXY L_CFLAGS += -DCONFIG_EAP_PROXY +ifneq ($(CONFIG_EAP_PROXY),qmi) +# QMI needs proprietary headers to build :( +# Spin it into a blobbable lib OBJS += src/eap_peer/eap_proxy_$(CONFIG_EAP_PROXY).c +endif include $(LOCAL_PATH)/eap_proxy_$(CONFIG_EAP_PROXY).mk CONFIG_IEEE8021X_EAPOL=y endif @@ -1565,6 +1569,32 @@ LOCAL_SRC_FILES := $(OBJS_c) LOCAL_C_INCLUDES := $(INCLUDES) include $(BUILD_EXECUTABLE) +# This needs QMI artifacts to be built +ifneq ($(QCPATH),) + +ifeq ($(CONFIG_EAP_PROXY),qmi) +include $(CLEAR_VARS) + +LOCAL_MODULE = libwpa_qmi_eap_proxy +LOCAL_SHARED_LIBRARIES := libcutils liblog libwpa_client +LOCAL_SRC_FILES += src/eap_peer/eap_proxy_$(CONFIG_EAP_PROXY).c +LOCAL_SRC_FILES += src/utils/wpa_debug.c +LOCAL_SRC_FILES += src/utils/wpabuf.c +LOCAL_SRC_FILES += src/utils/eloop.c +LOCAL_SRC_FILES += src/utils/common.c +include $(LOCAL_PATH)/eap_proxy_$(CONFIG_EAP_PROXY).mk +LOCAL_C_INCLUDES := $(INCLUDES) +LOCAL_CFLAGS = $(L_CFLAGS) + +LOCAL_STATIC_LIBRARIES += $(LIB_STATIC_EAP_PROXY) +LOCAL_SHARED_LIBRARIES += $(LIB_SHARED_EAP_PROXY) + +include $(BUILD_SHARED_LIBRARY) + +endif # qmi EAP_PROXY +endif # QCPATH + + ######################## include $(CLEAR_VARS) LOCAL_MODULE := wpa_supplicant @@ -1577,8 +1607,12 @@ LOCAL_STATIC_LIBRARIES += $(BOARD_WPA_SUPPLICANT_PRIVATE_LIB) endif LOCAL_SHARED_LIBRARIES := libc libcutils liblog ifdef CONFIG_EAP_PROXY +ifneq ($(CONFIG_EAP_PROXY),qmi) LOCAL_STATIC_LIBRARIES += $(LIB_STATIC_EAP_PROXY) LOCAL_SHARED_LIBRARIES += $(LIB_SHARED_EAP_PROXY) +else +LOCAL_SHARED_LIBRARIES += libwpa_qmi_eap_proxy +endif endif ifeq ($(CONFIG_TLS), openssl) LOCAL_SHARED_LIBRARIES += libcrypto libssl libkeystore_binder diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 96e1a623..39a16095 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -322,6 +322,12 @@ static int wpa_bss_in_use(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) return !is_zero_ether_addr(bss->bssid) && (os_memcmp(bss->bssid, wpa_s->bssid, ETH_ALEN) == 0 || +#ifdef MTK_HARDWARE + /* if we're trying to connect this ssid, don't remove it from scan result */ + (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE) && wpa_s->current_ssid && + wpa_s->current_ssid->ssid_len > 0 && + os_strncmp(wpa_s->current_ssid->ssid, bss->ssid, wpa_s->current_ssid->ssid_len) == 0) || +#endif os_memcmp(bss->bssid, wpa_s->pending_bssid, ETH_ALEN) == 0); } diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index cfc8350d..567fbc0e 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1075,6 +1075,13 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, int only_first_ssid) { unsigned int i; +#ifdef MTK_HARDWARE + struct wpa_bss *temp_bss = NULL; + struct dl_list *list_next = NULL; + int shared_freq = 0; + int num = 0; +#endif + if (only_first_ssid) wpa_dbg(wpa_s, MSG_DEBUG, "Try to find BSS matching pre-selected network id=%d", @@ -1082,6 +1089,49 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, else wpa_dbg(wpa_s, MSG_DEBUG, "Selecting BSS from priority group %d", group->priority); +#ifdef MTK_HARDWARE + if (os_strncmp(wpa_s->ifname, "wlan", 4) == 0) + num = get_shared_radio_freqs(wpa_s, &shared_freq, 1); + /* + * for channel conflict revise feature + * if p2p/wfd is connected, search in full scan result to find the ssid. + * because framework also base on + * this result, but not last scan result. + * + * changes in function wpa_bss_in_use will asure the intended bsses + * are not removed from full scan result. + */ + if (num > 0 && shared_freq > 0) { + wpa_printf(MSG_DEBUG, "try to find a bss on freq %d", shared_freq); + temp_bss = dl_list_first(&wpa_s->bss, struct wpa_bss, list); + for (i = 0; i < wpa_s->num_bss; i++) { + list_next = temp_bss->list.next; + if (temp_bss->freq != shared_freq) { + temp_bss = dl_list_entry(list_next, struct wpa_bss, list); + continue; + } + *selected_ssid = wpa_scan_res_match(wpa_s, i, temp_bss, group, + only_first_ssid); + + if (!*selected_ssid) { + temp_bss = dl_list_entry(list_next, struct wpa_bss, list); + continue; + } + + wpa_printf(MSG_DEBUG, "on Freq %d, " + "found a BSS in previous scan res", shared_freq); + return temp_bss; + } + /* + * it is rarely that we aren't able to find this ssid in full scan result, + * unless this bss was removed just after + * framework select this bss and before send command to wpa_supplicant + */ + wpa_printf(MSG_ERROR, "didn't find BSS on freq %d, " + "try to find on other freqs", shared_freq); + } +#endif + for (i = 0; i < wpa_s->last_scan_res_used; i++) { struct wpa_bss *bss = wpa_s->last_scan_res[i]; @@ -1656,6 +1706,10 @@ static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s, wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_NOT_FOUND); +#ifdef MTK_HARDWARE + if (os_strncmp(wpa_s->ifname, "wlan", 4) == 0) + wpa_s->current_ssid = NULL; +#endif } } return 0; diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index acd3211c..03a8cc31 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -1159,6 +1159,13 @@ void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec) } +#ifdef MTK_HARDWARE +int wpa_supplicant_pending_scan(struct wpa_supplicant *wpa_s) +{ + return eloop_is_timeout_registered(wpa_supplicant_scan, wpa_s, NULL); +} +#endif + /** * wpa_supplicant_delayed_sched_scan - Request a delayed scheduled scan * @wpa_s: Pointer to wpa_supplicant data diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 7852268a..84a42b92 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2294,6 +2294,11 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) params.bssid = bss->bssid; params.freq.freq = bss->freq; } +#ifdef MTK_HARDWARE + else { + params.freq.freq = bss->freq; + } +#endif params.bssid_hint = bss->bssid; params.freq_hint = bss->freq; params.pbss = bss_is_pbss(bss); @@ -2683,6 +2688,9 @@ void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s, } } +#ifdef MTK_HARDWARE +extern int wpa_supplicant_pending_scan(struct wpa_supplicant *wpa_s); +#endif /** * wpa_supplicant_select_network - Attempt association with a network @@ -2751,10 +2759,27 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s, wpa_s->disconnected = 0; wpa_s->reassociate = 1; - +#ifdef MTK_HARDWARE + if (wpa_s->connect_without_scan || + wpa_supplicant_fast_associate(wpa_s) != 1) { + /* + * Can't connect to AP when WFD is connected. + */ + if (radio_work_pending(wpa_s, "scan") || + wpa_supplicant_pending_scan(wpa_s)) { + wpa_printf(MSG_INFO, "[channel conflict revise] there're pending" + " scan request, clear it"); + wpa_supplicant_cancel_scan(wpa_s); + /* radio_remove_works(wpa_s, "scan", 0); */ + wpa_s->scan_res_handler = NULL; + } + wpa_supplicant_req_scan(wpa_s, 0, disconnected ? 100000 : 0); + } +#else if (wpa_s->connect_without_scan || wpa_supplicant_fast_associate(wpa_s) != 1) wpa_supplicant_req_scan(wpa_s, 0, disconnected ? 100000 : 0); +#endif if (ssid) wpas_notify_network_selected(wpa_s, ssid); @@ -5403,7 +5428,11 @@ int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s, eap->identity = (u8 *) os_strdup(value); eap->identity_len = os_strlen(value); eap->pending_req_identity = 0; - if (ssid == wpa_s->current_ssid) + if (ssid == wpa_s->current_ssid +#ifndef CONFIG_EAP_PROXY + && wpa_s->wpa_state < WPA_ASSOCIATING +#endif + ) wpa_s->reassociate = 1; break; case WPA_CTRL_REQ_EAP_PASSWORD: diff --git a/wpa_supplicant/wpa_supplicant_conf.mk b/wpa_supplicant/wpa_supplicant_conf.mk index 74986ea6..8a5aca7f 100644 --- a/wpa_supplicant/wpa_supplicant_conf.mk +++ b/wpa_supplicant/wpa_supplicant_conf.mk @@ -20,7 +20,7 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/wifi include $(BUILD_SYSTEM)/base_rules.mk -WPA_SUPPLICANT_CONF_TEMPLATE := $(LOCAL_PATH)/wpa_supplicant_template.conf +WPA_SUPPLICANT_CONF_TEMPLATE ?= $(LOCAL_PATH)/wpa_supplicant_template.conf WPA_SUPPLICANT_CONF_SCRIPT := $(LOCAL_PATH)/wpa_supplicant_conf.sh $(LOCAL_BUILT_MODULE): PRIVATE_WIFI_DRIVER_SOCKET_IFACE := $(WIFI_DRIVER_SOCKET_IFACE) $(LOCAL_BUILT_MODULE): PRIVATE_WPA_SUPPLICANT_CONF_TEMPLATE := $(WPA_SUPPLICANT_CONF_TEMPLATE) diff --git a/wpa_supplicant/wpa_supplicant_template.conf b/wpa_supplicant/wpa_supplicant_template.conf index 38c6c1e5..f3f2a641 100644 --- a/wpa_supplicant/wpa_supplicant_template.conf +++ b/wpa_supplicant/wpa_supplicant_template.conf @@ -4,5 +4,3 @@ eapol_version=1 ap_scan=1 fast_reauth=1 pmf=1 -### flag to avoid creating new interface for p2p -p2p_no_group_iface=1 |