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
76 static int hostap_enable_hostapd(
PSDevice pDevice,
int rtnl_locked)
88 if (pDevice->apdev ==
NULL)
91 apdev_priv = netdev_priv(pDevice->apdev);
92 *apdev_priv = *pDevice;
95 pDevice->apdev->netdev_ops = &apdev_netdev_ops;
99 pDevice->apdev->base_addr = dev->
base_addr;
100 pDevice->apdev->irq = dev->
irq;
101 pDevice->apdev->mem_start = dev->
mem_start;
102 pDevice->apdev->mem_end = dev->
mem_end;
115 dev->
name, pDevice->apdev->name);
136 static int hostap_disable_hostapd(
PSDevice pDevice,
int rtnl_locked)
141 if (pDevice->apdev && pDevice->apdev->name && pDevice->apdev->name[0]) {
143 unregister_netdevice(pDevice->apdev);
147 pDevice->
dev->name, pDevice->apdev->name);
149 kfree(pDevice->apdev);
150 pDevice->apdev =
NULL;
151 pDevice->bEnable8021x =
false;
152 pDevice->bEnableHostWEP =
false;
181 if (val < 0 || val > 1)
184 if (pDevice->bEnableHostapd == val)
187 pDevice->bEnableHostapd =
val;
190 return hostap_enable_hostapd(pDevice, rtnl_locked);
192 return hostap_disable_hostapd(pDevice, rtnl_locked);
209 static int hostap_remove_sta(
PSDevice pDevice,
212 unsigned int uNodeIndex;
241 unsigned int uNodeIndex;
297 static int hostap_get_info_sta(
PSDevice pDevice,
301 unsigned int uNodeIndex;
361 static int hostap_set_flags_sta(
PSDevice pDevice,
365 unsigned int uNodeIndex;
395 static int hostap_set_generic_element(
PSDevice pDevice,
441 static void hostap_flush_sta(
PSDevice pDevice)
468 unsigned long dwKeyIndex = 0;
476 bool bKeyTableFull =
false;
477 unsigned short wKeyCtl = 0;
498 if (is_broadcast_ether_addr(param->
sta_addr)) {
548 dwKeyIndex = (
unsigned long)(param->
u.
crypt.idx);
552 dwKeyIndex |= (1 << 31);
557 if ((pDevice->bEnable8021x ==
false) || (iNodeIndex == 0)) {
569 dwKeyIndex |= (1 << 30);
575 (
unsigned char *)abyKey,
585 bKeyTableFull =
true;
599 for (ii = 0 ; ii < 8 ; ii++) {
600 KeyRSC |= (abySeq[ii] << (ii * 8));
602 dwKeyIndex |= 1 << 29;
626 if (iNodeIndex == 0) {
638 dwKeyIndex |= (1 << 30);
644 (
unsigned char *)abyKey,
654 bKeyTableFull =
true;
660 if (bKeyTableFull ==
true) {
662 wKeyCtl |= (byKeyDecMode << 4);
663 wKeyCtl |= (byKeyDecMode);
705 static int hostap_get_encryption(
PSDevice pDevice,
717 if (is_broadcast_ether_addr(param->
sta_addr)) {
728 for (ii = 0 ; ii < 8 ; ii++) {
769 switch (param->
cmd) {
772 spin_lock_irq(&pDevice->
lock);
774 spin_unlock_irq(&pDevice->
lock);
778 spin_lock_irq(&pDevice->
lock);
779 ret = hostap_get_encryption(pDevice, param, p->
length);
780 spin_unlock_irq(&pDevice->
lock);
788 spin_lock_irq(&pDevice->
lock);
789 hostap_flush_sta(pDevice);
790 spin_unlock_irq(&pDevice->
lock);
794 spin_lock_irq(&pDevice->
lock);
796 spin_unlock_irq(&pDevice->
lock);
800 spin_lock_irq(&pDevice->
lock);
801 ret = hostap_remove_sta(pDevice, param);
802 spin_unlock_irq(&pDevice->
lock);
806 ret = hostap_get_info_sta(pDevice, param);
817 ret = hostap_set_flags_sta(pDevice, param);
826 ret = hostap_set_generic_element(pDevice, param);
845 if ((ret == 0) && ap_ioctl) {