|
@@ -5600,257 +5600,6 @@ int iw_get_essid(struct net_device *dev,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static enum nl80211_wpa_versions iw2nl_wpa_version(int iw_value)
|
|
|
-{
|
|
|
- enum nl80211_wpa_versions nl_value = 0;
|
|
|
-
|
|
|
- if (iw_value & IW_AUTH_WPA_VERSION_WPA)
|
|
|
- nl_value |= NL80211_WPA_VERSION_1;
|
|
|
- if (iw_value & IW_AUTH_WPA_VERSION_WPA2)
|
|
|
- nl_value |= NL80211_WPA_VERSION_2;
|
|
|
-
|
|
|
- return nl_value;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * __iw_set_auth() -
|
|
|
- * This function sets the auth type received from the wpa_supplicant
|
|
|
- * @dev: pointer to the net device
|
|
|
- * @info: pointer to the iw request info
|
|
|
- * @wrqu: pointer to iwreq_data
|
|
|
- * @extra: pointer to the data
|
|
|
- *
|
|
|
- * Return: 0 on success, error number otherwise
|
|
|
- */
|
|
|
-static int __iw_set_auth(struct net_device *dev, struct iw_request_info *info,
|
|
|
- union iwreq_data *wrqu, char *extra)
|
|
|
-{
|
|
|
- struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
|
|
- struct hdd_context *hdd_ctx;
|
|
|
- struct hdd_wext_state *pWextState =
|
|
|
- WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
|
|
|
- struct hdd_station_ctx *sta_ctx =
|
|
|
- WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
|
|
- tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
|
|
|
- eCsrEncryptionType mcEncryptionType;
|
|
|
- eCsrEncryptionType ucEncryptionType;
|
|
|
- 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;
|
|
|
-
|
|
|
- switch (wrqu->param.flags & IW_AUTH_INDEX) {
|
|
|
- case IW_AUTH_WPA_VERSION:
|
|
|
- sta_ctx->wpa_versions = iw2nl_wpa_version(wrqu->param.value);
|
|
|
- break;
|
|
|
-
|
|
|
- case IW_AUTH_CIPHER_PAIRWISE:
|
|
|
- {
|
|
|
- if (wrqu->param.value & IW_AUTH_CIPHER_NONE) {
|
|
|
- ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
|
|
|
- } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) {
|
|
|
- ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP;
|
|
|
- } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) {
|
|
|
- ucEncryptionType = eCSR_ENCRYPT_TYPE_AES;
|
|
|
- } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) {
|
|
|
- if ((IW_AUTH_KEY_MGMT_802_1X
|
|
|
- ==
|
|
|
- (pWextState->
|
|
|
- authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X))
|
|
|
- && (eCSR_AUTH_TYPE_OPEN_SYSTEM ==
|
|
|
- sta_ctx->conn_info.authType))
|
|
|
- /*Dynamic WEP key */
|
|
|
- ucEncryptionType =
|
|
|
- eCSR_ENCRYPT_TYPE_WEP40;
|
|
|
- else
|
|
|
- /*Static WEP key */
|
|
|
- ucEncryptionType =
|
|
|
- eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
|
|
|
- } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) {
|
|
|
- if ((IW_AUTH_KEY_MGMT_802_1X
|
|
|
- ==
|
|
|
- (pWextState->
|
|
|
- authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X))
|
|
|
- && (eCSR_AUTH_TYPE_OPEN_SYSTEM ==
|
|
|
- sta_ctx->conn_info.authType))
|
|
|
- /*Dynamic WEP key */
|
|
|
- ucEncryptionType =
|
|
|
- eCSR_ENCRYPT_TYPE_WEP104;
|
|
|
- else
|
|
|
- /*Static WEP key */
|
|
|
- ucEncryptionType =
|
|
|
- eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
|
|
|
- } else {
|
|
|
- hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER",
|
|
|
- wrqu->param.value);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- pRoamProfile->EncryptionType.numEntries = 1;
|
|
|
- pRoamProfile->EncryptionType.encryptionType[0] =
|
|
|
- ucEncryptionType;
|
|
|
- }
|
|
|
- break;
|
|
|
- case IW_AUTH_CIPHER_GROUP:
|
|
|
- {
|
|
|
- if (wrqu->param.value & IW_AUTH_CIPHER_NONE) {
|
|
|
- mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
|
|
|
- } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) {
|
|
|
- mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP;
|
|
|
- } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) {
|
|
|
- mcEncryptionType = eCSR_ENCRYPT_TYPE_AES;
|
|
|
- } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) {
|
|
|
- if ((IW_AUTH_KEY_MGMT_802_1X
|
|
|
- ==
|
|
|
- (pWextState->
|
|
|
- authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X))
|
|
|
- && (eCSR_AUTH_TYPE_OPEN_SYSTEM ==
|
|
|
- sta_ctx->conn_info.authType))
|
|
|
- mcEncryptionType =
|
|
|
- eCSR_ENCRYPT_TYPE_WEP40;
|
|
|
- else
|
|
|
- mcEncryptionType =
|
|
|
- eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
|
|
|
- } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) {
|
|
|
- /* Dynamic WEP keys won't work with shared keys */
|
|
|
- if ((IW_AUTH_KEY_MGMT_802_1X
|
|
|
- ==
|
|
|
- (pWextState->
|
|
|
- authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X))
|
|
|
- && (eCSR_AUTH_TYPE_OPEN_SYSTEM ==
|
|
|
- sta_ctx->conn_info.authType)) {
|
|
|
- mcEncryptionType =
|
|
|
- eCSR_ENCRYPT_TYPE_WEP104;
|
|
|
- } else {
|
|
|
- mcEncryptionType =
|
|
|
- eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
|
|
|
- }
|
|
|
- } else {
|
|
|
- hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER",
|
|
|
- wrqu->param.value);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- pRoamProfile->mcEncryptionType.numEntries = 1;
|
|
|
- pRoamProfile->mcEncryptionType.encryptionType[0] =
|
|
|
- mcEncryptionType;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case IW_AUTH_80211_AUTH_ALG:
|
|
|
- {
|
|
|
- /* Save the auth algo here and set auth type to SME
|
|
|
- * Roam profile in the iw_set_ap_address
|
|
|
- */
|
|
|
- if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM)
|
|
|
- sta_ctx->conn_info.authType =
|
|
|
- eCSR_AUTH_TYPE_OPEN_SYSTEM;
|
|
|
-
|
|
|
- else if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY)
|
|
|
- sta_ctx->conn_info.authType =
|
|
|
- eCSR_AUTH_TYPE_SHARED_KEY;
|
|
|
-
|
|
|
- else if (wrqu->param.value & IW_AUTH_ALG_LEAP)
|
|
|
- /*Not supported */
|
|
|
- sta_ctx->conn_info.authType =
|
|
|
- eCSR_AUTH_TYPE_OPEN_SYSTEM;
|
|
|
- pWextState->roamProfile.AuthType.authType[0] =
|
|
|
- sta_ctx->conn_info.authType;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case IW_AUTH_KEY_MGMT:
|
|
|
- {
|
|
|
-#ifdef FEATURE_WLAN_ESE
|
|
|
-#define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */
|
|
|
- /*Check for CCKM AKM type */
|
|
|
- if (wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) {
|
|
|
- hdd_debug("CCKM AKM Set %d", wrqu->param.value);
|
|
|
- /* Set the CCKM bit in authKeyMgmt */
|
|
|
- /*
|
|
|
- * Right now, this breaks all ref to authKeyMgmt because
|
|
|
- * our code doesn't realize it is a "bitfield"
|
|
|
- */
|
|
|
- pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM;
|
|
|
- } else if (wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) {
|
|
|
- /* Save the key management */
|
|
|
- pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK;
|
|
|
- } else if (!(wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) {
|
|
|
- /* Save the key management anyway */
|
|
|
- pWextState->authKeyMgmt = wrqu->param.value;
|
|
|
- } else { /* It must be IW_AUTH_KEY_MGMT_802_1X */
|
|
|
- /* Save the key management */
|
|
|
- pWextState->authKeyMgmt |=
|
|
|
- IW_AUTH_KEY_MGMT_802_1X;
|
|
|
- }
|
|
|
-#else
|
|
|
- /* Save the key management */
|
|
|
- pWextState->authKeyMgmt = wrqu->param.value;
|
|
|
-#endif /* FEATURE_WLAN_ESE */
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case IW_AUTH_TKIP_COUNTERMEASURES:
|
|
|
- {
|
|
|
- if (wrqu->param.value) {
|
|
|
- hdd_debug("Counter Measure started %d",
|
|
|
- wrqu->param.value);
|
|
|
- pWextState->mTKIPCounterMeasures =
|
|
|
- TKIP_COUNTER_MEASURE_STARTED;
|
|
|
- } else {
|
|
|
- hdd_debug("Counter Measure stopped=%d",
|
|
|
- wrqu->param.value);
|
|
|
- pWextState->mTKIPCounterMeasures =
|
|
|
- TKIP_COUNTER_MEASURE_STOPED;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case IW_AUTH_DROP_UNENCRYPTED:
|
|
|
- case IW_AUTH_WPA_ENABLED:
|
|
|
- case IW_AUTH_RX_UNENCRYPTED_EAPOL:
|
|
|
- case IW_AUTH_ROAMING_CONTROL:
|
|
|
- case IW_AUTH_PRIVACY_INVOKED:
|
|
|
-
|
|
|
- default:
|
|
|
-
|
|
|
- hdd_warn("called with unsupported auth type %d",
|
|
|
- wrqu->param.flags & IW_AUTH_INDEX);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- EXIT();
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * iw_set_auth() - set auth callback 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_auth(struct net_device *dev, struct iw_request_info *info,
|
|
|
- union iwreq_data *wrqu, char *extra)
|
|
|
-{
|
|
|
- int ret;
|
|
|
-
|
|
|
- cds_ssr_protect(__func__);
|
|
|
- ret = __iw_set_auth(dev, info, wrqu, extra);
|
|
|
- cds_ssr_unprotect(__func__);
|
|
|
-
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* __iw_set_ap_address() - set ap address
|
|
|
* @dev: pointer to the net device
|