Skip to content

Commit

Permalink
Fix authenticaiton behavior for AP and STA mode
Browse files Browse the repository at this point in the history
  • Loading branch information
skritchz committed Feb 17, 2013
1 parent 6e5d883 commit fdcfc00
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 22 deletions.
18 changes: 11 additions & 7 deletions drivers/ar6000/os/linux/ar6000_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// <copyright file="ar6000_drv.c" company="Atheros">
// Copyright (c) 2004-2009 Atheros Corporation. All rights reserved.
// Copyright (C) 2010 Sony Ericsson Mobile Communications AB
//
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
Expand Down Expand Up @@ -1600,7 +1600,7 @@ static void ar6000_enable_mmchost_detect_change(int enable)
char buf[3];
int length;
length = snprintf(buf, sizeof(buf), "%d\n", enable ? 1 : 0);
if (ar6000_readwrite_file("/sys/devices/platform/" MMC_MSM_DEV "/detect_change",
if (ar6000_readwrite_file("/sys/devices/platform/" MMC_MSM_DEV "/detect_change",
NULL, buf, length) < 0) {
/* fall back to polling */
ar6000_readwrite_file("/sys/devices/platform/" MMC_MSM_DEV "/polling", NULL, buf, length);
Expand Down Expand Up @@ -2503,6 +2503,7 @@ void ar6000_init_profile_info(AR_SOFTC_T *ar)
ar->arDot11AuthMode = OPEN_AUTH;
ar->arAuthMode = NONE_AUTH;
ar->arPairwiseCrypto = NONE_CRYPT;
//ar->arPairwiseApCrypto = NONE_CRYPT;
ar->arPairwiseCryptoLen = 0;
ar->arGroupCrypto = NONE_CRYPT;
ar->arGroupCryptoLen = 0;
Expand Down Expand Up @@ -4315,7 +4316,7 @@ ar6000_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, A_UINT8 *bssid,

if (NO_NETWORK_AVAIL != reason)
{
union iwreq_data wrqu;
union iwreq_data wrqu;
A_MEMZERO(&wrqu, sizeof(wrqu));
A_MEMCPY(wrqu.addr.sa_data, "\x00\x00\x00\x00\x00\x00", IEEE80211_ADDR_LEN);
wrqu.addr.sa_family = ARPHRD_ETHER;
Expand Down Expand Up @@ -5409,6 +5410,9 @@ ar6000_ap_mode_profile_commit(struct ar6_softc *ar)
return -ECHRNG;
}

//Force change to use arPairwiseApCrypto.
//ar->arPairwiseCrypto = ar->arPairwiseApCrypto;

if(ar->arPairwiseCrypto != ar->arGroupCrypto) {
A_PRINTF("Mixed cipher not supported in AP mode\n");
return -EOPNOTSUPP;
Expand Down Expand Up @@ -5502,7 +5506,7 @@ ar6000_connect_to_ap(struct ar6_softc *ar)
*/
if((ar->arWmiReady == TRUE) && (ar->arSsidLen > 0) && ar->arNetworkType!=AP_NETWORK)
{
A_STATUS status;
A_STATUS status;
if((ADHOC_NETWORK != ar->arNetworkType) &&
(NONE_AUTH==ar->arAuthMode) &&
(WEP_CRYPT==ar->arPairwiseCrypto)) {
Expand Down Expand Up @@ -5532,7 +5536,7 @@ ar6000_connect_to_ap(struct ar6_softc *ar)
if ((ar->arNetworkType == INFRA_NETWORK)) {
wmi_listeninterval_cmd(ar->arWmi, 1000, 0);
}

ar->arConnectPending = TRUE;

ar->wmm_vi_throttle_flag = 0;
Expand All @@ -5552,8 +5556,8 @@ ar6000_connect_to_ap(struct ar6_softc *ar)
}

ar->arPrevCrypto = ar->arPairwiseCrypto;
return status;

return status;
}
return A_ERROR;
}
Expand Down
12 changes: 11 additions & 1 deletion drivers/ar6000/os/linux/include/ar6000_drv.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <copyright file="ar6000_drv.h" company="Atheros">
// Copyright (c) 2004-2009 Atheros Corporation. All rights reserved.
//
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
Expand Down Expand Up @@ -259,6 +259,16 @@ typedef struct ar6_softc {
A_UINT8 arPrevCrypto;
A_UINT8 arPairwiseCrypto;
A_UINT8 arPairwiseCryptoLen;
#if 0
//Add field for the AP mode, we need to store some specific information
//But we don't know yet if we are in AP or STA mode at this time
A_UINT8 arPairwiseApCrypto;
//Add some padding in order to keep structure alignment
A_UINT8 padding1;
A_UINT8 padding2;
A_UINT8 padding4;
//Finished AP mode specific padding
#endif
A_UINT8 arGroupCrypto;
A_UINT8 arGroupCryptoLen;
A_UINT8 arDefTxKeyIndex;
Expand Down
50 changes: 36 additions & 14 deletions drivers/ar6000/os/linux/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// <copyright file="ioctl.c" company="Atheros">
// Copyright (c) 2004-2009 Atheros Corporation. All rights reserved.
// Copyright (C) 2010 Sony Ericsson Mobile Communications AB
//
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
Expand Down Expand Up @@ -1194,23 +1194,45 @@ ar6000_ioctl_setparam(AR_SOFTC_T *ar, int param, int value)
}
break;
case IEEE80211_PARAM_UCASTCIPHER:
switch (value) {
case IEEE80211_CIPHER_AES_CCM:
/*
* SCRITCH FIX for HOSTAPD
* Ok so now we need to convert the way hostapd works into expected behavior
*/

if (ar->arNextMode == AP_NETWORK)
{
pr_info("Setting Pairwise Crypto for AP mode");
if (value & (1 << IEEE80211_CIPHER_AES_CCM) )
{
ar->arPairwiseCrypto = AES_CRYPT;
profChanged = TRUE;
break;
case IEEE80211_CIPHER_TKIP:
} else if( value & (1 << IEEE80211_CIPHER_TKIP)){
ar->arPairwiseCrypto = TKIP_CRYPT;
profChanged = TRUE;
break;
case IEEE80211_CIPHER_WEP:
} else if (value & (1 << IEEE80211_CIPHER_WEP))
{
ar->arPairwiseCrypto = WEP_CRYPT;
profChanged = TRUE;
break;
case IEEE80211_CIPHER_NONE:
}else{
ar->arPairwiseCrypto = NONE_CRYPT;
profChanged = TRUE;
break;
}
}else{
pr_info("Setting Pairwise Crypto for STA mode");
switch (value) {
case IEEE80211_CIPHER_AES_CCM:
ar->arPairwiseCrypto = AES_CRYPT;
profChanged = TRUE;
break;
case IEEE80211_CIPHER_TKIP:
ar->arPairwiseCrypto = TKIP_CRYPT;
profChanged = TRUE;
break;
case IEEE80211_CIPHER_WEP:
ar->arPairwiseCrypto = WEP_CRYPT;
profChanged = TRUE;
break;
case IEEE80211_CIPHER_NONE:
ar->arPairwiseCrypto = NONE_CRYPT;
profChanged = TRUE;
break;
}
}
break;
case IEEE80211_PARAM_UCASTKEYLEN:
Expand Down

0 comments on commit fdcfc00

Please sign in to comment.