|
@@ -5296,238 +5296,6 @@ int hdd_set_csr_auth_type(struct hdd_adapter *adapter,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * __iw_set_essid() - This function sets the ssid received from wpa_supplicant
|
|
|
- * to the CSR roam profile.
|
|
|
- *
|
|
|
- * @dev: Pointer to the net device.
|
|
|
- * @info: Pointer to the iw_request_info.
|
|
|
- * @wrqu: Pointer to the iwreq_data.
|
|
|
- * @extra: Pointer to the data.
|
|
|
- *
|
|
|
- * Return: 0 for success, error number on failure
|
|
|
- */
|
|
|
-static int __iw_set_essid(struct net_device *dev,
|
|
|
- struct iw_request_info *info,
|
|
|
- union iwreq_data *wrqu, char *extra)
|
|
|
-{
|
|
|
- uint32_t status = 0;
|
|
|
- struct hdd_wext_state *pWextState;
|
|
|
- struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
|
|
- struct hdd_context *hdd_ctx;
|
|
|
- struct hdd_station_ctx *sta_ctx;
|
|
|
- uint32_t roamId;
|
|
|
- tCsrRoamProfile *pRoamProfile;
|
|
|
- eCsrAuthType RSNAuthType;
|
|
|
- tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
|
|
|
- int ret;
|
|
|
-
|
|
|
- ENTER_DEV(dev);
|
|
|
-
|
|
|
- hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
|
|
- ret = wlan_hdd_validate_context(hdd_ctx);
|
|
|
- if (ret)
|
|
|
- return ret;
|
|
|
-
|
|
|
- ret = hdd_check_standard_wext_control(hdd_ctx, info);
|
|
|
- if (0 != ret)
|
|
|
- return ret;
|
|
|
-
|
|
|
- if (adapter->device_mode != QDF_STA_MODE &&
|
|
|
- adapter->device_mode != QDF_IBSS_MODE &&
|
|
|
- adapter->device_mode != QDF_P2P_CLIENT_MODE) {
|
|
|
- hdd_warn("device mode %s(%d) is not allowed",
|
|
|
- hdd_device_mode_to_string(adapter->device_mode),
|
|
|
- adapter->device_mode);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
|
|
- pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
|
|
|
-
|
|
|
- if (pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) {
|
|
|
- hdd_warn("Counter measure is in progress");
|
|
|
- return -EBUSY;
|
|
|
- }
|
|
|
- if (SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length)
|
|
|
- return -EINVAL;
|
|
|
-
|
|
|
- pRoamProfile = &pWextState->roamProfile;
|
|
|
- /*Try disconnecting if already in connected state*/
|
|
|
- status = wlan_hdd_try_disconnect(adapter);
|
|
|
- if (0 > status) {
|
|
|
- hdd_err("Failed to disconnect the existing connection");
|
|
|
- return -EALREADY;
|
|
|
- }
|
|
|
-
|
|
|
- /*
|
|
|
- * when cfg80211 defined, wpa_supplicant wext driver uses
|
|
|
- * zero-length, null-string ssid for force disconnection.
|
|
|
- * after disconnection (if previously connected) and cleaning ssid,
|
|
|
- * driver MUST return success.
|
|
|
- */
|
|
|
- if (0 == wrqu->essid.length)
|
|
|
- return 0;
|
|
|
-
|
|
|
- status = hdd_wmm_get_uapsd_mask(adapter,
|
|
|
- &pWextState->roamProfile.uapsd_mask);
|
|
|
- if (QDF_STATUS_SUCCESS != status)
|
|
|
- pWextState->roamProfile.uapsd_mask = 0;
|
|
|
-
|
|
|
- pWextState->roamProfile.SSIDs.numOfSSIDs = 1;
|
|
|
-
|
|
|
- pWextState->roamProfile.SSIDs.SSIDList->SSID.length =
|
|
|
- wrqu->essid.length;
|
|
|
-
|
|
|
- qdf_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId,
|
|
|
- sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId));
|
|
|
- qdf_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID.
|
|
|
- ssId), extra, wrqu->essid.length);
|
|
|
- if (sta_ctx->wpa_versions) {
|
|
|
-
|
|
|
- /* set gen ie */
|
|
|
- hdd_set_genie_to_csr(adapter, &RSNAuthType);
|
|
|
-
|
|
|
- /* set auth */
|
|
|
- hdd_set_csr_auth_type(adapter, RSNAuthType);
|
|
|
- }
|
|
|
-#ifdef FEATURE_WLAN_WAPI
|
|
|
- hdd_debug("Setting WAPI AUTH Type and Encryption Mode values");
|
|
|
- if (adapter->wapi_info.nWapiMode) {
|
|
|
- switch (adapter->wapi_info.wapiAuthMode) {
|
|
|
- case WAPI_AUTH_MODE_PSK:
|
|
|
- {
|
|
|
- hdd_debug("WAPI AUTH TYPE: PSK: %d",
|
|
|
- adapter->wapi_info.wapiAuthMode);
|
|
|
- pRoamProfile->AuthType.numEntries = 1;
|
|
|
- pRoamProfile->AuthType.authType[0] =
|
|
|
- eCSR_AUTH_TYPE_WAPI_WAI_PSK;
|
|
|
- break;
|
|
|
- }
|
|
|
- case WAPI_AUTH_MODE_CERT:
|
|
|
- {
|
|
|
- hdd_debug("WAPI AUTH TYPE: CERT: %d",
|
|
|
- adapter->wapi_info.wapiAuthMode);
|
|
|
- pRoamProfile->AuthType.numEntries = 1;
|
|
|
- pRoamProfile->AuthType.authType[0] =
|
|
|
- eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE;
|
|
|
- break;
|
|
|
- }
|
|
|
- } /* End of switch */
|
|
|
- if (adapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK ||
|
|
|
- adapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) {
|
|
|
- hdd_debug("WAPI PAIRWISE/GROUP ENCRYPTION: WPI");
|
|
|
- pRoamProfile->EncryptionType.numEntries = 1;
|
|
|
- pRoamProfile->EncryptionType.encryptionType[0] =
|
|
|
- eCSR_ENCRYPT_TYPE_WPI;
|
|
|
- pRoamProfile->mcEncryptionType.numEntries = 1;
|
|
|
- pRoamProfile->mcEncryptionType.encryptionType[0] =
|
|
|
- eCSR_ENCRYPT_TYPE_WPI;
|
|
|
- }
|
|
|
- }
|
|
|
-#endif /* FEATURE_WLAN_WAPI */
|
|
|
- /* if previous genIE is not NULL, update AssocIE */
|
|
|
- if (0 != pWextState->genIE.length) {
|
|
|
- memset(&pWextState->assocAddIE, 0,
|
|
|
- sizeof(pWextState->assocAddIE));
|
|
|
- memcpy(pWextState->assocAddIE.addIEdata,
|
|
|
- pWextState->genIE.addIEdata, pWextState->genIE.length);
|
|
|
- pWextState->assocAddIE.length = pWextState->genIE.length;
|
|
|
- pWextState->roamProfile.pAddIEAssoc =
|
|
|
- pWextState->assocAddIE.addIEdata;
|
|
|
- pWextState->roamProfile.nAddIEAssocLength =
|
|
|
- pWextState->assocAddIE.length;
|
|
|
-
|
|
|
- /* clear previous genIE after use it */
|
|
|
- memset(&pWextState->genIE, 0, sizeof(pWextState->genIE));
|
|
|
- }
|
|
|
-
|
|
|
- /*
|
|
|
- * Assumes it is not WPS Association by default, except when
|
|
|
- * pAddIEAssoc has WPS IE.
|
|
|
- */
|
|
|
- pWextState->roamProfile.bWPSAssociation = false;
|
|
|
-
|
|
|
- if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc,
|
|
|
- pWextState->roamProfile.
|
|
|
- nAddIEAssocLength))
|
|
|
- pWextState->roamProfile.bWPSAssociation = true;
|
|
|
-
|
|
|
- /* Disable auto BMPS entry by PMC until DHCP is done */
|
|
|
- sme_set_dhcp_till_power_active_flag(WLAN_HDD_GET_HAL_CTX(adapter),
|
|
|
- true);
|
|
|
-
|
|
|
- pWextState->roamProfile.csrPersona = adapter->device_mode;
|
|
|
-
|
|
|
- if (eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType) {
|
|
|
- pRoamProfile->ch_params.ch_width = 0;
|
|
|
- hdd_select_cbmode(adapter,
|
|
|
- (WLAN_HDD_GET_CTX(adapter))->config->AdHocChannel5G,
|
|
|
- &pRoamProfile->ch_params);
|
|
|
- }
|
|
|
-
|
|
|
- /*
|
|
|
- * Change conn_state to connecting before sme_roam_connect(),
|
|
|
- * because sme_roam_connect() has a direct path to call
|
|
|
- * hdd_sme_roam_callback(), which will change the conn_state
|
|
|
- * If direct path, conn_state will be accordingly changed to
|
|
|
- * NotConnected or Associated by either
|
|
|
- * hdd_association_completion_handler() or hdd_dis_connect_handler()
|
|
|
- * in sme_RoamCallback()if sme_RomConnect is to be queued,
|
|
|
- * Connecting state will remain until it is completed.
|
|
|
- *
|
|
|
- * If connection state is not changed,
|
|
|
- * connection state will remain in eConnectionState_NotConnected state.
|
|
|
- * In hdd_association_completion_handler, "hddDisconInProgress" is
|
|
|
- * set to true if conn state is eConnectionState_NotConnected.
|
|
|
- * If "hddDisconInProgress" is set to true then cfg80211 layer is not
|
|
|
- * informed of connect result indication which is an issue.
|
|
|
- */
|
|
|
- if (QDF_STA_MODE == adapter->device_mode ||
|
|
|
- QDF_P2P_CLIENT_MODE == adapter->device_mode)
|
|
|
- hdd_conn_set_connection_state(adapter,
|
|
|
- eConnectionState_Connecting);
|
|
|
-
|
|
|
- status = sme_roam_connect(hHal, adapter->sessionId,
|
|
|
- &(pWextState->roamProfile), &roamId);
|
|
|
- if ((QDF_STATUS_SUCCESS != status) &&
|
|
|
- (QDF_STA_MODE == adapter->device_mode ||
|
|
|
- QDF_P2P_CLIENT_MODE == adapter->device_mode)) {
|
|
|
- hdd_err("sme_roam_connect failed session_id: %d status %d -> NotConnected",
|
|
|
- adapter->sessionId, status);
|
|
|
- /* change back to NotAssociated */
|
|
|
- hdd_conn_set_connection_state(adapter,
|
|
|
- eConnectionState_NotConnected);
|
|
|
- }
|
|
|
- pRoamProfile->ChannelInfo.ChannelList = NULL;
|
|
|
- pRoamProfile->ChannelInfo.numOfChannels = 0;
|
|
|
-
|
|
|
- EXIT();
|
|
|
- return status;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * iw_set_essid() - set essid handler function
|
|
|
- * @dev: Pointer to the net device.
|
|
|
- * @info: Pointer to the iw_request_info.
|
|
|
- * @wrqu: Pointer to the iwreq_data.
|
|
|
- * @extra: Pointer to the data.
|
|
|
- *
|
|
|
- * Return: 0 for success, error number on failure
|
|
|
- */
|
|
|
-int iw_set_essid(struct net_device *dev,
|
|
|
- struct iw_request_info *info,
|
|
|
- union iwreq_data *wrqu, char *extra)
|
|
|
-{
|
|
|
- int ret;
|
|
|
-
|
|
|
- cds_ssr_protect(__func__);
|
|
|
- ret = __iw_set_essid(dev, info, wrqu, extra);
|
|
|
- cds_ssr_unprotect(__func__);
|
|
|
-
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* __iw_set_ap_address() - set ap address
|
|
|
* @dev: pointer to the net device
|