static int wpa_set_associate(PSDevice pDevice, struct viawget_wpa_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; PWLAN_IE_SSID pItemSSID; unsigned char abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; unsigned char abyWPAIE[64]; int ret = 0; bool bWepEnabled=false; // set key type & algorithm DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len); if (param->u.wpa_associate.wpa_ie_len) { if (!param->u.wpa_associate.wpa_ie) return -EINVAL; if (param->u.wpa_associate.wpa_ie_len > sizeof(abyWPAIE)) return -EINVAL; if (copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) return -EFAULT; } if (param->u.wpa_associate.mode == 1) pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; else pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; // set ssid memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSID->byElementID = WLAN_EID_SSID; pItemSSID->len = param->u.wpa_associate.ssid_len; memcpy(pItemSSID->abySSID, param->u.wpa_associate.ssid, pItemSSID->len); // set bssid if (memcmp(param->u.wpa_associate.bssid, &abyNullAddr[0], 6) != 0) memcpy(pMgmt->abyDesireBSSID, param->u.wpa_associate.bssid, 6); else { bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pItemSSID->abySSID); } if (param->u.wpa_associate.wpa_ie_len == 0) { if (param->u.wpa_associate.auth_alg & AUTH_ALG_SHARED_KEY) pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY; else pMgmt->eAuthenMode = WMAC_AUTH_OPEN; } else if (abyWPAIE[0] == RSN_INFO_ELEM) { if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA2; } else { if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_WPA_NONE) pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; else if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA; } switch (param->u.wpa_associate.pairwise_suite) { case CIPHER_CCMP: pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; break; case CIPHER_TKIP: pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; break; case CIPHER_WEP40: case CIPHER_WEP104: pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; bWepEnabled=true; break; case CIPHER_NONE: if (param->u.wpa_associate.group_suite == CIPHER_CCMP) pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; else pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; break; default: pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; } //DavidWang add for WPA_supplicant support open/share mode if (pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) { pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; //pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY; pMgmt->bShareKeyAlgorithm = true; } else if (pMgmt->eAuthenMode == WMAC_AUTH_OPEN) { if(!bWepEnabled) pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; else pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; //pMgmt->eAuthenMode = WMAC_AUTH_OPEN; //pMgmt->bShareKeyAlgorithm = false; //20080717-06,<Modify> by chester//Fix Open mode, WEP encrytion } //mike save old encryption status pDevice->eOldEncryptionStatus = pDevice->eEncryptionStatus; if (pDevice->eEncryptionStatus != Ndis802_11EncryptionDisabled) pDevice->bEncryptionEnable = true; else pDevice->bEncryptionEnable = false; if (!((pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) || ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && (bWepEnabled==true))) ) //DavidWang //20080717-06,<Modify> by chester//Not to initial WEP KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); spin_lock_irq(&pDevice->lock); pDevice->bLinkPass = false; memset(pMgmt->abyCurrBSSID, 0, 6); pMgmt->eCurrState = WMAC_STATE_IDLE; netif_stop_queue(pDevice->dev); //20080701-02,<Add> by Mike Liu /*******search if ap_scan=2 ,which is associating request in hidden ssid mode ****/ { PKnownBSS pCurr = NULL; pCurr = BSSpSearchBSSList(pDevice, pMgmt->abyDesireBSSID, pMgmt->abyDesireSSID, pMgmt->eConfigPHYMode ); if (pCurr == NULL){ printk("wpa_set_associate---->hidden mode site survey before associate.......\n"); bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); } } /****************************************************************/ bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL); spin_unlock_irq(&pDevice->lock); return ret; }
/* * Wireless Handler: set essid */ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct vnt_private *pDevice = netdev_priv(dev); struct iw_point *wrq = &wrqu->essid; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; PWLAN_IE_SSID pItemSSID; if (pMgmt == NULL) return -EFAULT; if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) return -EINVAL; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID :\n"); pDevice->fWPA_Authened = false; // 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"); // Unknown desired AP, so here need not associate?? return 0; } else { // Set the SSID memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSID->byElementID = WLAN_EID_SSID; memcpy(pItemSSID->abySSID, extra, wrq->length); if (pItemSSID->abySSID[wrq->length] == '\0') { if (wrq->length > 0) pItemSSID->len = wrq->length; } else { pItemSSID->len = wrq->length; } PRINT_K("set essid to %s\n", pItemSSID->abySSID); // mike: need clear desiredBSSID if (pItemSSID->len == 0) { memset(pMgmt->abyDesireBSSID, 0xFF, 6); return 0; } // Wext wil order another command of siwap to link // with desired AP, so here need not associate?? if (pDevice->bWPASuppWextEnabled == true) { /*******search if in hidden ssid mode ****/ PKnownBSS pCurr = NULL; u8 abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; unsigned ii; unsigned uSameBssidNum = 0; memcpy(abyTmpDesireSSID, pMgmt->abyDesireSSID, sizeof(abyTmpDesireSSID)); pCurr = BSSpSearchBSSList(pDevice, NULL, abyTmpDesireSSID, pDevice->eConfigPHYMode); if (pCurr == NULL) { PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); vResetCommandTimer((void *)pDevice); pMgmt->eScanType = WMAC_SCAN_ACTIVE; bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); } else { // mike: to find out if that desired SSID is a // hidden-ssid AP, by means of judging if there // are two same BSSID exist in list ? for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, pCurr->abyBSSID)) { uSameBssidNum++; } } if (uSameBssidNum >= 2) { // hit: desired AP is in hidden ssid mode!!! PRINT_K("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); bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); } } return 0; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s\n", pItemSSID->abySSID); } if (pDevice->flags & DEVICE_FLAGS_OPENED) pDevice->bCommit = true; return 0; }
int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrq, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) return -EINVAL; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID :\n"); pDevice->fWPA_Authened = FALSE; if(wrq->flags == 0) { memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(pMgmt->abyDesireBSSID, 0xFF,6); PRINT_K("set essid to 'any' \n"); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT return 0; #endif } else { memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSID->byElementID = WLAN_EID_SSID; memcpy(pItemSSID->abySSID, extra, wrq->length); if (pItemSSID->abySSID[wrq->length - 1] == '\0') { if(wrq->length>0) pItemSSID->len = wrq->length - 1; } else pItemSSID->len = wrq->length; PRINT_K("set essid to %s \n",pItemSSID->abySSID); if(pItemSSID->len==0) { memset(pMgmt->abyDesireBSSID, 0xFF,6); return 0; } #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT if(pDevice->bWPASuppWextEnabled == TRUE) { { PKnownBSS pCurr = NULL; BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; unsigned int ii, uSameBssidNum = 0; memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID)); pCurr = BSSpSearchBSSList(pDevice, NULL, abyTmpDesireSSID, pDevice->eConfigPHYMode ); if (pCurr == NULL){ PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); vResetCommandTimer((void *) pDevice); pMgmt->eScanType = WMAC_SCAN_ACTIVE; bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); } else { for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive && !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pCurr->abyBSSID)) { uSameBssidNum++; } } if(uSameBssidNum >= 2) { PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n"); vResetCommandTimer((void *) pDevice); pMgmt->eScanType = WMAC_SCAN_PASSIVE; bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); } } } return 0; } #endif DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); } if (pDevice->flags & DEVICE_FLAGS_OPENED) { pDevice->bCommit = TRUE; } return 0; }
static int wpa_set_associate(PSDevice pDevice, struct viawget_wpa_param *param) { PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; BYTE abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; BYTE abyWPAIE[64]; int ret = 0; BOOL bwepEnabled=FALSE; // set key type & algorithm DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming dBm = %d\n", param->u.wpa_associate.roam_dbm); //Davidwang if (param->u.wpa_associate.wpa_ie && copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) return -EINVAL; if (param->u.wpa_associate.mode == 1) pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; else pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; // set bssid if (memcmp(param->u.wpa_associate.bssid, &abyNullAddr[0], 6) != 0) memcpy(pMgmt->abyDesireBSSID, param->u.wpa_associate.bssid, 6); // set ssid memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSID->byElementID = WLAN_EID_SSID; pItemSSID->len = param->u.wpa_associate.ssid_len; memcpy(pItemSSID->abySSID, param->u.wpa_associate.ssid, pItemSSID->len); if (param->u.wpa_associate.wpa_ie_len == 0) { if (param->u.wpa_associate.auth_alg & AUTH_ALG_SHARED_KEY) pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY; else pMgmt->eAuthenMode = WMAC_AUTH_OPEN; } else if (abyWPAIE[0] == RSN_INFO_ELEM) { if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA2; } else { if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_WPA_NONE) pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; else if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA; } switch (param->u.wpa_associate.pairwise_suite) { case CIPHER_CCMP: pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; break; case CIPHER_TKIP: pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; break; case CIPHER_WEP40: case CIPHER_WEP104: pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; bwepEnabled = TRUE; // printk("****************wpa_set_associate:set CIPHER_WEP40_104\n"); break; case CIPHER_NONE: if (param->u.wpa_associate.group_suite == CIPHER_CCMP) pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; else pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; break; default: pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; }; pMgmt->Roam_dbm = param->u.wpa_associate.roam_dbm; // if ((pMgmt->Roam_dbm > 40)&&(pMgmt->Roam_dbm<80)) // pDevice->bEnableRoaming = TRUE; if (pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) { //@wep-sharekey pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; pMgmt->bShareKeyAlgorithm = TRUE; } else if (pMgmt->eAuthenMode == WMAC_AUTH_OPEN) { if(bwepEnabled==TRUE) { //@open-wep pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; } else { //@only open pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; } } //mike save old encryption status pDevice->eOldEncryptionStatus = pDevice->eEncryptionStatus; if (pDevice->eEncryptionStatus != Ndis802_11EncryptionDisabled) pDevice->bEncryptionEnable = TRUE; else pDevice->bEncryptionEnable = FALSE; if ((pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) || ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && (bwepEnabled==TRUE))) { //mike re-comment:open-wep && sharekey-wep needn't do initial key!! } else KeyvInitTable(pDevice,&pDevice->sKey); spin_lock_irq(&pDevice->lock); pDevice->bLinkPass = FALSE; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); memset(pMgmt->abyCurrBSSID, 0, 6); pMgmt->eCurrState = WMAC_STATE_IDLE; netif_stop_queue(pDevice->dev); /*******search if ap_scan=2 ,which is associating request in hidden ssid mode ****/ { PKnownBSS pCurr = NULL; pCurr = BSSpSearchBSSList(pDevice, pMgmt->abyDesireBSSID, pMgmt->abyDesireSSID, pDevice->eConfigPHYMode ); if (pCurr == NULL){ printk("wpa_set_associate---->hidden mode site survey before associate.......\n"); bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); }; } /****************************************************************/ bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL); spin_unlock_irq(&pDevice->lock); return ret; }
static int wpa_set_associate(PSDevice pDevice, struct viawget_wpa_param *param) { PSMgmtObject pMgmt = pDevice->pMgmt; PWLAN_IE_SSID pItemSSID; BYTE abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; BYTE abyWPAIE[64]; int ret = 0; BOOL bWepEnabled=FALSE; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len); if (param->u.wpa_associate.wpa_ie && copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) return -EINVAL; if (param->u.wpa_associate.mode == 1) pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; else pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSID->byElementID = WLAN_EID_SSID; pItemSSID->len = param->u.wpa_associate.ssid_len; memcpy(pItemSSID->abySSID, param->u.wpa_associate.ssid, pItemSSID->len); if (memcmp(param->u.wpa_associate.bssid, &abyNullAddr[0], 6) != 0) memcpy(pMgmt->abyDesireBSSID, param->u.wpa_associate.bssid, 6); else { bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pItemSSID->abySSID); } if (param->u.wpa_associate.wpa_ie_len == 0) { if (param->u.wpa_associate.auth_alg & AUTH_ALG_SHARED_KEY) pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY; else pMgmt->eAuthenMode = WMAC_AUTH_OPEN; } else if (abyWPAIE[0] == RSN_INFO_ELEM) { if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA2; } else { if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_WPA_NONE) pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; else if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_PSK) pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; else pMgmt->eAuthenMode = WMAC_AUTH_WPA; } switch (param->u.wpa_associate.pairwise_suite) { case CIPHER_CCMP: pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; break; case CIPHER_TKIP: pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; break; case CIPHER_WEP40: case CIPHER_WEP104: pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; bWepEnabled=TRUE; break; case CIPHER_NONE: if (param->u.wpa_associate.group_suite == CIPHER_CCMP) pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; else pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; break; default: pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; }; if (pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) { pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; pMgmt->bShareKeyAlgorithm = TRUE; } else if (pMgmt->eAuthenMode == WMAC_AUTH_OPEN) { if(!bWepEnabled) pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; else pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; } pDevice->eOldEncryptionStatus = pDevice->eEncryptionStatus; if (pDevice->eEncryptionStatus != Ndis802_11EncryptionDisabled) pDevice->bEncryptionEnable = TRUE; else pDevice->bEncryptionEnable = FALSE; if (!((pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) || ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && (bWepEnabled==TRUE))) ) KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); spin_lock_irq(&pDevice->lock); pDevice->bLinkPass = FALSE; memset(pMgmt->abyCurrBSSID, 0, 6); pMgmt->eCurrState = WMAC_STATE_IDLE; netif_stop_queue(pDevice->dev); { PKnownBSS pCurr = NULL; pCurr = BSSpSearchBSSList(pDevice, pMgmt->abyDesireBSSID, pMgmt->abyDesireSSID, pMgmt->eConfigPHYMode ); if (pCurr == NULL){ printk("wpa_set_associate---->hidden mode site survey before associate.......\n"); bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); }; } bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, NULL); spin_unlock_irq(&pDevice->lock); return ret; }