From d39345f0abc309959d831d09fcbf1619cc0ae0f5 Mon Sep 17 00:00:00 2001 From: SaidiReddy Yenuga Date: Thu, 26 May 2016 15:07:50 +0530 Subject: wlan: Remove the support for setwpaie ioctl This ioctl gets call during the start of SAP/hostapd with wext interface and which is obsolete, currently using nl80211 interface for the same Remove the code related to setwpaie ioctl CRs-Fixed: 1000913 Change-Id: I8b00db1753d8f72192e4cdb88bc7c638007180fe --- CORE/HDD/inc/qc_sap_ioctl.h | 4 +- CORE/HDD/src/wlan_hdd_hostapd.c | 414 ---------------------------------------- 2 files changed, 2 insertions(+), 416 deletions(-) diff --git a/CORE/HDD/inc/qc_sap_ioctl.h b/CORE/HDD/inc/qc_sap_ioctl.h index dfa7d1c..2bc3b6a 100644 --- a/CORE/HDD/inc/qc_sap_ioctl.h +++ b/CORE/HDD/inc/qc_sap_ioctl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -143,7 +143,7 @@ typedef struct #define QCSAP_IOCTL_COMMIT (SIOCIWFIRSTPRIV+2) #define QCSAP_IOCTL_GET_STAWPAIE (SIOCIWFIRSTPRIV+4) -#define QCSAP_IOCTL_SETWPAIE (SIOCIWFIRSTPRIV+5) + #define QCSAP_IOCTL_STOPBSS (SIOCIWFIRSTPRIV+6) #define QCSAP_IOCTL_VERSION (SIOCIWFIRSTPRIV+7) #define QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES (SIOCIWFIRSTPRIV+8) diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c index 03889a4..752a34c 100644 --- a/CORE/HDD/src/wlan_hdd_hostapd.c +++ b/CORE/HDD/src/wlan_hdd_hostapd.c @@ -3862,417 +3862,6 @@ static int iw_get_mode(struct net_device *dev, return ret; } -static int __iw_softap_setwpsie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - hdd_adapter_t *pHostapdAdapter; - hdd_context_t *pHddCtx; - v_CONTEXT_t pVosContext; - hdd_hostapd_state_t *pHostapdState; - eHalStatus halStatus= eHAL_STATUS_SUCCESS; - u_int8_t *wps_genie; - u_int8_t *fwps_genie; - u_int8_t *pos; - tpSap_WPSIE pSap_WPSIe; - u_int8_t WPSIeType; - u_int16_t length; - struct iw_point s_priv_data; - int ret = 0; - - ENTER(); - - if (!capable(CAP_NET_ADMIN)) - { - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - FL("permission check failed")); - return -EPERM; - } - - pHostapdAdapter = (netdev_priv(dev)); - if (NULL == pHostapdAdapter) - { - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: Adapter is NULL",__func__); - return -EINVAL; - } - pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); - ret = wlan_hdd_validate_context(pHddCtx); - if (0 != ret) - { - return ret; - } - pVosContext = pHddCtx->pvosContext; - if (NULL == pVosContext) - { - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: HDD context is not valid ",__func__); - return -EINVAL; - } - /* helper function to get iwreq_data with compat handling. */ - if (hdd_priv_get_data(&s_priv_data, wrqu)) - { - return -EINVAL; - } - - if ((NULL == s_priv_data.pointer) || (s_priv_data.length < QCSAP_MAX_WSC_IE)) - { - return -EINVAL; - } - - wps_genie = mem_alloc_copy_from_user_helper(s_priv_data.pointer, - s_priv_data.length); - - if(NULL == wps_genie) - { - hddLog(LOG1, "%s: failed to alloc memory " - "and copy data from user buffer", __func__); - return -EFAULT; - } - - fwps_genie = wps_genie; - - pSap_WPSIe = vos_mem_malloc(sizeof(tSap_WPSIE)); - if (NULL == pSap_WPSIe) - { - hddLog(LOGE, "VOS unable to allocate memory"); - kfree(fwps_genie); - return -ENOMEM; - } - vos_mem_zero(pSap_WPSIe, sizeof(tSap_WPSIE)); - - hddLog(LOG1,"%s WPS IE type[0x%X] IE[0x%X], LEN[%d]", __func__, wps_genie[0], wps_genie[1], wps_genie[2]); - WPSIeType = wps_genie[0]; - if ( wps_genie[0] == eQC_WPS_BEACON_IE) - { - pSap_WPSIe->sapWPSIECode = eSAP_WPS_BEACON_IE; - wps_genie = wps_genie + 1; - switch ( wps_genie[0] ) - { - case DOT11F_EID_WPA: - if (wps_genie[1] < 2 + 4) - { - ret = -EINVAL; - goto exit; - } - else if (memcmp(&wps_genie[2], "\x00\x50\xf2\x04", 4) == 0) - { - hddLog (LOG1, "%s Set WPS BEACON IE(len %d)",__func__, wps_genie[1]+2); - pos = &wps_genie[6]; - while (((size_t)pos - (size_t)&wps_genie[6]) < (wps_genie[1] - 4) ) - { - switch((u_int16_t)(*pos<<8) | *(pos+1)) - { - case HDD_WPS_ELEM_VERSION: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.Version = *pos; - hddLog(LOG1, "WPS version %d", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.Version); - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_VER_PRESENT; - pos += 1; - break; - - case HDD_WPS_ELEM_WPS_STATE: - pos +=4; - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.wpsState = *pos; - hddLog(LOG1, "WPS State %d", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.wpsState); - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_STATE_PRESENT; - pos += 1; - break; - case HDD_WPS_ELEM_APSETUPLOCK: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.APSetupLocked = *pos; - hddLog(LOG1, "AP setup lock %d", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.APSetupLocked); - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_APSETUPLOCK_PRESENT; - pos += 1; - break; - case HDD_WPS_ELEM_SELECTEDREGISTRA: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistra = *pos; - hddLog(LOG1, "Selected Registra %d", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistra); - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_SELECTEDREGISTRA_PRESENT; - pos += 1; - break; - case HDD_WPS_ELEM_DEVICE_PASSWORD_ID: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.DevicePasswordID = (*pos<<8) | *(pos+1); - hddLog(LOG1, "Password ID: %x", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.DevicePasswordID); - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_DEVICEPASSWORDID_PRESENT; - pos += 2; - break; - case HDD_WPS_ELEM_REGISTRA_CONF_METHODS: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistraCfgMethod = (*pos<<8) | *(pos+1); - hddLog(LOG1, "Select Registra Config Methods: %x", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.SelectedRegistraCfgMethod); - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT; - pos += 2; - break; - - case HDD_WPS_ELEM_UUID_E: - pos += 2; - length = *pos<<8 | *(pos+1); - pos += 2; - if (length > sizeof(pSap_WPSIe->sapwpsie.sapWPSBeaconIE.UUID_E)) - { - ret = -EINVAL; - goto exit; - } - vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSBeaconIE.UUID_E, pos, length); - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_UUIDE_PRESENT; - pos += length; - break; - case HDD_WPS_ELEM_RF_BANDS: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.RFBand = *pos; - hddLog(LOG1, "RF band: %d", pSap_WPSIe->sapwpsie.sapWPSBeaconIE.RFBand); - pSap_WPSIe->sapwpsie.sapWPSBeaconIE.FieldPresent |= WPS_BEACON_RF_BANDS_PRESENT; - pos += 1; - break; - - default: - hddLog (LOGW, "UNKNOWN TLV in WPS IE(%x)", (*pos<<8 | *(pos+1))); - ret = -EINVAL; - goto exit; - } - } - } - else { - hddLog (LOGE, "%s WPS IE Mismatch %X", - __func__, wps_genie[0]); - } - break; - - default: - hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, wps_genie[0]); - ret = -EINVAL; - goto exit; - } - } - else if( wps_genie[0] == eQC_WPS_PROBE_RSP_IE) - { - pSap_WPSIe->sapWPSIECode = eSAP_WPS_PROBE_RSP_IE; - wps_genie = wps_genie + 1; - switch ( wps_genie[0] ) - { - case DOT11F_EID_WPA: - if (wps_genie[1] < 2 + 4) - { - ret = -EINVAL; - goto exit; - } - else if (memcmp(&wps_genie[2], "\x00\x50\xf2\x04", 4) == 0) - { - hddLog (LOG1, "%s Set WPS PROBE RSP IE(len %d)",__func__, wps_genie[1]+2); - pos = &wps_genie[6]; - while (((size_t)pos - (size_t)&wps_genie[6]) < (wps_genie[1] - 4) ) - { - switch((u_int16_t)(*pos<<8) | *(pos+1)) - { - case HDD_WPS_ELEM_VERSION: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Version = *pos; - hddLog(LOG1, "WPS version %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Version); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_VER_PRESENT; - pos += 1; - break; - - case HDD_WPS_ELEM_WPS_STATE: - pos +=4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.wpsState = *pos; - hddLog(LOG1, "WPS State %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.wpsState); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_STATE_PRESENT; - pos += 1; - break; - case HDD_WPS_ELEM_APSETUPLOCK: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.APSetupLocked = *pos; - hddLog(LOG1, "AP setup lock %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.APSetupLocked); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_APSETUPLOCK_PRESENT; - pos += 1; - break; - case HDD_WPS_ELEM_SELECTEDREGISTRA: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistra = *pos; - hddLog(LOG1, "Selected Registra %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistra); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SELECTEDREGISTRA_PRESENT; - pos += 1; - break; - case HDD_WPS_ELEM_DEVICE_PASSWORD_ID: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DevicePasswordID = (*pos<<8) | *(pos+1); - hddLog(LOG1, "Password ID: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DevicePasswordID); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_DEVICEPASSWORDID_PRESENT; - pos += 2; - break; - case HDD_WPS_ELEM_REGISTRA_CONF_METHODS: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod = (*pos<<8) | *(pos+1); - hddLog(LOG1, "Select Registra Config Methods: %x", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT; - pos += 2; - break; - case HDD_WPS_ELEM_RSP_TYPE: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ResponseType = *pos; - hddLog(LOG1, "Config Methods: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ResponseType); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_RESPONSETYPE_PRESENT; - pos += 1; - break; - case HDD_WPS_ELEM_UUID_E: - pos += 2; - length = *pos<<8 | *(pos+1); - pos += 2; - if (length > (sizeof(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.UUID_E))) - { - ret = -EINVAL; - goto exit; - } - vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.UUID_E, pos, length); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_UUIDE_PRESENT; - pos += length; - break; - - case HDD_WPS_ELEM_MANUFACTURER: - pos += 2; - length = *pos<<8 | *(pos+1); - pos += 2; - if (length > (sizeof(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Manufacture.name))) - { - ret = -EINVAL; - goto exit; - } - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Manufacture.num_name = length; - vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.Manufacture.name, pos, length); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MANUFACTURE_PRESENT; - pos += length; - break; - - case HDD_WPS_ELEM_MODEL_NAME: - pos += 2; - length = *pos<<8 | *(pos+1); - pos += 2; - if (length > (sizeof(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelName.text))) - { - ret = -EINVAL; - goto exit; - } - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelName.num_text = length; - vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelName.text, pos, length); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MODELNAME_PRESENT; - pos += length; - break; - case HDD_WPS_ELEM_MODEL_NUM: - pos += 2; - length = *pos<<8 | *(pos+1); - pos += 2; - if (length > (sizeof(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelNumber.text))) - { - ret = -EINVAL; - goto exit; - } - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelNumber.num_text = length; - vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ModelNumber.text, pos, length); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_MODELNUMBER_PRESENT; - pos += length; - break; - case HDD_WPS_ELEM_SERIAL_NUM: - pos += 2; - length = *pos<<8 | *(pos+1); - pos += 2; - if (length > (sizeof(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SerialNumber.text))) - { - ret = -EINVAL; - goto exit; - } - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SerialNumber.num_text = length; - vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SerialNumber.text, pos, length); - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_SERIALNUMBER_PRESENT; - pos += length; - break; - case HDD_WPS_ELEM_PRIMARY_DEVICE_TYPE: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceCategory = (*pos<<8 | *(pos+1)); - hddLog(LOG1, "primary dev category: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceCategory); - pos += 2; - - vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.PrimaryDeviceOUI, pos, HDD_WPS_DEVICE_OUI_LEN); - hddLog(LOG1, "primary dev oui: %02x, %02x, %02x, %02x", pos[0], pos[1], pos[2], pos[3]); - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceSubCategory = (*pos<<8 | *(pos+1)); - hddLog(LOG1, "primary dev sub category: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceSubCategory); - pos += 2; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT; - break; - case HDD_WPS_ELEM_DEVICE_NAME: - pos += 2; - length = *pos<<8 | *(pos+1); - pos += 2; - if (length > (sizeof(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceName.text))) - { - ret = -EINVAL; - goto exit; - } - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceName.num_text = length; - vos_mem_copy(pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.DeviceName.text, pos, length); - pos += length; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_DEVICENAME_PRESENT; - break; - case HDD_WPS_ELEM_CONFIG_METHODS: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.ConfigMethod = (*pos<<8) | *(pos+1); - hddLog(LOG1, "Config Methods: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.SelectedRegistraCfgMethod); - pos += 2; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_CONFIGMETHODS_PRESENT; - break; - - case HDD_WPS_ELEM_RF_BANDS: - pos += 4; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.RFBand = *pos; - hddLog(LOG1, "RF band: %d", pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.RFBand); - pos += 1; - pSap_WPSIe->sapwpsie.sapWPSProbeRspIE.FieldPresent |= WPS_PROBRSP_RF_BANDS_PRESENT; - break; - } // switch - } - } - else - { - hddLog (LOGE, "%s WPS IE Mismatch %X",__func__, wps_genie[0]); - } - - } // switch - } - halStatus = WLANSAP_Set_WpsIe(pVosContext, pSap_WPSIe); - if (halStatus != eHAL_STATUS_SUCCESS) - ret = -EINVAL; - pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); - if( pHostapdState->bCommit && WPSIeType == eQC_WPS_PROBE_RSP_IE) - { - //hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); - //v_CONTEXT_t pVosContext = pHostapdAdapter->pvosContext; - WLANSAP_Update_WpsIe ( pVosContext ); - } - -exit: - vos_mem_free(pSap_WPSIe); - kfree(fwps_genie); - EXIT(); - return ret; -} - -static int iw_softap_setwpsie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - int ret; - - vos_ssr_protect(__func__); - ret = __iw_softap_setwpsie(dev, info, wrqu, extra); - vos_ssr_unprotect(__func__); - - return ret; -} static int __iw_softap_stopbss(struct net_device *dev, struct iw_request_info *info, @@ -4845,8 +4434,6 @@ static const struct iw_priv_args hostapd_private_args[] = { IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setAclMode" }, { QCSAP_IOCTL_GET_STAWPAIE, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "get_staWPAIE" }, - { QCSAP_IOCTL_SETWPAIE, - IW_PRIV_TYPE_BYTE | QCSAP_MAX_WSC_IE | IW_PRIV_SIZE_FIXED, 0, "setwpaie" }, { QCSAP_IOCTL_STOPBSS, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED, 0, "stopbss" }, { QCSAP_IOCTL_VERSION, 0, @@ -4945,7 +4532,6 @@ static const iw_handler hostapd_private[] = { [QCSAP_IOCTL_SETPARAM - SIOCIWFIRSTPRIV] = iw_softap_setparam, //set priv ioctl [QCSAP_IOCTL_GETPARAM - SIOCIWFIRSTPRIV] = iw_softap_getparam, //get priv ioctl [QCSAP_IOCTL_GET_STAWPAIE - SIOCIWFIRSTPRIV] = iw_get_genie, //get station genIE - [QCSAP_IOCTL_SETWPAIE - SIOCIWFIRSTPRIV] = iw_softap_setwpsie, [QCSAP_IOCTL_STOPBSS - SIOCIWFIRSTPRIV] = iw_softap_stopbss, // stop bss [QCSAP_IOCTL_VERSION - SIOCIWFIRSTPRIV] = iw_softap_version, // get driver version [QCSAP_IOCTL_GET_WPS_PBC_PROBE_REQ_IES - SIOCIWFIRSTPRIV] = iw_get_WPSPBCProbeReqIEs, -- cgit v1.1