45 #define VIAWGET_WPA_MAX_BUF_SIZE 1024
49 static const int frequency_list[] = {
50 2412, 2417, 2422, 2427, 2432, 2437, 2442,
51 2447, 2452, 2457, 2462, 2467, 2472, 2484
92 static int wpa_init_wpadev(
PSDevice pDevice)
102 wpadev_priv = netdev_priv(pDevice->
wpadev);
103 *wpadev_priv = *pDevice;
143 static int wpa_release_wpadev(
PSDevice pDevice)
146 dev_kfree_skb(pDevice->
skb);
152 pDevice->
dev->name, pDevice->
wpadev->name);
182 return wpa_init_wpadev(pDevice);
184 return wpa_release_wpadev(pDevice);
206 unsigned long dwKeyIndex = 0;
235 if(param->
u.
wpa_key.key && fcpfkernel) {
239 spin_unlock_irq(&pDevice->
lock);
242 spin_lock_irq(&pDevice->
lock);
245 spin_lock_irq(&pDevice->
lock);
248 dwKeyIndex = (
unsigned long)(param->
u.
wpa_key.key_index);
251 if (dwKeyIndex > 3) {
258 dwKeyIndex |= (1 << 31);
276 if(param->
u.
wpa_key.seq && fcpfkernel) {
280 spin_unlock_irq(&pDevice->
lock);
283 spin_lock_irq(&pDevice->
lock);
286 spin_lock_irq(&pDevice->
lock);
290 for (ii = 0 ; ii < param->
u.
wpa_key.seq_len ; ii++) {
292 LODWORD(KeyRSC) |= (abySeq[ii] << (ii * 8));
294 HIDWORD(KeyRSC) |= (abySeq[ii] << ((ii-4) * 8));
297 dwKeyIndex |= 1 << 29;
314 dwKeyIndex |= (1 << 31);
356 if (is_broadcast_ether_addr(¶m->
addr[0]) || (param->
addr ==
NULL)) {
364 (
unsigned char *)abyKey,
372 (
unsigned char *)abyKey,
394 dwKeyIndex |= (1 << 30);
405 (
unsigned char *)abyKey,
413 if (!compare_ether_addr(¶m->
addr[0], pDevice->
abyBSSID)) {
426 if ((ret == 0) && ((param->
u.
wpa_key.set_tx) != 0)) {
462 static int wpa_set_wpa(
PSDevice pDevice,
492 static int wpa_set_disassociate(
PSDevice pDevice,
498 spin_lock_irq(&pDevice->
lock);
503 spin_unlock_irq(&pDevice->
lock);
524 static int wpa_set_scan(
PSDevice pDevice,
529 spin_lock_irq(&pDevice->
lock);
532 spin_unlock_irq(&pDevice->
lock);
553 static int wpa_get_bssid(
PSDevice pDevice,
580 static int wpa_get_ssid(
PSDevice pDevice,
611 static int wpa_get_scan(
PSDevice pDevice,
624 unsigned char *ptempBSS;
630 if (ptempBSS ==
NULL) {
632 printk(
"bubble sort kmalloc memory fail@@@\n");
642 for(jj=0;jj<MAX_BSS_NUM-ii-1;jj++) {
644 if((pMgmt->
sBSSList[jj].bActive!=
true) ||
701 memcpy(scan_buf->
ssid, pItemSSID->abySSID, pItemSSID->len);
702 scan_buf->
ssid_len = pItemSSID->len;
703 scan_buf->
freq = frequency_list[pBSS->uChannel-1];
704 scan_buf->
caps = pBSS->wCapInfo;
710 if (pBSS->wWPALen != 0) {
714 if (pBSS->wRSNLen != 0) {
752 static
int wpa_set_associate(
PSDevice pDevice,
757 unsigned char abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
758 unsigned char abyWPAIE[64];
760 bool bWepEnabled=
false;
771 if (param->u.wpa_associate.wpa_ie_len) {
772 if (!param->u.wpa_associate.wpa_ie)
774 if (param->u.wpa_associate.wpa_ie_len >
sizeof(abyWPAIE))
776 if (
copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len))
780 if (param->u.wpa_associate.mode == 1)
788 pItemSSID->len = param->u.wpa_associate.ssid_len;
789 memcpy(pItemSSID->abySSID, param->u.wpa_associate.ssid, pItemSSID->len);
791 if (
memcmp(param->u.wpa_associate.bssid, &abyNullAddr[0], 6) != 0)
798 if (param->u.wpa_associate.wpa_ie_len == 0) {
804 if (param->u.wpa_associate.key_mgmt_suite ==
KEY_MGMT_PSK)
811 else if (param->u.wpa_associate.key_mgmt_suite ==
KEY_MGMT_PSK)
817 switch (param->u.wpa_associate.pairwise_suite) {
830 if (param->u.wpa_associate.group_suite ==
CIPHER_CCMP)
853 pDevice->eOldEncryptionStatus = pDevice->eEncryptionStatus;
856 pDevice->bEncryptionEnable =
true;
858 pDevice->bEncryptionEnable =
false;
862 spin_lock_irq(&pDevice->lock);
863 pDevice->bLinkPass =
false;
866 netif_stop_queue(pDevice->dev);
878 printk(
"wpa_set_associate---->hidden mode site survey before associate.......\n");
884 spin_unlock_irq(&pDevice->lock);
923 switch (param->
cmd) {
925 ret = wpa_set_wpa(pDevice, param);
931 spin_lock_irq(&pDevice->
lock);
933 spin_unlock_irq(&pDevice->
lock);
938 ret = wpa_set_scan(pDevice, param);
943 ret = wpa_get_scan(pDevice, param);
949 ret = wpa_get_ssid(pDevice, param);
955 ret = wpa_get_bssid(pDevice, param);
961 ret = wpa_set_associate(pDevice, param);
966 ret = wpa_set_disassociate(pDevice, param);
984 if ((ret == 0) && wpa_ioctl) {