Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: vt6655: dead code remove legacy hostap.c/h

hoatap is now supported by mac80211 in nl80211 mode

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Malcolm Priestley and committed by
Greg Kroah-Hartman
ee146490 ae1927eb

-826
-1
drivers/staging/vt6655/Makefile
··· 21 21 rc4.o \ 22 22 tether.o \ 23 23 tcrc.o \ 24 - hostap.o \ 25 24 wpa.o \ 26 25 key.o \ 27 26 tkip.o \
-1
drivers/staging/vt6655/device_main.c
··· 68 68 #include "rxtx.h" 69 69 #include "wroute.h" 70 70 #include "bssdb.h" 71 - #include "hostap.h" 72 71 #include "wpactl.h" 73 72 #include "dpc.h" 74 73 #include "datarate.h"
-1
drivers/staging/vt6655/dpc.c
··· 50 50 #include "tcrc.h" 51 51 #include "wctl.h" 52 52 #include "wroute.h" 53 - #include "hostap.h" 54 53 #include "rf.h" 55 54 #include "iowpa.h" 56 55 #include "aes_ccmp.h"
-764
drivers/staging/vt6655/hostap.c
··· 1 - /* 2 - * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. 3 - * All rights reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License as published by 7 - * the Free Software Foundation; either version 2 of the License, or 8 - * (at your option) any later version. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * You should have received a copy of the GNU General Public License along 16 - * with this program; if not, write to the Free Software Foundation, Inc., 17 - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 - * 19 - * File: hostap.c 20 - * 21 - * Purpose: handle hostap deamon ioctl input/out functions 22 - * 23 - * Author: Lyndon Chen 24 - * 25 - * Date: Oct. 20, 2003 26 - * 27 - * Functions: 28 - * 29 - * Revision History: 30 - * 31 - */ 32 - 33 - #include "hostap.h" 34 - #include "iocmd.h" 35 - #include "mac.h" 36 - #include "card.h" 37 - #include "baseband.h" 38 - #include "wpactl.h" 39 - #include "key.h" 40 - 41 - #define VIAWGET_HOSTAPD_MAX_BUF_SIZE 1024 42 - #define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT0 43 - #define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3 44 - #define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5 45 - 46 - /*--------------------- Static Definitions -------------------------*/ 47 - 48 - /*--------------------- Static Classes ----------------------------*/ 49 - 50 - /*--------------------- Static Functions --------------------------*/ 51 - 52 - /*--------------------- Export Variables --------------------------*/ 53 - 54 - /* 55 - * Description: 56 - * register net_device (AP) for hostap deamon 57 - * 58 - * Parameters: 59 - * In: 60 - * pDevice - 61 - * rtnl_locked - 62 - * Out: 63 - * 64 - * Return Value: 65 - * 66 - */ 67 - 68 - static int hostap_enable_hostapd(struct vnt_private *pDevice, int rtnl_locked) 69 - { 70 - struct vnt_private *apdev_priv; 71 - struct net_device *dev = pDevice->dev; 72 - int ret; 73 - const struct net_device_ops apdev_netdev_ops = { 74 - .ndo_start_xmit = pDevice->tx_80211, 75 - }; 76 - 77 - pr_debug("%s: Enabling hostapd mode\n", dev->name); 78 - 79 - pDevice->apdev = alloc_etherdev(sizeof(*apdev_priv)); 80 - if (pDevice->apdev == NULL) 81 - return -ENOMEM; 82 - 83 - apdev_priv = netdev_priv(pDevice->apdev); 84 - *apdev_priv = *pDevice; 85 - eth_hw_addr_inherit(pDevice->apdev, dev); 86 - 87 - pDevice->apdev->netdev_ops = &apdev_netdev_ops; 88 - 89 - pDevice->apdev->type = ARPHRD_IEEE80211; 90 - 91 - pDevice->apdev->base_addr = dev->base_addr; 92 - pDevice->apdev->irq = dev->irq; 93 - pDevice->apdev->mem_start = dev->mem_start; 94 - pDevice->apdev->mem_end = dev->mem_end; 95 - sprintf(pDevice->apdev->name, "%sap", dev->name); 96 - if (rtnl_locked) 97 - ret = register_netdevice(pDevice->apdev); 98 - else 99 - ret = register_netdev(pDevice->apdev); 100 - if (ret) { 101 - pr_debug("%s: register_netdevice(AP) failed!\n", 102 - dev->name); 103 - free_netdev(pDevice->apdev); 104 - pDevice->apdev = NULL; 105 - return -1; 106 - } 107 - 108 - pr_debug("%s: Registered netdevice %s for AP management\n", 109 - dev->name, pDevice->apdev->name); 110 - 111 - KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); 112 - 113 - return 0; 114 - } 115 - 116 - /* 117 - * Description: 118 - * unregister net_device(AP) 119 - * 120 - * Parameters: 121 - * In: 122 - * pDevice - 123 - * rtnl_locked - 124 - * Out: 125 - * 126 - * Return Value: 127 - * 128 - */ 129 - 130 - static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked) 131 - { 132 - pr_debug("%s: disabling hostapd mode\n", pDevice->dev->name); 133 - 134 - if (pDevice->apdev && pDevice->apdev->name && pDevice->apdev->name[0]) { 135 - if (rtnl_locked) 136 - unregister_netdevice(pDevice->apdev); 137 - else 138 - unregister_netdev(pDevice->apdev); 139 - pr_debug("%s: Netdevice %s unregistered\n", 140 - pDevice->dev->name, pDevice->apdev->name); 141 - } 142 - if (pDevice->apdev) 143 - free_netdev(pDevice->apdev); 144 - pDevice->apdev = NULL; 145 - pDevice->bEnable8021x = false; 146 - pDevice->bEnableHostWEP = false; 147 - pDevice->bEncryptionEnable = false; 148 - 149 - /* 4.2007-0118-03,<Add> by EinsnLiu */ 150 - /* execute some clear work */ 151 - pDevice->pMgmt->byCSSPK = KEY_CTL_NONE; 152 - pDevice->pMgmt->byCSSGK = KEY_CTL_NONE; 153 - KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); 154 - 155 - return 0; 156 - } 157 - 158 - /* 159 - * Description: 160 - * Set enable/disable hostapd mode 161 - * 162 - * Parameters: 163 - * In: 164 - * pDevice - 165 - * rtnl_locked - 166 - * Out: 167 - * 168 - * Return Value: 169 - * 170 - */ 171 - 172 - int vt6655_hostap_set_hostapd(struct vnt_private *pDevice, 173 - int val, int rtnl_locked) 174 - { 175 - if (val < 0 || val > 1) 176 - return -EINVAL; 177 - 178 - if (pDevice->bEnableHostapd == val) 179 - return 0; 180 - 181 - pDevice->bEnableHostapd = val; 182 - 183 - if (val) 184 - return hostap_enable_hostapd(pDevice, rtnl_locked); 185 - return hostap_disable_hostapd(pDevice, rtnl_locked); 186 - } 187 - 188 - /* 189 - * Description: 190 - * remove station function supported for hostap deamon 191 - * 192 - * Parameters: 193 - * In: 194 - * pDevice - 195 - * param - 196 - * Out: 197 - * 198 - * Return Value: 199 - * 200 - */ 201 - static int hostap_remove_sta(struct vnt_private *pDevice, 202 - struct viawget_hostapd_param *param) 203 - { 204 - unsigned int uNodeIndex; 205 - 206 - if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, param->sta_addr, &uNodeIndex)) 207 - BSSvRemoveOneNode(pDevice, uNodeIndex); 208 - else 209 - return -ENOENT; 210 - 211 - return 0; 212 - } 213 - 214 - /* 215 - * Description: 216 - * add a station from hostap deamon 217 - * 218 - * Parameters: 219 - * In: 220 - * pDevice - 221 - * param - 222 - * Out: 223 - * 224 - * Return Value: 225 - * 226 - */ 227 - static int hostap_add_sta(struct vnt_private *pDevice, 228 - struct viawget_hostapd_param *param) 229 - { 230 - PSMgmtObject pMgmt = pDevice->pMgmt; 231 - unsigned int uNodeIndex; 232 - 233 - if (!BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) 234 - BSSvCreateOneNode(pDevice, &uNodeIndex); 235 - 236 - memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN); 237 - pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; 238 - pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = param->u.add_sta.capability; 239 - /* TODO listenInterval */ 240 - pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = false; 241 - pMgmt->sNodeDBTable[uNodeIndex].bySuppRate = param->u.add_sta.tx_supp_rates; 242 - 243 - /* set max tx rate */ 244 - pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = 245 - pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; 246 - /* set max basic rate */ 247 - pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate = RATE_2M; 248 - /* Todo: check sta preamble, if ap can't support, set status code */ 249 - pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = 250 - WLAN_GET_CAP_INFO_SHORTPREAMBLE(pMgmt->sNodeDBTable[uNodeIndex].wCapInfo); 251 - 252 - pMgmt->sNodeDBTable[uNodeIndex].wAID = (unsigned short)param->u.add_sta.aid; 253 - 254 - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies; 255 - 256 - pr_debug("Add STA AID= %d\n", pMgmt->sNodeDBTable[uNodeIndex].wAID); 257 - pr_debug("MAC=%pM\n", param->sta_addr); 258 - pr_debug("Max Support rate = %d\n", 259 - pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); 260 - 261 - return 0; 262 - } 263 - 264 - /* 265 - * Description: 266 - * get station info 267 - * 268 - * Parameters: 269 - * In: 270 - * pDevice - 271 - * param - 272 - * Out: 273 - * 274 - * Return Value: 275 - * 276 - */ 277 - 278 - static int hostap_get_info_sta(struct vnt_private *pDevice, 279 - struct viawget_hostapd_param *param) 280 - { 281 - PSMgmtObject pMgmt = pDevice->pMgmt; 282 - unsigned int uNodeIndex; 283 - 284 - if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { 285 - param->u.get_info_sta.inactive_sec = 286 - (jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ; 287 - } else { 288 - return -ENOENT; 289 - } 290 - 291 - return 0; 292 - } 293 - 294 - /* 295 - * Description: 296 - * set station flag 297 - * 298 - * Parameters: 299 - * In: 300 - * pDevice - 301 - * param - 302 - * Out: 303 - * 304 - * Return Value: 305 - * 306 - */ 307 - static int hostap_set_flags_sta(struct vnt_private *pDevice, 308 - struct viawget_hostapd_param *param) 309 - { 310 - PSMgmtObject pMgmt = pDevice->pMgmt; 311 - unsigned int uNodeIndex; 312 - 313 - if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { 314 - pMgmt->sNodeDBTable[uNodeIndex].dwFlags |= param->u.set_flags_sta.flags_or; 315 - pMgmt->sNodeDBTable[uNodeIndex].dwFlags &= param->u.set_flags_sta.flags_and; 316 - pr_debug(" dwFlags = %x\n", 317 - (unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags); 318 - } else { 319 - return -ENOENT; 320 - } 321 - 322 - return 0; 323 - } 324 - 325 - /* 326 - * Description: 327 - * set generic element (wpa ie) 328 - * 329 - * Parameters: 330 - * In: 331 - * pDevice - 332 - * param - 333 - * Out: 334 - * 335 - * Return Value: 336 - * 337 - */ 338 - static int hostap_set_generic_element(struct vnt_private *pDevice, 339 - struct viawget_hostapd_param *param) 340 - { 341 - PSMgmtObject pMgmt = pDevice->pMgmt; 342 - 343 - if (param->u.generic_elem.len > sizeof(pMgmt->abyWPAIE)) 344 - return -EINVAL; 345 - 346 - memcpy(pMgmt->abyWPAIE, 347 - param->u.generic_elem.data, 348 - param->u.generic_elem.len 349 - ); 350 - 351 - pMgmt->wWPAIELen = param->u.generic_elem.len; 352 - 353 - pr_debug("pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen); 354 - 355 - /* disable wpa */ 356 - if (pMgmt->wWPAIELen == 0) { 357 - pMgmt->eAuthenMode = WMAC_AUTH_OPEN; 358 - pr_debug(" No WPAIE, Disable WPA\n"); 359 - } else { 360 - /* enable wpa */ 361 - if ((pMgmt->abyWPAIE[0] == WLAN_EID_RSN_WPA) || 362 - (pMgmt->abyWPAIE[0] == WLAN_EID_RSN)) { 363 - pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; 364 - pr_debug("Set WPAIE enable WPA\n"); 365 - } else 366 - return -EINVAL; 367 - } 368 - 369 - return 0; 370 - } 371 - 372 - /* 373 - * Description: 374 - * flush station nodes table. 375 - * 376 - * Parameters: 377 - * In: 378 - * pDevice - 379 - * Out: 380 - * 381 - * Return Value: 382 - * 383 - */ 384 - 385 - static void hostap_flush_sta(struct vnt_private *pDevice) 386 - { 387 - /* reserved node index =0 for multicast node. */ 388 - BSSvClearNodeDBTable(pDevice, 1); 389 - pDevice->uAssocCount = 0; 390 - } 391 - 392 - /* 393 - * Description: 394 - * set each stations encryption key 395 - * 396 - * Parameters: 397 - * In: 398 - * pDevice - 399 - * param - 400 - * Out: 401 - * 402 - * Return Value: 403 - * 404 - */ 405 - static int hostap_set_encryption(struct vnt_private *pDevice, 406 - struct viawget_hostapd_param *param, 407 - int param_len) 408 - { 409 - PSMgmtObject pMgmt = pDevice->pMgmt; 410 - unsigned long dwKeyIndex = 0; 411 - unsigned char abyKey[MAX_KEY_LEN]; 412 - unsigned char abySeq[MAX_KEY_LEN]; 413 - u64 KeyRSC; 414 - unsigned char byKeyDecMode = KEY_CTL_WEP; 415 - int iNodeIndex = -1; 416 - int ii; 417 - bool bKeyTableFull = false; 418 - unsigned short wKeyCtl = 0; 419 - 420 - param->u.crypt.err = 0; 421 - 422 - if (param->u.crypt.alg > WPA_ALG_CCMP) 423 - return -EINVAL; 424 - 425 - if ((param->u.crypt.idx > 3) || (param->u.crypt.key_len > MAX_KEY_LEN)) { 426 - param->u.crypt.err = HOSTAP_CRYPT_ERR_KEY_SET_FAILED; 427 - pr_debug(" HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n"); 428 - return -EINVAL; 429 - } 430 - 431 - if (is_broadcast_ether_addr(param->sta_addr)) { 432 - if (param->u.crypt.idx >= MAX_GROUP_KEY) 433 - return -EINVAL; 434 - iNodeIndex = 0; 435 - 436 - } else { 437 - if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == false) { 438 - param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; 439 - pr_debug(" HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); 440 - return -EINVAL; 441 - } 442 - } 443 - pr_debug(" hostap_set_encryption: sta_index %d\n", iNodeIndex); 444 - pr_debug(" hostap_set_encryption: alg %d\n", param->u.crypt.alg); 445 - 446 - if (param->u.crypt.alg == WPA_ALG_NONE) { 447 - if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly) { 448 - if (!KeybRemoveKey(&(pDevice->sKey), 449 - param->sta_addr, 450 - pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex, 451 - pDevice->PortOffset)) { 452 - pr_debug("KeybRemoveKey fail\n"); 453 - } 454 - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; 455 - } 456 - pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = 0; 457 - pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = 0; 458 - pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = 0; 459 - pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = 0; 460 - pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0; 461 - pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0; 462 - pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = 0; 463 - memset(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], 464 - 0, 465 - MAX_KEY_LEN 466 - ); 467 - 468 - return 0; 469 - } 470 - 471 - memcpy(abyKey, param->u.crypt.key, param->u.crypt.key_len); 472 - /* copy to node key tbl */ 473 - pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = param->u.crypt.idx; 474 - pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = param->u.crypt.key_len; 475 - memcpy(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], 476 - param->u.crypt.key, 477 - param->u.crypt.key_len 478 - ); 479 - 480 - dwKeyIndex = (unsigned long)(param->u.crypt.idx); 481 - if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) { 482 - pDevice->byKeyIndex = (unsigned char)dwKeyIndex; 483 - pDevice->bTransmitKey = true; 484 - dwKeyIndex |= (1 << 31); 485 - } 486 - 487 - if (param->u.crypt.alg == WPA_ALG_WEP) { 488 - if ((pDevice->bEnable8021x == false) || (iNodeIndex == 0)) { 489 - KeybSetDefaultKey(&(pDevice->sKey), 490 - dwKeyIndex & ~(BIT30 | USE_KEYRSC), 491 - param->u.crypt.key_len, 492 - NULL, 493 - abyKey, 494 - KEY_CTL_WEP, 495 - pDevice->PortOffset, 496 - pDevice->byLocalID); 497 - 498 - } else { 499 - /* 8021x enable, individual key */ 500 - dwKeyIndex |= (1 << 30); /* set pairwise key */ 501 - if (KeybSetKey(&(pDevice->sKey), 502 - &param->sta_addr[0], 503 - dwKeyIndex & ~(USE_KEYRSC), 504 - param->u.crypt.key_len, 505 - (u64 *) &KeyRSC, 506 - (unsigned char *)abyKey, 507 - KEY_CTL_WEP, 508 - pDevice->PortOffset, 509 - pDevice->byLocalID)) { 510 - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; 511 - 512 - } else { 513 - /* Key Table Full */ 514 - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; 515 - bKeyTableFull = true; 516 - } 517 - } 518 - pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; 519 - pDevice->bEncryptionEnable = true; 520 - pMgmt->byCSSPK = KEY_CTL_WEP; 521 - pMgmt->byCSSGK = KEY_CTL_WEP; 522 - pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = KEY_CTL_WEP; 523 - pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; 524 - return 0; 525 - } 526 - 527 - if (param->u.crypt.seq) { 528 - memcpy(&abySeq, param->u.crypt.seq, 8); 529 - for (ii = 0; ii < 8; ii++) 530 - KeyRSC |= (u64)abySeq[ii] << (ii * 8); 531 - 532 - dwKeyIndex |= 1 << 29; 533 - pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = KeyRSC; 534 - } 535 - 536 - if (param->u.crypt.alg == WPA_ALG_TKIP) { 537 - if (param->u.crypt.key_len != MAX_KEY_LEN) 538 - return -EINVAL; 539 - pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; 540 - byKeyDecMode = KEY_CTL_TKIP; 541 - pMgmt->byCSSPK = KEY_CTL_TKIP; 542 - pMgmt->byCSSGK = KEY_CTL_TKIP; 543 - } 544 - 545 - if (param->u.crypt.alg == WPA_ALG_CCMP) { 546 - if ((param->u.crypt.key_len != AES_KEY_LEN) || 547 - (pDevice->byLocalID <= REV_ID_VT3253_A1)) 548 - return -EINVAL; 549 - pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; 550 - byKeyDecMode = KEY_CTL_CCMP; 551 - pMgmt->byCSSPK = KEY_CTL_CCMP; 552 - pMgmt->byCSSGK = KEY_CTL_CCMP; 553 - } 554 - 555 - if (iNodeIndex == 0) { 556 - KeybSetDefaultKey(&(pDevice->sKey), 557 - dwKeyIndex, 558 - param->u.crypt.key_len, 559 - (u64 *) &KeyRSC, 560 - abyKey, 561 - byKeyDecMode, 562 - pDevice->PortOffset, 563 - pDevice->byLocalID); 564 - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; 565 - 566 - } else { 567 - dwKeyIndex |= (1 << 30); /* set pairwise key */ 568 - if (KeybSetKey(&(pDevice->sKey), 569 - &param->sta_addr[0], 570 - dwKeyIndex, 571 - param->u.crypt.key_len, 572 - (u64 *) &KeyRSC, 573 - (unsigned char *)abyKey, 574 - byKeyDecMode, 575 - pDevice->PortOffset, 576 - pDevice->byLocalID)) { 577 - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; 578 - 579 - } else { 580 - /* Key Table Full */ 581 - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; 582 - bKeyTableFull = true; 583 - pr_debug(" Key Table Full\n"); 584 - } 585 - 586 - } 587 - 588 - if (bKeyTableFull) { 589 - wKeyCtl &= 0x7F00; /* clear all key control filed */ 590 - wKeyCtl |= (byKeyDecMode << 4); 591 - wKeyCtl |= (byKeyDecMode); 592 - wKeyCtl |= 0x0044; /* use group key for all address */ 593 - wKeyCtl |= 0x4000; /* disable KeyTable[MAX_KEY_TABLE-1] on-fly to genernate rx int */ 594 - MACvSetDefaultKeyCtl(pDevice->PortOffset, wKeyCtl, MAX_KEY_TABLE-1, pDevice->byLocalID); 595 - } 596 - 597 - pr_debug(" Set key sta_index= %d\n", iNodeIndex); 598 - pr_debug(" tx_index=%d len=%d\n", 599 - param->u.crypt.idx, param->u.crypt.key_len); 600 - pr_debug(" key=%x-%x-%x-%x-%x-xxxxx\n", 601 - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], 602 - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1], 603 - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2], 604 - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[3], 605 - pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[4]); 606 - 607 - /* set wep key */ 608 - pDevice->bEncryptionEnable = true; 609 - pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = byKeyDecMode; 610 - pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; 611 - pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0; 612 - pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0; 613 - 614 - return 0; 615 - } 616 - 617 - /* 618 - * Description: 619 - * get each stations encryption key 620 - * 621 - * Parameters: 622 - * In: 623 - * pDevice - 624 - * param - 625 - * Out: 626 - * 627 - * Return Value: 628 - * 629 - */ 630 - static int hostap_get_encryption(struct vnt_private *pDevice, 631 - struct viawget_hostapd_param *param, 632 - int param_len) 633 - { 634 - PSMgmtObject pMgmt = pDevice->pMgmt; 635 - int ii; 636 - int iNodeIndex = 0; 637 - 638 - param->u.crypt.err = 0; 639 - 640 - if (is_broadcast_ether_addr(param->sta_addr)) { 641 - iNodeIndex = 0; 642 - } else { 643 - if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == false) { 644 - param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; 645 - pr_debug("hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); 646 - return -EINVAL; 647 - } 648 - } 649 - pr_debug("hostap_get_encryption: %d\n", iNodeIndex); 650 - memset(param->u.crypt.seq, 0, 8); 651 - for (ii = 0; ii < 8; ii++) 652 - param->u.crypt.seq[ii] = (unsigned char)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8); 653 - 654 - return 0; 655 - } 656 - 657 - /* 658 - * Description: 659 - * vt6655_hostap_ioctl main function supported for hostap deamon. 660 - * 661 - * Parameters: 662 - * In: 663 - * pDevice - 664 - * iw_point - 665 - * Out: 666 - * 667 - * Return Value: 668 - * 669 - */ 670 - int vt6655_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) 671 - { 672 - struct viawget_hostapd_param *param; 673 - int ret = 0; 674 - int ap_ioctl = 0; 675 - 676 - if (p->length < sizeof(struct viawget_hostapd_param) || 677 - p->length > VIAWGET_HOSTAPD_MAX_BUF_SIZE || !p->pointer) 678 - return -EINVAL; 679 - 680 - param = kmalloc((int)p->length, GFP_KERNEL); 681 - if (param == NULL) 682 - return -ENOMEM; 683 - 684 - if (copy_from_user(param, p->pointer, p->length)) { 685 - ret = -EFAULT; 686 - goto out; 687 - } 688 - 689 - switch (param->cmd) { 690 - case VIAWGET_HOSTAPD_SET_ENCRYPTION: 691 - pr_debug("VIAWGET_HOSTAPD_SET_ENCRYPTION\n"); 692 - spin_lock_irq(&pDevice->lock); 693 - ret = hostap_set_encryption(pDevice, param, p->length); 694 - spin_unlock_irq(&pDevice->lock); 695 - break; 696 - case VIAWGET_HOSTAPD_GET_ENCRYPTION: 697 - pr_debug("VIAWGET_HOSTAPD_GET_ENCRYPTION\n"); 698 - spin_lock_irq(&pDevice->lock); 699 - ret = hostap_get_encryption(pDevice, param, p->length); 700 - spin_unlock_irq(&pDevice->lock); 701 - break; 702 - case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR: 703 - pr_debug("VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR\n"); 704 - ret = -EOPNOTSUPP; 705 - goto out; 706 - case VIAWGET_HOSTAPD_FLUSH: 707 - pr_debug("VIAWGET_HOSTAPD_FLUSH\n"); 708 - spin_lock_irq(&pDevice->lock); 709 - hostap_flush_sta(pDevice); 710 - spin_unlock_irq(&pDevice->lock); 711 - break; 712 - case VIAWGET_HOSTAPD_ADD_STA: 713 - pr_debug("VIAWGET_HOSTAPD_ADD_STA\n"); 714 - spin_lock_irq(&pDevice->lock); 715 - ret = hostap_add_sta(pDevice, param); 716 - spin_unlock_irq(&pDevice->lock); 717 - break; 718 - case VIAWGET_HOSTAPD_REMOVE_STA: 719 - pr_debug("VIAWGET_HOSTAPD_REMOVE_STA\n"); 720 - spin_lock_irq(&pDevice->lock); 721 - ret = hostap_remove_sta(pDevice, param); 722 - spin_unlock_irq(&pDevice->lock); 723 - break; 724 - case VIAWGET_HOSTAPD_GET_INFO_STA: 725 - pr_debug("VIAWGET_HOSTAPD_GET_INFO_STA\n"); 726 - ret = hostap_get_info_sta(pDevice, param); 727 - ap_ioctl = 1; 728 - break; 729 - case VIAWGET_HOSTAPD_SET_FLAGS_STA: 730 - pr_debug("VIAWGET_HOSTAPD_SET_FLAGS_STA\n"); 731 - ret = hostap_set_flags_sta(pDevice, param); 732 - break; 733 - case VIAWGET_HOSTAPD_MLME: 734 - pr_debug("VIAWGET_HOSTAPD_MLME\n"); 735 - ret = -EOPNOTSUPP; 736 - goto out; 737 - case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT: 738 - pr_debug("VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT\n"); 739 - ret = hostap_set_generic_element(pDevice, param); 740 - break; 741 - case VIAWGET_HOSTAPD_SCAN_REQ: 742 - pr_debug("VIAWGET_HOSTAPD_SCAN_REQ\n"); 743 - ret = -EOPNOTSUPP; 744 - goto out; 745 - case VIAWGET_HOSTAPD_STA_CLEAR_STATS: 746 - pr_debug("VIAWGET_HOSTAPD_STA_CLEAR_STATS\n"); 747 - ret = -EOPNOTSUPP; 748 - goto out; 749 - default: 750 - pr_debug("vt6655_hostap_ioctl: unknown cmd=%d\n", 751 - (int)param->cmd); 752 - ret = -EOPNOTSUPP; 753 - goto out; 754 - } 755 - 756 - if ((ret == 0) && ap_ioctl) { 757 - if (copy_to_user(p->pointer, param, p->length)) 758 - ret = -EFAULT; 759 - } 760 - 761 - out: 762 - kfree(param); 763 - return ret; 764 - }
-58
drivers/staging/vt6655/hostap.h
··· 1 - /* 2 - * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. 3 - * All rights reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License as published by 7 - * the Free Software Foundation; either version 2 of the License, or 8 - * (at your option) any later version. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * You should have received a copy of the GNU General Public License along 16 - * with this program; if not, write to the Free Software Foundation, Inc., 17 - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 - * 19 - * File: hostap.h 20 - * 21 - * Purpose: 22 - * 23 - * Author: Lyndon Chen 24 - * 25 - * Date: May 21, 2003 26 - * 27 - */ 28 - 29 - #ifndef __HOSTAP_H__ 30 - #define __HOSTAP_H__ 31 - 32 - #include "device.h" 33 - 34 - #define WLAN_RATE_1M BIT0 35 - #define WLAN_RATE_2M BIT1 36 - #define WLAN_RATE_5M5 BIT2 37 - #define WLAN_RATE_11M BIT3 38 - #define WLAN_RATE_6M BIT4 39 - #define WLAN_RATE_9M BIT5 40 - #define WLAN_RATE_12M BIT6 41 - #define WLAN_RATE_18M BIT7 42 - #define WLAN_RATE_24M BIT8 43 - #define WLAN_RATE_36M BIT9 44 - #define WLAN_RATE_48M BIT10 45 - #define WLAN_RATE_54M BIT11 46 - 47 - #ifndef ETH_P_PAE 48 - #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 49 - #endif /* ETH_P_PAE */ 50 - 51 - #ifndef ARPHRD_IEEE80211 52 - #define ARPHRD_IEEE80211 801 53 - #endif 54 - 55 - int vt6655_hostap_set_hostapd(struct vnt_private *, int val, int rtnl_locked); 56 - int vt6655_hostap_ioctl(struct vnt_private *, struct iw_point *p); 57 - 58 - #endif /* __HOSTAP_H__ */
-1
drivers/staging/vt6655/rxtx.c
··· 60 60 #include "tcrc.h" 61 61 #include "wctl.h" 62 62 #include "wroute.h" 63 - #include "hostap.h" 64 63 #include "rf.h" 65 64 66 65 /*--------------------- Static Definitions -------------------------*/