staging:vt6655:hostap: Whitespace cleanups

Neatening only.
git diff -w shows no differences.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Joe Perches 2013-03-18 10:44:49 -07:00 committed by Greg Kroah-Hartman
parent 22c5291e70
commit 4b61d809a5
1 changed files with 314 additions and 314 deletions

View File

@ -49,7 +49,7 @@
/*--------------------- Static Variables --------------------------*/ /*--------------------- Static Variables --------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG; //static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel =MSG_LEVEL_INFO; static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/ /*--------------------- Static Functions --------------------------*/
@ -75,21 +75,21 @@ static int msglevel =MSG_LEVEL_INFO;
static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
{ {
PSDevice apdev_priv; PSDevice apdev_priv;
struct net_device *dev = pDevice->dev; struct net_device *dev = pDevice->dev;
int ret; int ret;
const struct net_device_ops apdev_netdev_ops = { const struct net_device_ops apdev_netdev_ops = {
.ndo_start_xmit = pDevice->tx_80211, .ndo_start_xmit = pDevice->tx_80211,
}; };
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);
pDevice->apdev = kzalloc(sizeof(struct net_device), GFP_KERNEL); pDevice->apdev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
if (pDevice->apdev == NULL) if (pDevice->apdev == NULL)
return -ENOMEM; return -ENOMEM;
apdev_priv = netdev_priv(pDevice->apdev); apdev_priv = netdev_priv(pDevice->apdev);
*apdev_priv = *pDevice; *apdev_priv = *pDevice;
memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN); memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN);
pDevice->apdev->netdev_ops = &apdev_netdev_ops; pDevice->apdev->netdev_ops = &apdev_netdev_ops;
@ -107,14 +107,14 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
ret = register_netdev(pDevice->apdev); ret = register_netdev(pDevice->apdev);
if (ret) { if (ret) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdevice(AP) failed!\n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdevice(AP) failed!\n",
dev->name); dev->name);
return -1; return -1;
} }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdevice %s for AP management\n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdevice %s for AP management\n",
dev->name, pDevice->apdev->name); dev->name, pDevice->apdev->name);
KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
return 0; return 0;
} }
@ -136,27 +136,27 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked) static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked)
{ {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: disabling hostapd mode\n", pDevice->dev->name); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: disabling hostapd mode\n", pDevice->dev->name);
if (pDevice->apdev && pDevice->apdev->name && pDevice->apdev->name[0]) { if (pDevice->apdev && pDevice->apdev->name && pDevice->apdev->name[0]) {
if (rtnl_locked) if (rtnl_locked)
unregister_netdevice(pDevice->apdev); unregister_netdevice(pDevice->apdev);
else else
unregister_netdev(pDevice->apdev); unregister_netdev(pDevice->apdev);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n",
pDevice->dev->name, pDevice->apdev->name); pDevice->dev->name, pDevice->apdev->name);
} }
kfree(pDevice->apdev); kfree(pDevice->apdev);
pDevice->apdev = NULL; pDevice->apdev = NULL;
pDevice->bEnable8021x = false; pDevice->bEnable8021x = false;
pDevice->bEnableHostWEP = false; pDevice->bEnableHostWEP = false;
pDevice->bEncryptionEnable = false; pDevice->bEncryptionEnable = false;
//4.2007-0118-03,<Add> by EinsnLiu //4.2007-0118-03,<Add> by EinsnLiu
//execute some clear work //execute some clear work
pDevice->pMgmt->byCSSPK=KEY_CTL_NONE; pDevice->pMgmt->byCSSPK = KEY_CTL_NONE;
pDevice->pMgmt->byCSSGK=KEY_CTL_NONE; pDevice->pMgmt->byCSSGK = KEY_CTL_NONE;
KeyvInitTable(&pDevice->sKey,pDevice->PortOffset); KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
return 0; return 0;
} }
@ -207,17 +207,17 @@ int vt6655_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked)
* *
*/ */
static int hostap_remove_sta(PSDevice pDevice, static int hostap_remove_sta(PSDevice pDevice,
struct viawget_hostapd_param *param) struct viawget_hostapd_param *param)
{ {
unsigned int uNodeIndex; unsigned int uNodeIndex;
if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, param->sta_addr, &uNodeIndex)) { if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, param->sta_addr, &uNodeIndex)) {
BSSvRemoveOneNode(pDevice, uNodeIndex); BSSvRemoveOneNode(pDevice, uNodeIndex);
} }
else { else {
return -ENOENT; return -ENOENT;
} }
return 0; return 0;
} }
@ -235,47 +235,47 @@ static int hostap_remove_sta(PSDevice pDevice,
* *
*/ */
static int hostap_add_sta(PSDevice pDevice, static int hostap_add_sta(PSDevice pDevice,
struct viawget_hostapd_param *param) struct viawget_hostapd_param *param)
{ {
PSMgmtObject pMgmt = pDevice->pMgmt; PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uNodeIndex; unsigned int uNodeIndex;
if (!BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { if (!BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex); BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
} }
memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN); memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN);
pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC;
pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = param->u.add_sta.capability; pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = param->u.add_sta.capability;
// TODO listenInterval // TODO listenInterval
// pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = 1; // pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = 1;
pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = false; pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = false;
pMgmt->sNodeDBTable[uNodeIndex].bySuppRate = param->u.add_sta.tx_supp_rates; pMgmt->sNodeDBTable[uNodeIndex].bySuppRate = param->u.add_sta.tx_supp_rates;
// set max tx rate // set max tx rate
pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate =
pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate; pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate;
// set max basic rate // set max basic rate
pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate = RATE_2M; pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate = RATE_2M;
// Todo: check sta preamble, if ap can't support, set status code // Todo: check sta preamble, if ap can't support, set status code
pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble =
WLAN_GET_CAP_INFO_SHORTPREAMBLE(pMgmt->sNodeDBTable[uNodeIndex].wCapInfo); WLAN_GET_CAP_INFO_SHORTPREAMBLE(pMgmt->sNodeDBTable[uNodeIndex].wCapInfo);
pMgmt->sNodeDBTable[uNodeIndex].wAID = (unsigned short)param->u.add_sta.aid; pMgmt->sNodeDBTable[uNodeIndex].wAID = (unsigned short)param->u.add_sta.aid;
pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies; pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Add STA AID= %d \n", pMgmt->sNodeDBTable[uNodeIndex].wAID); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Add STA AID= %d \n", pMgmt->sNodeDBTable[uNodeIndex].wAID);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n",
param->sta_addr[0], param->sta_addr[0],
param->sta_addr[1], param->sta_addr[1],
param->sta_addr[2], param->sta_addr[2],
param->sta_addr[3], param->sta_addr[3],
param->sta_addr[4], param->sta_addr[4],
param->sta_addr[5] param->sta_addr[5]
) ; );
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d \n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d \n",
pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate);
return 0; return 0;
} }
@ -295,19 +295,19 @@ static int hostap_add_sta(PSDevice pDevice,
*/ */
static int hostap_get_info_sta(PSDevice pDevice, static int hostap_get_info_sta(PSDevice pDevice,
struct viawget_hostapd_param *param) struct viawget_hostapd_param *param)
{ {
PSMgmtObject pMgmt = pDevice->pMgmt; PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uNodeIndex; unsigned int uNodeIndex;
if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
param->u.get_info_sta.inactive_sec = param->u.get_info_sta.inactive_sec =
(jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ; (jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ;
//param->u.get_info_sta.txexc = pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts; //param->u.get_info_sta.txexc = pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts;
} }
else { else {
return -ENOENT; return -ENOENT;
} }
return 0; return 0;
@ -328,21 +328,21 @@ static int hostap_get_info_sta(PSDevice pDevice,
* *
*/ */
/* /*
static int hostap_reset_txexc_sta(PSDevice pDevice, static int hostap_reset_txexc_sta(PSDevice pDevice,
struct viawget_hostapd_param *param) struct viawget_hostapd_param *param)
{ {
PSMgmtObject pMgmt = pDevice->pMgmt; PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uNodeIndex; unsigned int uNodeIndex;
if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts = 0; pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts = 0;
} }
else { else {
return -ENOENT; return -ENOENT;
} }
return 0; return 0;
} }
*/ */
/* /*
@ -359,19 +359,19 @@ static int hostap_reset_txexc_sta(PSDevice pDevice,
* *
*/ */
static int hostap_set_flags_sta(PSDevice pDevice, static int hostap_set_flags_sta(PSDevice pDevice,
struct viawget_hostapd_param *param) struct viawget_hostapd_param *param)
{ {
PSMgmtObject pMgmt = pDevice->pMgmt; PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uNodeIndex; unsigned int uNodeIndex;
if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
pMgmt->sNodeDBTable[uNodeIndex].dwFlags |= param->u.set_flags_sta.flags_or; pMgmt->sNodeDBTable[uNodeIndex].dwFlags |= param->u.set_flags_sta.flags_or;
pMgmt->sNodeDBTable[uNodeIndex].dwFlags &= param->u.set_flags_sta.flags_and; pMgmt->sNodeDBTable[uNodeIndex].dwFlags &= param->u.set_flags_sta.flags_and;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x \n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x \n",
(unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags); (unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags);
} }
else { else {
return -ENOENT; return -ENOENT;
} }
return 0; return 0;
@ -393,34 +393,34 @@ static int hostap_set_flags_sta(PSDevice pDevice,
* *
*/ */
static int hostap_set_generic_element(PSDevice pDevice, static int hostap_set_generic_element(PSDevice pDevice,
struct viawget_hostapd_param *param) struct viawget_hostapd_param *param)
{ {
PSMgmtObject pMgmt = pDevice->pMgmt; PSMgmtObject pMgmt = pDevice->pMgmt;
memcpy( pMgmt->abyWPAIE, memcpy(pMgmt->abyWPAIE,
param->u.generic_elem.data, param->u.generic_elem.data,
param->u.generic_elem.len param->u.generic_elem.len
); );
pMgmt->wWPAIELen = param->u.generic_elem.len; pMgmt->wWPAIELen = param->u.generic_elem.len;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen);
// disable wpa // disable wpa
if (pMgmt->wWPAIELen == 0) { if (pMgmt->wWPAIELen == 0) {
pMgmt->eAuthenMode = WMAC_AUTH_OPEN; pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " No WPAIE, Disable WPA \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " No WPAIE, Disable WPA \n");
} else { } else {
// enable wpa // enable wpa
if ((pMgmt->abyWPAIE[0] == WLAN_EID_RSN_WPA) || if ((pMgmt->abyWPAIE[0] == WLAN_EID_RSN_WPA) ||
(pMgmt->abyWPAIE[0] == WLAN_EID_RSN)) { (pMgmt->abyWPAIE[0] == WLAN_EID_RSN)) {
pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set WPAIE enable WPA\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set WPAIE enable WPA\n");
} else } else
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
} }
@ -440,11 +440,11 @@ static int hostap_set_generic_element(PSDevice pDevice,
static void hostap_flush_sta(PSDevice pDevice) static void hostap_flush_sta(PSDevice pDevice)
{ {
// reserved node index =0 for multicast node. // reserved node index =0 for multicast node.
BSSvClearNodeDBTable(pDevice, 1); BSSvClearNodeDBTable(pDevice, 1);
pDevice->uAssocCount = 0; pDevice->uAssocCount = 0;
return; return;
} }
/* /*
@ -461,15 +461,15 @@ static void hostap_flush_sta(PSDevice pDevice)
* *
*/ */
static int hostap_set_encryption(PSDevice pDevice, static int hostap_set_encryption(PSDevice pDevice,
struct viawget_hostapd_param *param, struct viawget_hostapd_param *param,
int param_len) int param_len)
{ {
PSMgmtObject pMgmt = pDevice->pMgmt; PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned long dwKeyIndex = 0; unsigned long dwKeyIndex = 0;
unsigned char abyKey[MAX_KEY_LEN]; unsigned char abyKey[MAX_KEY_LEN];
unsigned char abySeq[MAX_KEY_LEN]; unsigned char abySeq[MAX_KEY_LEN];
NDIS_802_11_KEY_RSC KeyRSC; NDIS_802_11_KEY_RSC KeyRSC;
unsigned char byKeyDecMode = KEY_CTL_WEP; unsigned char byKeyDecMode = KEY_CTL_WEP;
int ret = 0; int ret = 0;
int iNodeIndex = -1; int iNodeIndex = -1;
int ii; int ii;
@ -479,10 +479,10 @@ static int hostap_set_encryption(PSDevice pDevice,
param->u.crypt.err = 0; param->u.crypt.err = 0;
/* /*
if (param_len != if (param_len !=
(int) ((char *) param->u.crypt.key - (char *) param) + (int) ((char *) param->u.crypt.key - (char *) param) +
param->u.crypt.key_len) param->u.crypt.key_len)
return -EINVAL; return -EINVAL;
*/ */
if (param->u.crypt.alg > WPA_ALG_CCMP) if (param->u.crypt.alg > WPA_ALG_CCMP)
@ -498,105 +498,105 @@ static int hostap_set_encryption(PSDevice pDevice,
if (is_broadcast_ether_addr(param->sta_addr)) { if (is_broadcast_ether_addr(param->sta_addr)) {
if (param->u.crypt.idx >= MAX_GROUP_KEY) if (param->u.crypt.idx >= MAX_GROUP_KEY)
return -EINVAL; return -EINVAL;
iNodeIndex = 0; iNodeIndex = 0;
} else { } else {
if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == false) { if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == false) {
param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n");
return -EINVAL; return -EINVAL;
} }
} }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: sta_index %d \n", iNodeIndex); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: sta_index %d \n", iNodeIndex);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d \n", param->u.crypt.alg); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d \n", param->u.crypt.alg);
if (param->u.crypt.alg == WPA_ALG_NONE) { if (param->u.crypt.alg == WPA_ALG_NONE) {
if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly == true) { if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly == true) {
if (KeybRemoveKey(&(pDevice->sKey), if (KeybRemoveKey(&(pDevice->sKey),
param->sta_addr, param->sta_addr,
pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex, pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex,
pDevice->PortOffset) == false) { pDevice->PortOffset) == false) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail \n");
} }
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false;
} }
pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = 0; pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = 0;
pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = 0; pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = 0;
pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = 0; pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = 0;
pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = 0; pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = 0;
pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0; pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0;
pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0; pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0;
pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = 0; pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = 0;
memset(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], memset(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0],
0, 0,
MAX_KEY_LEN MAX_KEY_LEN
); );
return ret; return ret;
} }
memcpy(abyKey, param->u.crypt.key, param->u.crypt.key_len); memcpy(abyKey, param->u.crypt.key, param->u.crypt.key_len);
// copy to node key tbl // copy to node key tbl
pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = param->u.crypt.idx; pMgmt->sNodeDBTable[iNodeIndex].byKeyIndex = param->u.crypt.idx;
pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = param->u.crypt.key_len; pMgmt->sNodeDBTable[iNodeIndex].uWepKeyLength = param->u.crypt.key_len;
memcpy(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], memcpy(&pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0],
param->u.crypt.key, param->u.crypt.key,
param->u.crypt.key_len param->u.crypt.key_len
); );
dwKeyIndex = (unsigned long)(param->u.crypt.idx); dwKeyIndex = (unsigned long)(param->u.crypt.idx);
if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) { if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) {
pDevice->byKeyIndex = (unsigned char)dwKeyIndex; pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
pDevice->bTransmitKey = true; pDevice->bTransmitKey = true;
dwKeyIndex |= (1 << 31); dwKeyIndex |= (1 << 31);
} }
if (param->u.crypt.alg == WPA_ALG_WEP) { if (param->u.crypt.alg == WPA_ALG_WEP) {
if ((pDevice->bEnable8021x == false) || (iNodeIndex == 0)) { if ((pDevice->bEnable8021x == false) || (iNodeIndex == 0)) {
KeybSetDefaultKey(&(pDevice->sKey), KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex & ~(BIT30 | USE_KEYRSC), dwKeyIndex & ~(BIT30 | USE_KEYRSC),
param->u.crypt.key_len, param->u.crypt.key_len,
NULL, NULL,
abyKey, abyKey,
KEY_CTL_WEP, KEY_CTL_WEP,
pDevice->PortOffset, pDevice->PortOffset,
pDevice->byLocalID); pDevice->byLocalID);
} else { } else {
// 8021x enable, individual key // 8021x enable, individual key
dwKeyIndex |= (1 << 30); // set pairwise key dwKeyIndex |= (1 << 30); // set pairwise key
if (KeybSetKey(&(pDevice->sKey), if (KeybSetKey(&(pDevice->sKey),
&param->sta_addr[0], &param->sta_addr[0],
dwKeyIndex & ~(USE_KEYRSC), dwKeyIndex & ~(USE_KEYRSC),
param->u.crypt.key_len, param->u.crypt.key_len,
(PQWORD) &(KeyRSC), (PQWORD) &(KeyRSC),
(unsigned char *)abyKey, (unsigned char *)abyKey,
KEY_CTL_WEP, KEY_CTL_WEP,
pDevice->PortOffset, pDevice->PortOffset,
pDevice->byLocalID) == true) { pDevice->byLocalID) == true) {
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true;
} else { } else {
// Key Table Full // Key Table Full
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false;
bKeyTableFull = true; bKeyTableFull = true;
} }
} }
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
pDevice->bEncryptionEnable = true; pDevice->bEncryptionEnable = true;
pMgmt->byCSSPK = KEY_CTL_WEP; pMgmt->byCSSPK = KEY_CTL_WEP;
pMgmt->byCSSGK = KEY_CTL_WEP; pMgmt->byCSSGK = KEY_CTL_WEP;
pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = KEY_CTL_WEP; pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = KEY_CTL_WEP;
pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex;
return ret; return ret;
} }
if (param->u.crypt.seq) { if (param->u.crypt.seq) {
memcpy(&abySeq, param->u.crypt.seq, 8); memcpy(&abySeq, param->u.crypt.seq, 8);
for (ii = 0 ; ii < 8 ; ii++) for (ii = 0; ii < 8; ii++)
KeyRSC |= (unsigned long)abySeq[ii] << (ii * 8); KeyRSC |= (unsigned long)abySeq[ii] << (ii * 8);
dwKeyIndex |= 1 << 29; dwKeyIndex |= 1 << 29;
@ -604,85 +604,85 @@ static int hostap_set_encryption(PSDevice pDevice,
} }
if (param->u.crypt.alg == WPA_ALG_TKIP) { if (param->u.crypt.alg == WPA_ALG_TKIP) {
if (param->u.crypt.key_len != MAX_KEY_LEN) if (param->u.crypt.key_len != MAX_KEY_LEN)
return -EINVAL; return -EINVAL;
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
byKeyDecMode = KEY_CTL_TKIP; byKeyDecMode = KEY_CTL_TKIP;
pMgmt->byCSSPK = KEY_CTL_TKIP; pMgmt->byCSSPK = KEY_CTL_TKIP;
pMgmt->byCSSGK = KEY_CTL_TKIP; pMgmt->byCSSGK = KEY_CTL_TKIP;
} }
if (param->u.crypt.alg == WPA_ALG_CCMP) { if (param->u.crypt.alg == WPA_ALG_CCMP) {
if ((param->u.crypt.key_len != AES_KEY_LEN) || if ((param->u.crypt.key_len != AES_KEY_LEN) ||
(pDevice->byLocalID <= REV_ID_VT3253_A1)) (pDevice->byLocalID <= REV_ID_VT3253_A1))
return -EINVAL; return -EINVAL;
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
byKeyDecMode = KEY_CTL_CCMP; byKeyDecMode = KEY_CTL_CCMP;
pMgmt->byCSSPK = KEY_CTL_CCMP; pMgmt->byCSSPK = KEY_CTL_CCMP;
pMgmt->byCSSGK = KEY_CTL_CCMP; pMgmt->byCSSGK = KEY_CTL_CCMP;
} }
if (iNodeIndex == 0) { if (iNodeIndex == 0) {
KeybSetDefaultKey(&(pDevice->sKey), KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex, dwKeyIndex,
param->u.crypt.key_len, param->u.crypt.key_len,
(PQWORD) &(KeyRSC), (PQWORD) &(KeyRSC),
abyKey, abyKey,
byKeyDecMode, byKeyDecMode,
pDevice->PortOffset, pDevice->PortOffset,
pDevice->byLocalID); pDevice->byLocalID);
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true;
} else { } else {
dwKeyIndex |= (1 << 30); // set pairwise key dwKeyIndex |= (1 << 30); // set pairwise key
if (KeybSetKey(&(pDevice->sKey), if (KeybSetKey(&(pDevice->sKey),
&param->sta_addr[0], &param->sta_addr[0],
dwKeyIndex, dwKeyIndex,
param->u.crypt.key_len, param->u.crypt.key_len,
(PQWORD) &(KeyRSC), (PQWORD) &(KeyRSC),
(unsigned char *)abyKey, (unsigned char *)abyKey,
byKeyDecMode, byKeyDecMode,
pDevice->PortOffset, pDevice->PortOffset,
pDevice->byLocalID) == true) { pDevice->byLocalID) == true) {
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true;
} else { } else {
// Key Table Full // Key Table Full
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false;
bKeyTableFull = true; bKeyTableFull = true;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Key Table Full\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Key Table Full\n");
} }
} }
if (bKeyTableFull == true) { if (bKeyTableFull == true) {
wKeyCtl &= 0x7F00; // clear all key control filed wKeyCtl &= 0x7F00; // clear all key control filed
wKeyCtl |= (byKeyDecMode << 4); wKeyCtl |= (byKeyDecMode << 4);
wKeyCtl |= (byKeyDecMode); wKeyCtl |= (byKeyDecMode);
wKeyCtl |= 0x0044; // use group key for all address wKeyCtl |= 0x0044; // use group key for all address
wKeyCtl |= 0x4000; // disable KeyTable[MAX_KEY_TABLE-1] on-fly to genernate rx int wKeyCtl |= 0x4000; // disable KeyTable[MAX_KEY_TABLE-1] on-fly to genernate rx int
MACvSetDefaultKeyCtl(pDevice->PortOffset, wKeyCtl, MAX_KEY_TABLE-1, pDevice->byLocalID); MACvSetDefaultKeyCtl(pDevice->PortOffset, wKeyCtl, MAX_KEY_TABLE-1, pDevice->byLocalID);
} }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set key sta_index= %d \n", iNodeIndex); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set key sta_index= %d \n", iNodeIndex);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " tx_index=%d len=%d \n", param->u.crypt.idx, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " tx_index=%d len=%d \n", param->u.crypt.idx,
param->u.crypt.key_len ); param->u.crypt.key_len);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n",
pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0],
pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1], pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1],
pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2], pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2],
pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[3], pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[3],
pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[4] pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[4]
); );
// set wep key // set wep key
pDevice->bEncryptionEnable = true; pDevice->bEncryptionEnable = true;
pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = byKeyDecMode; pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = byKeyDecMode;
pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex;
pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0; pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0;
pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0; pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0;
return ret; return ret;
} }
@ -703,31 +703,31 @@ static int hostap_set_encryption(PSDevice pDevice,
* *
*/ */
static int hostap_get_encryption(PSDevice pDevice, static int hostap_get_encryption(PSDevice pDevice,
struct viawget_hostapd_param *param, struct viawget_hostapd_param *param,
int param_len) int param_len)
{ {
PSMgmtObject pMgmt = pDevice->pMgmt; PSMgmtObject pMgmt = pDevice->pMgmt;
int ret = 0; int ret = 0;
int ii; int ii;
int iNodeIndex =0; int iNodeIndex = 0;
param->u.crypt.err = 0; param->u.crypt.err = 0;
if (is_broadcast_ether_addr(param->sta_addr)) { if (is_broadcast_ether_addr(param->sta_addr)) {
iNodeIndex = 0; iNodeIndex = 0;
} else { } else {
if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == false) { if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == false) {
param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n");
return -EINVAL; return -EINVAL;
} }
} }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: %d\n", iNodeIndex); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: %d\n", iNodeIndex);
memset(param->u.crypt.seq, 0, 8); memset(param->u.crypt.seq, 0, 8);
for (ii = 0 ; ii < 8 ; ii++) { for (ii = 0; ii < 8; ii++) {
param->u.crypt.seq[ii] = (unsigned char)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8); param->u.crypt.seq[ii] = (unsigned char)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8);
} }
return ret; return ret;
} }
@ -768,75 +768,75 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
switch (param->cmd) { switch (param->cmd) {
case VIAWGET_HOSTAPD_SET_ENCRYPTION: case VIAWGET_HOSTAPD_SET_ENCRYPTION:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ENCRYPTION \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ENCRYPTION \n");
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
ret = hostap_set_encryption(pDevice, param, p->length); ret = hostap_set_encryption(pDevice, param, p->length);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
break; break;
case VIAWGET_HOSTAPD_GET_ENCRYPTION: case VIAWGET_HOSTAPD_GET_ENCRYPTION:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_ENCRYPTION \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_ENCRYPTION \n");
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
ret = hostap_get_encryption(pDevice, param, p->length); ret = hostap_get_encryption(pDevice, param, p->length);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
break; break;
case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR: case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR \n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
break; break;
case VIAWGET_HOSTAPD_FLUSH: case VIAWGET_HOSTAPD_FLUSH:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH \n");
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
hostap_flush_sta(pDevice); hostap_flush_sta(pDevice);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
break; break;
case VIAWGET_HOSTAPD_ADD_STA: case VIAWGET_HOSTAPD_ADD_STA:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_ADD_STA \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_ADD_STA \n");
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
ret = hostap_add_sta(pDevice, param); ret = hostap_add_sta(pDevice, param);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
break; break;
case VIAWGET_HOSTAPD_REMOVE_STA: case VIAWGET_HOSTAPD_REMOVE_STA:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_REMOVE_STA \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_REMOVE_STA \n");
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
ret = hostap_remove_sta(pDevice, param); ret = hostap_remove_sta(pDevice, param);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
break; break;
case VIAWGET_HOSTAPD_GET_INFO_STA: case VIAWGET_HOSTAPD_GET_INFO_STA:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_INFO_STA \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_INFO_STA \n");
ret = hostap_get_info_sta(pDevice, param); ret = hostap_get_info_sta(pDevice, param);
ap_ioctl = 1; ap_ioctl = 1;
break; break;
/* /*
case VIAWGET_HOSTAPD_RESET_TXEXC_STA: case VIAWGET_HOSTAPD_RESET_TXEXC_STA:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_RESET_TXEXC_STA \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_RESET_TXEXC_STA \n");
ret = hostap_reset_txexc_sta(pDevice, param); ret = hostap_reset_txexc_sta(pDevice, param);
break; break;
*/ */
case VIAWGET_HOSTAPD_SET_FLAGS_STA: case VIAWGET_HOSTAPD_SET_FLAGS_STA:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n");
ret = hostap_set_flags_sta(pDevice, param); ret = hostap_set_flags_sta(pDevice, param);
break; break;
case VIAWGET_HOSTAPD_MLME: case VIAWGET_HOSTAPD_MLME:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME \n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT: case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n");
ret = hostap_set_generic_element(pDevice, param); ret = hostap_set_generic_element(pDevice, param);
break; break;
case VIAWGET_HOSTAPD_SCAN_REQ: case VIAWGET_HOSTAPD_SCAN_REQ:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ \n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
case VIAWGET_HOSTAPD_STA_CLEAR_STATS: case VIAWGET_HOSTAPD_STA_CLEAR_STATS:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS \n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
default: default:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6655_hostap_ioctl: unknown cmd=%d\n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6655_hostap_ioctl: unknown cmd=%d\n",
(int)param->cmd); (int)param->cmd);
return -EOPNOTSUPP; return -EOPNOTSUPP;
break; break;
} }
@ -849,7 +849,7 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
} }
} }
out: out:
kfree(param); kfree(param);
return ret; return ret;