diff options
| -rw-r--r-- | core/hdd/inc/qc_sap_ioctl.h | 1 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_hostapd.c | 629 |
2 files changed, 0 insertions, 630 deletions
diff --git a/core/hdd/inc/qc_sap_ioctl.h b/core/hdd/inc/qc_sap_ioctl.h index ed8bec7dd5e4..89589e216467 100644 --- a/core/hdd/inc/qc_sap_ioctl.h +++ b/core/hdd/inc/qc_sap_ioctl.h @@ -137,7 +137,6 @@ typedef struct { #define QCSAP_IOCTL_SET_NONE_GET_THREE (SIOCIWFIRSTPRIV + 3) #define WE_GET_TSF 1 #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 d0d20dcf28cf..e0d86117639f 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -4688,630 +4688,6 @@ static int iw_get_mode(struct net_device *dev, } static int -__iw_softap_setwpsie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); -#ifndef WLAN_FEATURE_MBSSID - v_CONTEXT_t cds_ctx; -#endif - hdd_hostapd_state_t *pHostapdState; - QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; - uint8_t *wps_genie; - uint8_t *fwps_genie; - uint8_t *pos; - tpSap_WPSIE pSap_WPSIe; - uint8_t WPSIeType; - uint16_t length; - struct iw_point s_priv_data; - hdd_context_t *hdd_ctx; - int ret; - - ENTER_DEV(dev); - - if (!capable(CAP_NET_ADMIN)) { - hdd_err("permission check failed"); - return -EPERM; - } - - hdd_ctx = WLAN_HDD_GET_CTX(pHostapdAdapter); - ret = wlan_hdd_validate_context(hdd_ctx); - if (0 != ret) - return ret; - -#ifndef WLAN_FEATURE_MBSSID - cds_ctx = hdd_ctx->pcds_context; - if (NULL == cds_ctx) { - hdd_err("HDD context is not valid "); - return -EINVAL; - } -#endif - - /* 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) { - hdd_notice("failed to alloc mem and copy data"); - return -EFAULT; - } - - fwps_genie = wps_genie; - - pSap_WPSIe = qdf_mem_malloc(sizeof(tSap_WPSIE)); - if (NULL == pSap_WPSIe) { - hdd_err("QDF unable to allocate memory"); - kfree(fwps_genie); - return -ENOMEM; - } - qdf_mem_zero(pSap_WPSIe, sizeof(tSap_WPSIE)); - - hdd_notice("WPS IE type[0x%X] IE[0x%X], LEN[%d]", - 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) { - hdd_notice("Set WPS BEACON IE(len %d)", - wps_genie[1] + 2); - pos = &wps_genie[6]; - while (((size_t) pos - - (size_t) &wps_genie[6]) < - (wps_genie[1] - 4)) { - switch ((uint16_t) (*pos << 8) | - *(pos + 1)) { - case HDD_WPS_ELEM_VERSION: - pos += 4; - pSap_WPSIe->sapwpsie. - sapWPSBeaconIE.Version = - *pos; - hdd_notice("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; - hdd_notice("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; - hdd_notice("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; - hdd_notice("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); - hdd_notice("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); - hdd_notice("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; - } - qdf_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; - hdd_notice("RF band: %d", - pSap_WPSIe->sapwpsie. - sapWPSBeaconIE.RFBand); - pSap_WPSIe->sapwpsie. - sapWPSBeaconIE. - FieldPresent |= - WPS_BEACON_RF_BANDS_PRESENT; - pos += 1; - break; - - default: - hdd_warn("UNKNOWN TLV in WPS IE(%x)", - (*pos << 8 | - *(pos + 1))); - ret = -EINVAL; - goto exit; - } - } - } else { - hdd_err("WPS IE Mismatch %X", - wps_genie[0]); - } - break; - - default: - hdd_err("Set UNKNOWN IE %X", 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) { - hdd_notice("Set WPS PROBE RSP IE(len %d)", - wps_genie[1] + 2); - pos = &wps_genie[6]; - while (((size_t) pos - - (size_t) &wps_genie[6]) < - (wps_genie[1] - 4)) { - switch ((uint16_t) (*pos << 8) | - *(pos + 1)) { - case HDD_WPS_ELEM_VERSION: - pos += 4; - pSap_WPSIe->sapwpsie. - sapWPSProbeRspIE.Version = - *pos; - hdd_notice("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; - hdd_notice("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; - hdd_notice("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; - hdd_notice("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); - hdd_notice("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); - hdd_notice("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; - hdd_notice("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; - } - qdf_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; - qdf_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; - qdf_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; - qdf_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; - qdf_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)); - hdd_notice("primary dev category: %d", - pSap_WPSIe->sapwpsie. - sapWPSProbeRspIE. - PrimaryDeviceCategory); - pos += 2; - - qdf_mem_copy(pSap_WPSIe-> - sapwpsie. - sapWPSProbeRspIE. - PrimaryDeviceOUI, - pos, - HDD_WPS_DEVICE_OUI_LEN); - hdd_notice("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)); - hdd_notice("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; - qdf_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); - hdd_notice("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; - hdd_notice("RF band: %d", - pSap_WPSIe->sapwpsie. - sapWPSProbeRspIE.RFBand); - pos += 1; - pSap_WPSIe->sapwpsie. - sapWPSProbeRspIE. - FieldPresent |= - WPS_PROBRSP_RF_BANDS_PRESENT; - break; - } /* switch */ - } - } else { - hdd_err("WPS IE Mismatch %X", wps_genie[0]); - } - - } /* switch */ - } -#ifdef WLAN_FEATURE_MBSSID - qdf_ret_status = - wlansap_set_wps_ie(WLAN_HDD_GET_SAP_CTX_PTR(pHostapdAdapter), - pSap_WPSIe); -#else - qdf_ret_status = wlansap_set_wps_ie(p_cds_context, pSap_WPSIe); -#endif - if (qdf_ret_status != QDF_STATUS_SUCCESS) - ret = -EINVAL; - pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); - if (pHostapdState->bCommit && WPSIeType == eQC_WPS_PROBE_RSP_IE) { -#ifdef WLAN_FEATURE_MBSSID - wlansap_update_wps_ie(WLAN_HDD_GET_SAP_CTX_PTR(pHostapdAdapter)); -#else - wlansap_update_wps_ie(p_cds_context); -#endif - } -exit: - qdf_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; - - cds_ssr_protect(__func__); - ret = __iw_softap_setwpsie(dev, info, wrqu, extra); - cds_ssr_unprotect(__func__); - - return ret; -} - -static int __iw_softap_stopbss(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -6028,10 +5404,6 @@ static const struct iw_priv_args hostapd_private_args[] = { 0, IW_PRIV_TYPE_BYTE | DOT11F_IE_RSN_MAX_LEN, "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" }, { @@ -6203,7 +5575,6 @@ static const iw_handler hostapd_private[] = { iw_softap_get_three, /* get station genIE */ [QCSAP_IOCTL_GET_STAWPAIE - SIOCIWFIRSTPRIV] = iw_get_genie, - [QCSAP_IOCTL_SETWPAIE - SIOCIWFIRSTPRIV] = iw_softap_setwpsie, /* stop bss */ [QCSAP_IOCTL_STOPBSS - SIOCIWFIRSTPRIV] = iw_softap_stopbss, /* get driver version */ |
