diff options
Diffstat (limited to 'drivers/staging/vt6655/iwctl.c')
-rw-r--r-- | drivers/staging/vt6655/iwctl.c | 134 |
1 files changed, 78 insertions, 56 deletions
diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c index ae2b87f177fb..7ce23b57e78d 100644 --- a/drivers/staging/vt6655/iwctl.c +++ b/drivers/staging/vt6655/iwctl.c @@ -33,6 +33,7 @@ #include "device.h" #include "ioctl.h" #include "iocmd.h" +#include "iwctl.h" #include "mac.h" #include "card.h" #include "hostap.h" @@ -107,7 +108,7 @@ static int iwctl_commit(struct net_device *dev, void *wrq, char *extra) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT\n"); return 0; } @@ -128,7 +129,7 @@ int iwctl_giwname(struct net_device *dev, * Wireless Handler : set scan */ -int iwctl_siwscan(struct net_device *dev, +static int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) @@ -138,11 +139,13 @@ int iwctl_siwscan(struct net_device *dev, struct iw_scan_req *req = (struct iw_scan_req *)extra; unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; PWLAN_IE_SSID pItemSSID = NULL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN \n"); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN\n"); if (pDevice->byReAssocCount > 0) { //reject scan when re-associating! //send scan event to wpa_Supplicant union iwreq_data wrqu; + PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); memset(&wrqu, 0, sizeof(wrqu)); wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); @@ -189,7 +192,7 @@ int iwctl_siwscan(struct net_device *dev, * Wireless Handler : get scan results */ -int iwctl_giwscan(struct net_device *dev, +static int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) @@ -207,7 +210,7 @@ int iwctl_giwscan(struct net_device *dev, long ldBm; char buf[MAX_WPA_IE_LEN * 2 + 30]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN\n"); if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. @@ -254,6 +257,7 @@ int iwctl_giwscan(struct net_device *dev, //2008-0409-04, <Add> by Einsn Liu { int f = (int)pBSS->uChannel - 1; + if (f < 0)f = 0; iwe.u.freq.m = frequency_list[f] * 100000; iwe.u.freq.e = 1; @@ -349,7 +353,7 @@ int iwctl_siwfreq(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ\n"); // If setting by frequency, convert to a channel if ((wrq->e == 1) && @@ -357,6 +361,7 @@ int iwctl_siwfreq(struct net_device *dev, (wrq->m <= (int) 2.487e8)) { int f = wrq->m / 100000; int c = 0; + while ((c < 14) && (f != frequency_list[c])) c++; wrq->e = 0; @@ -367,6 +372,7 @@ int iwctl_siwfreq(struct net_device *dev, rc = -EOPNOTSUPP; else { int channel = wrq->m; + if ((channel < 1) || (channel > 14)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m); rc = -EINVAL; @@ -395,7 +401,7 @@ int iwctl_giwfreq(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ\n"); #ifdef WEXT_USECHANNELS wrq->m = (int)pMgmt->uCurrChannel; @@ -403,6 +409,7 @@ int iwctl_giwfreq(struct net_device *dev, #else { int f = (int)pMgmt->uCurrChannel - 1; + if (f < 0) f = 0; wrq->m = frequency_list[f] * 100000; @@ -426,10 +433,10 @@ int iwctl_siwmode(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE\n"); if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Can't set operation mode, hostapd is running \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Can't set operation mode, hostapd is running\n"); return rc; } @@ -441,7 +448,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc\n"); break; case IW_MODE_AUTO: case IW_MODE_INFRA: @@ -451,7 +458,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure\n"); break; case IW_MODE_MASTER: @@ -465,7 +472,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = true; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point\n"); break; case IW_MODE_REPEAT: @@ -491,7 +498,7 @@ int iwctl_giwmode(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE\n"); // If not managed, assume it's ad-hoc switch (pMgmt->eConfigMode) { case WMAC_CONFIG_ESS_STA: @@ -526,7 +533,7 @@ int iwctl_giwrange(struct net_device *dev, int i, k; unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE\n"); if (wrq->pointer) { wrq->length = sizeof(struct iw_range); memset(range, 0, sizeof(struct iw_range)); @@ -633,10 +640,10 @@ int iwctl_siwap(struct net_device *dev, int rc = 0; unsigned char ZeroBSSID[WLAN_BSSID_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP\n"); if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. - printk("SIOCSIWAP(??)-->In scanning...\n"); + pr_debug("SIOCSIWAP(??)-->In scanning..\n"); } if (wrq->sa_family != ARPHRD_ETHER) rc = -EINVAL; @@ -657,6 +664,7 @@ int iwctl_siwap(struct net_device *dev, // then ignore,because you don't known which one to be connect with?? { unsigned int ii, uSameBssidNum = 0; + for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, @@ -689,7 +697,7 @@ int iwctl_giwap(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP\n"); memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); //2008-0410,<Modify> by Einsn Liu @@ -792,18 +800,18 @@ int iwctl_siwessid(struct net_device *dev, //2008-0409-05, <Add> by Einsn Liu unsigned char len; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID\n"); pDevice->fWPA_Authened = false; if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. - printk("SIOCSIWESSID(??)-->In scanning...\n"); + pr_debug("SIOCSIWESSID(??)-->In scanning..\n"); } // Check if we asked for `any' if (wrq->flags == 0) { // Just send an empty SSID list memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(pMgmt->abyDesireBSSID, 0xFF, 6); - PRINT_K("set essid to 'any' \n"); + PRINT_K("set essid to 'any'\n"); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT return 0; #endif @@ -819,7 +827,7 @@ int iwctl_siwessid(struct net_device *dev, pItemSSID->len = wrq->length - 1; } else pItemSSID->len = wrq->length; - printk("set essid to %s \n", pItemSSID->abySSID); + pr_debug("set essid to %s\n", pItemSSID->abySSID); //2008-0409-05, <Add> by Einsn Liu len = (pItemSSID->len > ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) ? pItemSSID->len : ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len; if ((pDevice->bLinkPass == true) && @@ -865,7 +873,7 @@ int iwctl_siwessid(struct net_device *dev, } } if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! - printk("SIOCSIWESSID:hidden ssid directly associate.......\n"); + pr_debug("SIOCSIWESSID:hidden ssid directly associate.......\n"); vResetCommandTimer((void *)pDevice); pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); @@ -877,7 +885,7 @@ int iwctl_siwessid(struct net_device *dev, } #endif - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s\n", pItemSSID->abySSID); } if (pDevice->flags & DEVICE_FLAGS_OPENED) @@ -899,7 +907,7 @@ int iwctl_giwessid(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID\n"); // Note : if wrq->u.data.flags != 0, we should // get the relevant SSID from the SSID list... @@ -931,7 +939,7 @@ int iwctl_siwrate(struct net_device *dev, int i; unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE\n"); if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { rc = -EINVAL; return rc; @@ -979,19 +987,19 @@ int iwctl_siwrate(struct net_device *dev, if (wrq->fixed != 0) { // Fixed mode // One rate, fixed - printk("Rate Fix\n"); + pr_debug("Rate Fix\n"); pDevice->bFixRate = true; if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) { pDevice->uConnectionRate = 3; } else { pDevice->uConnectionRate = brate; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d\n", pDevice->uConnectionRate); } } else { pDevice->bFixRate = false; pDevice->uConnectionRate = 13; - printk("auto rate:connection_rate is 13\n"); + pr_debug("auto rate:connection_rate is 13\n"); } return rc; @@ -1011,7 +1019,7 @@ int iwctl_giwrate(struct net_device *dev, //Mark the unnecessary sentences. // PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE\n"); { unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; int brate = 0; @@ -1054,10 +1062,11 @@ int iwctl_siwrts(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS\n"); { int rthr = wrq->value; + if (wrq->disabled) rthr = 2312; @@ -1081,7 +1090,7 @@ int iwctl_giwrts(struct net_device *dev, { PSDevice pDevice = (PSDevice)netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS\n"); wrq->value = pDevice->wRTSThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; @@ -1102,7 +1111,7 @@ int iwctl_siwfrag(struct net_device *dev, int rc = 0; int fthr = wrq->value; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG\n"); if (wrq->disabled) fthr = 2312; @@ -1127,7 +1136,7 @@ int iwctl_giwfrag(struct net_device *dev, { PSDevice pDevice = (PSDevice)netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG\n"); wrq->value = pDevice->wFragmentationThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; @@ -1146,7 +1155,7 @@ int iwctl_siwretry(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY\n"); if (wrq->disabled) { rc = -EINVAL; @@ -1179,7 +1188,8 @@ int iwctl_giwretry(struct net_device *dev, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY\n"); wrq->disabled = 0; // Can't be disabled // Note : by default, display the min retry number @@ -1224,7 +1234,7 @@ int iwctl_siwencode(struct net_device *dev, PSKeyTable pkeytab; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE\n"); if ((wrq->flags & IW_ENCODE_DISABLED) == 0) { //Not disable encryption @@ -1404,7 +1414,7 @@ int iwctl_siwpower(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER\n"); if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { rc = -EINVAL; @@ -1426,14 +1436,14 @@ int iwctl_siwpower(struct net_device *dev, } switch (wrq->flags & IW_POWER_MODE) { case IW_POWER_UNICAST_R: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R\n"); rc = -EINVAL; break; case IW_POWER_ALL_R: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R\n"); rc = -EINVAL; case IW_POWER_ON: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON\n"); break; default: rc = -EINVAL; @@ -1454,7 +1464,7 @@ int iwctl_giwpower(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int mode = pDevice->ePSMode; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER\n"); wrq->disabled = (mode == WMAC_POWER_CAM); if (wrq->disabled) @@ -1483,7 +1493,7 @@ int iwctl_giwsens(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); long ldBm; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS\n"); if (pDevice->bLinkPass == true) { RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm); wrq->value = ldBm; @@ -1510,7 +1520,7 @@ int iwctl_siwauth(struct net_device *dev, static int wpa_version = 0; //must be static to save the last value,einsn liu static int pairwise = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n"); switch (wrq->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: wpa_version = wrq->value; @@ -1611,17 +1621,24 @@ int iwctl_giwauth(struct net_device *dev, int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, - char *extra) + char __user *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int ret = 0; + char length; if (wrq->length) { - if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) { - ret = -EINVAL; - goto out; - } + if (wrq->length < 2) + return -EINVAL; + + ret = get_user(length, extra + 1); + if (ret) + return ret; + + if (length + 2 != wrq->length) + return -EINVAL; + if (wrq->length > MAX_WPA_IE_LEN) { ret = -ENOMEM; goto out; @@ -1644,7 +1661,7 @@ out://not completely ...not necessary in wpa_supplicant 0.5.8 int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, - char *extra) + char __user *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); @@ -1685,7 +1702,7 @@ int iwctl_siwencodeext(struct net_device *dev, u8 key_array[64]; int ret = 0; - PRINT_K("SIOCSIWENCODEEXT...... \n"); + PRINT_K("SIOCSIWENCODEEXT......\n"); param = kzalloc(sizeof(*param), GFP_KERNEL); if (param == NULL) @@ -1765,7 +1782,7 @@ int iwctl_siwencodeext(struct net_device *dev, } if (pDevice->bwextcount == 4) { - printk("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n"); + pr_debug("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n"); pDevice->bwextcount = 0; pDevice->bWPASuppWextEnabled = true; } @@ -1791,25 +1808,30 @@ int iwctl_giwencodeext(struct net_device *dev, int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, - char *extra) + char __user *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - struct iw_mlme *mlme = (struct iw_mlme *)extra; + struct iw_mlme mime; + int ret = 0; - if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) { + ret = copy_from_user(&mime, extra, sizeof(mime)); + if (ret) + return -EFAULT; + + if (memcmp(pMgmt->abyCurrBSSID, mime.addr.sa_data, ETH_ALEN)) { ret = -EINVAL; return ret; } - switch (mlme->cmd) { + switch (mime.cmd) { case IW_MLME_DEAUTH: //this command seems to be not complete,please test it --einsnliu //bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (unsigned char *)&reason); break; case IW_MLME_DISASSOC: if (pDevice->bLinkPass == true) { - printk("iwctl_siwmlme--->send DISASSOCIATE\n"); + pr_debug("iwctl_siwmlme--->send DISASSOCIATE\n"); //clear related flags memset(pMgmt->abyDesireBSSID, 0xFF, 6); KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); |