dect
/
linux-2.6
Archived
13
0
Fork 0

ath6kl: Move ssid and crypto information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
Vasanthakumar Thiagarajan 2011-10-25 19:34:02 +05:30 committed by Kalle Valo
parent 59c98449b8
commit 3450334f39
4 changed files with 124 additions and 100 deletions

View File

@ -126,14 +126,17 @@ static struct ieee80211_supported_band ath6kl_band_5ghz = {
static int ath6kl_set_wpa_version(struct ath6kl *ar, static int ath6kl_set_wpa_version(struct ath6kl *ar,
enum nl80211_wpa_versions wpa_version) enum nl80211_wpa_versions wpa_version)
{ {
/* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: %u\n", __func__, wpa_version); ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: %u\n", __func__, wpa_version);
if (!wpa_version) { if (!wpa_version) {
ar->auth_mode = NONE_AUTH; vif->auth_mode = NONE_AUTH;
} else if (wpa_version & NL80211_WPA_VERSION_2) { } else if (wpa_version & NL80211_WPA_VERSION_2) {
ar->auth_mode = WPA2_AUTH; vif->auth_mode = WPA2_AUTH;
} else if (wpa_version & NL80211_WPA_VERSION_1) { } else if (wpa_version & NL80211_WPA_VERSION_1) {
ar->auth_mode = WPA_AUTH; vif->auth_mode = WPA_AUTH;
} else { } else {
ath6kl_err("%s: %u not supported\n", __func__, wpa_version); ath6kl_err("%s: %u not supported\n", __func__, wpa_version);
return -ENOTSUPP; return -ENOTSUPP;
@ -145,22 +148,24 @@ static int ath6kl_set_wpa_version(struct ath6kl *ar,
static int ath6kl_set_auth_type(struct ath6kl *ar, static int ath6kl_set_auth_type(struct ath6kl *ar,
enum nl80211_auth_type auth_type) enum nl80211_auth_type auth_type)
{ {
/* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: 0x%x\n", __func__, auth_type); ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: 0x%x\n", __func__, auth_type);
switch (auth_type) { switch (auth_type) {
case NL80211_AUTHTYPE_OPEN_SYSTEM: case NL80211_AUTHTYPE_OPEN_SYSTEM:
ar->dot11_auth_mode = OPEN_AUTH; vif->dot11_auth_mode = OPEN_AUTH;
break; break;
case NL80211_AUTHTYPE_SHARED_KEY: case NL80211_AUTHTYPE_SHARED_KEY:
ar->dot11_auth_mode = SHARED_AUTH; vif->dot11_auth_mode = SHARED_AUTH;
break; break;
case NL80211_AUTHTYPE_NETWORK_EAP: case NL80211_AUTHTYPE_NETWORK_EAP:
ar->dot11_auth_mode = LEAP_AUTH; vif->dot11_auth_mode = LEAP_AUTH;
break; break;
case NL80211_AUTHTYPE_AUTOMATIC: case NL80211_AUTHTYPE_AUTOMATIC:
ar->dot11_auth_mode = OPEN_AUTH | SHARED_AUTH; vif->dot11_auth_mode = OPEN_AUTH | SHARED_AUTH;
break; break;
default: default:
@ -173,9 +178,12 @@ static int ath6kl_set_auth_type(struct ath6kl *ar,
static int ath6kl_set_cipher(struct ath6kl *ar, u32 cipher, bool ucast) static int ath6kl_set_cipher(struct ath6kl *ar, u32 cipher, bool ucast)
{ {
u8 *ar_cipher = ucast ? &ar->prwise_crypto : &ar->grp_crypto; /* TODO: Findout vif */
u8 *ar_cipher_len = ucast ? &ar->prwise_crypto_len : struct ath6kl_vif *vif = ar->vif;
&ar->grp_crypto_len;
u8 *ar_cipher = ucast ? &vif->prwise_crypto : &vif->grp_crypto;
u8 *ar_cipher_len = ucast ? &vif->prwise_crypto_len :
&vif->grp_crypto_len;
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: cipher 0x%x, ucast %u\n", ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: cipher 0x%x, ucast %u\n",
__func__, cipher, ucast); __func__, cipher, ucast);
@ -212,20 +220,23 @@ static int ath6kl_set_cipher(struct ath6kl *ar, u32 cipher, bool ucast)
static void ath6kl_set_key_mgmt(struct ath6kl *ar, u32 key_mgmt) static void ath6kl_set_key_mgmt(struct ath6kl *ar, u32 key_mgmt)
{ {
/* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: 0x%x\n", __func__, key_mgmt); ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: 0x%x\n", __func__, key_mgmt);
if (key_mgmt == WLAN_AKM_SUITE_PSK) { if (key_mgmt == WLAN_AKM_SUITE_PSK) {
if (ar->auth_mode == WPA_AUTH) if (vif->auth_mode == WPA_AUTH)
ar->auth_mode = WPA_PSK_AUTH; vif->auth_mode = WPA_PSK_AUTH;
else if (ar->auth_mode == WPA2_AUTH) else if (vif->auth_mode == WPA2_AUTH)
ar->auth_mode = WPA2_PSK_AUTH; vif->auth_mode = WPA2_PSK_AUTH;
} else if (key_mgmt == 0x00409600) { } else if (key_mgmt == 0x00409600) {
if (ar->auth_mode == WPA_AUTH) if (vif->auth_mode == WPA_AUTH)
ar->auth_mode = WPA_AUTH_CCKM; vif->auth_mode = WPA_AUTH_CCKM;
else if (ar->auth_mode == WPA2_AUTH) else if (vif->auth_mode == WPA2_AUTH)
ar->auth_mode = WPA2_AUTH_CCKM; vif->auth_mode = WPA2_AUTH_CCKM;
} else if (key_mgmt != WLAN_AKM_SUITE_8021X) { } else if (key_mgmt != WLAN_AKM_SUITE_8021X) {
ar->auth_mode = NONE_AUTH; vif->auth_mode = NONE_AUTH;
} }
} }
@ -349,8 +360,8 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
} }
if (test_bit(CONNECTED, &vif->flags) && if (test_bit(CONNECTED, &vif->flags) &&
ar->ssid_len == sme->ssid_len && vif->ssid_len == sme->ssid_len &&
!memcmp(ar->ssid, sme->ssid, ar->ssid_len)) { !memcmp(vif->ssid, sme->ssid, vif->ssid_len)) {
ar->reconnect_flag = true; ar->reconnect_flag = true;
status = ath6kl_wmi_reconnect_cmd(ar->wmi, ar->req_bssid, status = ath6kl_wmi_reconnect_cmd(ar->wmi, ar->req_bssid,
ar->ch_hint); ar->ch_hint);
@ -361,14 +372,14 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
return -EIO; return -EIO;
} }
return 0; return 0;
} else if (ar->ssid_len == sme->ssid_len && } else if (vif->ssid_len == sme->ssid_len &&
!memcmp(ar->ssid, sme->ssid, ar->ssid_len)) { !memcmp(vif->ssid, sme->ssid, vif->ssid_len)) {
ath6kl_disconnect(ar); ath6kl_disconnect(ar);
} }
memset(ar->ssid, 0, sizeof(ar->ssid)); memset(vif->ssid, 0, sizeof(vif->ssid));
ar->ssid_len = sme->ssid_len; vif->ssid_len = sme->ssid_len;
memcpy(ar->ssid, sme->ssid, sme->ssid_len); memcpy(vif->ssid, sme->ssid, sme->ssid_len);
if (sme->channel) if (sme->channel)
ar->ch_hint = sme->channel->center_freq; ar->ch_hint = sme->channel->center_freq;
@ -396,7 +407,8 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
ath6kl_set_key_mgmt(ar, sme->crypto.akm_suites[0]); ath6kl_set_key_mgmt(ar, sme->crypto.akm_suites[0]);
if ((sme->key_len) && if ((sme->key_len) &&
(ar->auth_mode == NONE_AUTH) && (ar->prwise_crypto == WEP_CRYPT)) { (vif->auth_mode == NONE_AUTH) &&
(vif->prwise_crypto == WEP_CRYPT)) {
struct ath6kl_key *key = NULL; struct ath6kl_key *key = NULL;
if (sme->key_idx < WMI_MIN_KEY_INDEX || if (sme->key_idx < WMI_MIN_KEY_INDEX ||
@ -410,11 +422,11 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
key = &ar->keys[sme->key_idx]; key = &ar->keys[sme->key_idx];
key->key_len = sme->key_len; key->key_len = sme->key_len;
memcpy(key->key, sme->key, key->key_len); memcpy(key->key, sme->key, key->key_len);
key->cipher = ar->prwise_crypto; key->cipher = vif->prwise_crypto;
ar->def_txkey_index = sme->key_idx; vif->def_txkey_index = sme->key_idx;
ath6kl_wmi_addkey_cmd(ar->wmi, sme->key_idx, ath6kl_wmi_addkey_cmd(ar->wmi, sme->key_idx,
ar->prwise_crypto, vif->prwise_crypto,
GROUP_USAGE | TX_USAGE, GROUP_USAGE | TX_USAGE,
key->key_len, key->key_len,
NULL, NULL,
@ -438,25 +450,25 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
" PW crypto %d PW crypto len %d GRP crypto %d" " PW crypto %d PW crypto len %d GRP crypto %d"
" GRP crypto len %d channel hint %u\n", " GRP crypto len %d channel hint %u\n",
__func__, __func__,
ar->auth_mode, ar->dot11_auth_mode, ar->prwise_crypto, vif->auth_mode, vif->dot11_auth_mode, vif->prwise_crypto,
ar->prwise_crypto_len, ar->grp_crypto, vif->prwise_crypto_len, vif->grp_crypto,
ar->grp_crypto_len, ar->ch_hint); vif->grp_crypto_len, ar->ch_hint);
ar->reconnect_flag = 0; ar->reconnect_flag = 0;
status = ath6kl_wmi_connect_cmd(ar->wmi, ar->nw_type, status = ath6kl_wmi_connect_cmd(ar->wmi, ar->nw_type,
ar->dot11_auth_mode, ar->auth_mode, vif->dot11_auth_mode, vif->auth_mode,
ar->prwise_crypto, vif->prwise_crypto,
ar->prwise_crypto_len, vif->prwise_crypto_len,
ar->grp_crypto, ar->grp_crypto_len, vif->grp_crypto, vif->grp_crypto_len,
ar->ssid_len, ar->ssid, vif->ssid_len, vif->ssid,
ar->req_bssid, ar->ch_hint, ar->req_bssid, ar->ch_hint,
ar->connect_ctrl_flags); ar->connect_ctrl_flags);
up(&ar->sem); up(&ar->sem);
if (status == -EINVAL) { if (status == -EINVAL) {
memset(ar->ssid, 0, sizeof(ar->ssid)); memset(vif->ssid, 0, sizeof(vif->ssid));
ar->ssid_len = 0; vif->ssid_len = 0;
ath6kl_err("invalid request\n"); ath6kl_err("invalid request\n");
return -ENOENT; return -ENOENT;
} else if (status) { } else if (status) {
@ -465,8 +477,8 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
} }
if ((!(ar->connect_ctrl_flags & CONNECT_DO_WPA_OFFLOAD)) && if ((!(ar->connect_ctrl_flags & CONNECT_DO_WPA_OFFLOAD)) &&
((ar->auth_mode == WPA_PSK_AUTH) ((vif->auth_mode == WPA_PSK_AUTH)
|| (ar->auth_mode == WPA2_PSK_AUTH))) { || (vif->auth_mode == WPA2_PSK_AUTH))) {
mod_timer(&ar->disconnect_timer, mod_timer(&ar->disconnect_timer,
jiffies + msecs_to_jiffies(DISCON_TIMER_INTVAL)); jiffies + msecs_to_jiffies(DISCON_TIMER_INTVAL));
} }
@ -481,11 +493,13 @@ static int ath6kl_add_bss_if_needed(struct ath6kl *ar, const u8 *bssid,
struct ieee80211_channel *chan, struct ieee80211_channel *chan,
const u8 *beacon_ie, size_t beacon_ie_len) const u8 *beacon_ie, size_t beacon_ie_len)
{ {
/* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
struct cfg80211_bss *bss; struct cfg80211_bss *bss;
u8 *ie; u8 *ie;
bss = cfg80211_get_bss(ar->wiphy, chan, bssid, bss = cfg80211_get_bss(ar->wiphy, chan, bssid,
ar->ssid, ar->ssid_len, WLAN_CAPABILITY_ESS, vif->ssid, vif->ssid_len, WLAN_CAPABILITY_ESS,
WLAN_CAPABILITY_ESS); WLAN_CAPABILITY_ESS);
if (bss == NULL) { if (bss == NULL) {
/* /*
@ -496,16 +510,16 @@ static int ath6kl_add_bss_if_needed(struct ath6kl *ar, const u8 *bssid,
* Prepend SSID element since it is not included in the Beacon * Prepend SSID element since it is not included in the Beacon
* IEs from the target. * IEs from the target.
*/ */
ie = kmalloc(2 + ar->ssid_len + beacon_ie_len, GFP_KERNEL); ie = kmalloc(2 + vif->ssid_len + beacon_ie_len, GFP_KERNEL);
if (ie == NULL) if (ie == NULL)
return -ENOMEM; return -ENOMEM;
ie[0] = WLAN_EID_SSID; ie[0] = WLAN_EID_SSID;
ie[1] = ar->ssid_len; ie[1] = vif->ssid_len;
memcpy(ie + 2, ar->ssid, ar->ssid_len); memcpy(ie + 2, vif->ssid, vif->ssid_len);
memcpy(ie + 2 + ar->ssid_len, beacon_ie, beacon_ie_len); memcpy(ie + 2 + vif->ssid_len, beacon_ie, beacon_ie_len);
bss = cfg80211_inform_bss(ar->wiphy, chan, bss = cfg80211_inform_bss(ar->wiphy, chan,
bssid, 0, WLAN_CAPABILITY_ESS, 100, bssid, 0, WLAN_CAPABILITY_ESS, 100,
ie, 2 + ar->ssid_len + beacon_ie_len, ie, 2 + vif->ssid_len + beacon_ie_len,
0, GFP_KERNEL); 0, GFP_KERNEL);
if (bss) if (bss)
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "added dummy bss for " ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "added dummy bss for "
@ -606,6 +620,7 @@ static int ath6kl_cfg80211_disconnect(struct wiphy *wiphy,
struct net_device *dev, u16 reason_code) struct net_device *dev, u16 reason_code)
{ {
struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(dev); struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(dev);
struct ath6kl_vif *vif = netdev_priv(dev);
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: reason=%u\n", __func__, ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: reason=%u\n", __func__,
reason_code); reason_code);
@ -625,8 +640,8 @@ static int ath6kl_cfg80211_disconnect(struct wiphy *wiphy,
ar->reconnect_flag = 0; ar->reconnect_flag = 0;
ath6kl_disconnect(ar); ath6kl_disconnect(ar);
memset(ar->ssid, 0, sizeof(ar->ssid)); memset(vif->ssid, 0, sizeof(vif->ssid));
ar->ssid_len = 0; vif->ssid_len = 0;
if (!test_bit(SKIP_SCAN, &ar->flag)) if (!test_bit(SKIP_SCAN, &ar->flag))
memset(ar->req_bssid, 0, sizeof(ar->req_bssid)); memset(ar->req_bssid, 0, sizeof(ar->req_bssid));
@ -879,8 +894,8 @@ static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
return -ENOTSUPP; return -ENOTSUPP;
} }
if (((ar->auth_mode == WPA_PSK_AUTH) if (((vif->auth_mode == WPA_PSK_AUTH)
|| (ar->auth_mode == WPA2_PSK_AUTH)) || (vif->auth_mode == WPA2_PSK_AUTH))
&& (key_usage & GROUP_USAGE)) && (key_usage & GROUP_USAGE))
del_timer(&ar->disconnect_timer); del_timer(&ar->disconnect_timer);
@ -889,7 +904,7 @@ static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
__func__, key_index, key->key_len, key_type, __func__, key_index, key->key_len, key_type,
key_usage, key->seq_len); key_usage, key->seq_len);
ar->def_txkey_index = key_index; vif->def_txkey_index = key_index;
if (ar->nw_type == AP_NETWORK && !pairwise && if (ar->nw_type == AP_NETWORK && !pairwise &&
(key_type == TKIP_CRYPT || key_type == AES_CRYPT) && params) { (key_type == TKIP_CRYPT || key_type == AES_CRYPT) && params) {
@ -924,7 +939,7 @@ static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
return 0; return 0;
} }
status = ath6kl_wmi_addkey_cmd(ar->wmi, ar->def_txkey_index, status = ath6kl_wmi_addkey_cmd(ar->wmi, vif->def_txkey_index,
key_type, key_usage, key->key_len, key_type, key_usage, key->key_len,
key->seq, key->key, KEY_OP_INIT_VAL, key->seq, key->key, KEY_OP_INIT_VAL,
(u8 *) mac_addr, SYNC_BOTH_WMIFLAG); (u8 *) mac_addr, SYNC_BOTH_WMIFLAG);
@ -1029,20 +1044,20 @@ static int ath6kl_cfg80211_set_default_key(struct wiphy *wiphy,
return -EINVAL; return -EINVAL;
} }
ar->def_txkey_index = key_index; vif->def_txkey_index = key_index;
key = &ar->keys[ar->def_txkey_index]; key = &ar->keys[vif->def_txkey_index];
key_usage = GROUP_USAGE; key_usage = GROUP_USAGE;
if (ar->prwise_crypto == WEP_CRYPT) if (vif->prwise_crypto == WEP_CRYPT)
key_usage |= TX_USAGE; key_usage |= TX_USAGE;
if (unicast) if (unicast)
key_type = ar->prwise_crypto; key_type = vif->prwise_crypto;
if (multicast) if (multicast)
key_type = ar->grp_crypto; key_type = vif->grp_crypto;
if (ar->next_mode == AP_NETWORK && !test_bit(CONNECTED, &vif->flags)) if (ar->next_mode == AP_NETWORK && !test_bit(CONNECTED, &vif->flags))
return 0; /* Delay until AP mode has been started */ return 0; /* Delay until AP mode has been started */
status = ath6kl_wmi_addkey_cmd(ar->wmi, ar->def_txkey_index, status = ath6kl_wmi_addkey_cmd(ar->wmi, vif->def_txkey_index,
key_type, key_usage, key_type, key_usage,
key->key_len, key->seq, key->key, key->key_len, key->seq, key->key,
KEY_OP_INIT_VAL, NULL, KEY_OP_INIT_VAL, NULL,
@ -1229,8 +1244,8 @@ static int ath6kl_cfg80211_join_ibss(struct wiphy *wiphy,
if (!ath6kl_cfg80211_ready(ar)) if (!ath6kl_cfg80211_ready(ar))
return -EIO; return -EIO;
ar->ssid_len = ibss_param->ssid_len; vif->ssid_len = ibss_param->ssid_len;
memcpy(ar->ssid, ibss_param->ssid, ar->ssid_len); memcpy(vif->ssid, ibss_param->ssid, vif->ssid_len);
if (ibss_param->channel) if (ibss_param->channel)
ar->ch_hint = ibss_param->channel->center_freq; ar->ch_hint = ibss_param->channel->center_freq;
@ -1270,16 +1285,16 @@ static int ath6kl_cfg80211_join_ibss(struct wiphy *wiphy,
" PW crypto %d PW crypto len %d GRP crypto %d" " PW crypto %d PW crypto len %d GRP crypto %d"
" GRP crypto len %d channel hint %u\n", " GRP crypto len %d channel hint %u\n",
__func__, __func__,
ar->auth_mode, ar->dot11_auth_mode, ar->prwise_crypto, vif->auth_mode, vif->dot11_auth_mode, vif->prwise_crypto,
ar->prwise_crypto_len, ar->grp_crypto, vif->prwise_crypto_len, vif->grp_crypto,
ar->grp_crypto_len, ar->ch_hint); vif->grp_crypto_len, ar->ch_hint);
status = ath6kl_wmi_connect_cmd(ar->wmi, ar->nw_type, status = ath6kl_wmi_connect_cmd(ar->wmi, ar->nw_type,
ar->dot11_auth_mode, ar->auth_mode, vif->dot11_auth_mode, vif->auth_mode,
ar->prwise_crypto, vif->prwise_crypto,
ar->prwise_crypto_len, vif->prwise_crypto_len,
ar->grp_crypto, ar->grp_crypto_len, vif->grp_crypto, vif->grp_crypto_len,
ar->ssid_len, ar->ssid, vif->ssid_len, vif->ssid,
ar->req_bssid, ar->ch_hint, ar->req_bssid, ar->ch_hint,
ar->connect_ctrl_flags); ar->connect_ctrl_flags);
set_bit(CONNECT_PEND, &vif->flags); set_bit(CONNECT_PEND, &vif->flags);
@ -1291,13 +1306,14 @@ static int ath6kl_cfg80211_leave_ibss(struct wiphy *wiphy,
struct net_device *dev) struct net_device *dev)
{ {
struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(dev); struct ath6kl *ar = (struct ath6kl *)ath6kl_priv(dev);
struct ath6kl_vif *vif = netdev_priv(dev);
if (!ath6kl_cfg80211_ready(ar)) if (!ath6kl_cfg80211_ready(ar))
return -EIO; return -EIO;
ath6kl_disconnect(ar); ath6kl_disconnect(ar);
memset(ar->ssid, 0, sizeof(ar->ssid)); memset(vif->ssid, 0, sizeof(vif->ssid));
ar->ssid_len = 0; vif->ssid_len = 0;
return 0; return 0;
} }
@ -1575,6 +1591,7 @@ static int ath6kl_ap_beacon(struct wiphy *wiphy, struct net_device *dev,
struct beacon_parameters *info, bool add) struct beacon_parameters *info, bool add)
{ {
struct ath6kl *ar = ath6kl_priv(dev); struct ath6kl *ar = ath6kl_priv(dev);
struct ath6kl_vif *vif = netdev_priv(dev);
struct ieee80211_mgmt *mgmt; struct ieee80211_mgmt *mgmt;
u8 *ies; u8 *ies;
int ies_len; int ies_len;
@ -1631,12 +1648,12 @@ static int ath6kl_ap_beacon(struct wiphy *wiphy, struct net_device *dev,
if (info->ssid == NULL) if (info->ssid == NULL)
return -EINVAL; return -EINVAL;
memcpy(ar->ssid, info->ssid, info->ssid_len); memcpy(vif->ssid, info->ssid, info->ssid_len);
ar->ssid_len = info->ssid_len; vif->ssid_len = info->ssid_len;
if (info->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) if (info->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE)
return -EOPNOTSUPP; /* TODO */ return -EOPNOTSUPP; /* TODO */
ar->dot11_auth_mode = OPEN_AUTH; vif->dot11_auth_mode = OPEN_AUTH;
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));
@ -1658,7 +1675,7 @@ static int ath6kl_ap_beacon(struct wiphy *wiphy, struct net_device *dev,
} }
if (p.auth_mode == 0) if (p.auth_mode == 0)
p.auth_mode = NONE_AUTH; p.auth_mode = NONE_AUTH;
ar->auth_mode = p.auth_mode; vif->auth_mode = p.auth_mode;
for (i = 0; i < info->crypto.n_ciphers_pairwise; i++) { for (i = 0; i < info->crypto.n_ciphers_pairwise; i++) {
switch (info->crypto.ciphers_pairwise[i]) { switch (info->crypto.ciphers_pairwise[i]) {
@ -1700,9 +1717,9 @@ static int ath6kl_ap_beacon(struct wiphy *wiphy, struct net_device *dev,
p.nw_type = AP_NETWORK; p.nw_type = AP_NETWORK;
ar->nw_type = ar->next_mode; ar->nw_type = ar->next_mode;
p.ssid_len = ar->ssid_len; p.ssid_len = vif->ssid_len;
memcpy(p.ssid, ar->ssid, ar->ssid_len); memcpy(p.ssid, vif->ssid, vif->ssid_len);
p.dot11_auth_mode = ar->dot11_auth_mode; p.dot11_auth_mode = vif->dot11_auth_mode;
p.ch = cpu_to_le16(ar->next_chan); p.ch = cpu_to_le16(ar->next_chan);
res = ath6kl_wmi_ap_profile_commit(ar->wmi, &p); res = ath6kl_wmi_ap_profile_commit(ar->wmi, &p);

View File

@ -398,6 +398,15 @@ struct ath6kl_vif {
struct net_device *ndev; struct net_device *ndev;
struct ath6kl *ar; struct ath6kl *ar;
unsigned long flags; unsigned long flags;
int ssid_len;
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 dot11_auth_mode;
u8 auth_mode;
u8 prwise_crypto;
u8 prwise_crypto_len;
u8 grp_crypto;
u8 grp_crypto_len;
u8 def_txkey_index;
}; };
/* Flag info */ /* Flag info */
@ -426,17 +435,8 @@ struct ath6kl {
struct ath6kl_vif *vif; struct ath6kl_vif *vif;
spinlock_t lock; spinlock_t lock;
struct semaphore sem; struct semaphore sem;
int ssid_len;
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 next_mode; u8 next_mode;
u8 nw_type; u8 nw_type;
u8 dot11_auth_mode;
u8 auth_mode;
u8 prwise_crypto;
u8 prwise_crypto_len;
u8 grp_crypto;
u8 grp_crypto_len;
u8 def_txkey_index;
struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1]; struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1];
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
u8 req_bssid[ETH_ALEN]; u8 req_bssid[ETH_ALEN];

View File

@ -75,15 +75,18 @@ struct sk_buff *ath6kl_buf_alloc(int size)
void ath6kl_init_profile_info(struct ath6kl *ar) void ath6kl_init_profile_info(struct ath6kl *ar)
{ {
ar->ssid_len = 0; /* TODO: Findout vif */
memset(ar->ssid, 0, sizeof(ar->ssid)); struct ath6kl_vif *vif = ar->vif;
ar->dot11_auth_mode = OPEN_AUTH; vif->ssid_len = 0;
ar->auth_mode = NONE_AUTH; memset(vif->ssid, 0, sizeof(vif->ssid));
ar->prwise_crypto = NONE_CRYPT;
ar->prwise_crypto_len = 0; vif->dot11_auth_mode = OPEN_AUTH;
ar->grp_crypto = NONE_CRYPT; vif->auth_mode = NONE_AUTH;
ar->grp_crypto_len = 0; vif->prwise_crypto = NONE_CRYPT;
vif->prwise_crypto_len = 0;
vif->grp_crypto = NONE_CRYPT;
vif->grp_crypto_len = 0;
memset(ar->wep_key_list, 0, sizeof(ar->wep_key_list)); memset(ar->wep_key_list, 0, sizeof(ar->wep_key_list));
memset(ar->req_bssid, 0, sizeof(ar->req_bssid)); memset(ar->req_bssid, 0, sizeof(ar->req_bssid));
memset(ar->bssid, 0, sizeof(ar->bssid)); memset(ar->bssid, 0, sizeof(ar->bssid));
@ -245,8 +248,10 @@ static int ath6kl_init_service_ep(struct ath6kl *ar)
void ath6kl_init_control_info(struct ath6kl *ar) void ath6kl_init_control_info(struct ath6kl *ar)
{ {
struct ath6kl_vif *vif = ar->vif;
ath6kl_init_profile_info(ar); ath6kl_init_profile_info(ar);
ar->def_txkey_index = 0; vif->def_txkey_index = 0;
memset(ar->wep_key_list, 0, sizeof(ar->wep_key_list)); memset(ar->wep_key_list, 0, sizeof(ar->wep_key_list));
ar->ch_hint = 0; ar->ch_hint = 0;
} }

View File

@ -498,13 +498,15 @@ void ath6kl_stop_endpoint(struct net_device *dev, bool keep_profile,
static void ath6kl_install_static_wep_keys(struct ath6kl *ar) static void ath6kl_install_static_wep_keys(struct ath6kl *ar)
{ {
/* TODO: Findout vif */
struct ath6kl_vif *vif = ar->vif;
u8 index; u8 index;
u8 keyusage; u8 keyusage;
for (index = WMI_MIN_KEY_INDEX; index <= WMI_MAX_KEY_INDEX; index++) { for (index = WMI_MIN_KEY_INDEX; index <= WMI_MAX_KEY_INDEX; index++) {
if (ar->wep_key_list[index].key_len) { if (ar->wep_key_list[index].key_len) {
keyusage = GROUP_USAGE; keyusage = GROUP_USAGE;
if (index == ar->def_txkey_index) if (index == vif->def_txkey_index)
keyusage |= TX_USAGE; keyusage |= TX_USAGE;
ath6kl_wmi_addkey_cmd(ar->wmi, ath6kl_wmi_addkey_cmd(ar->wmi,
@ -532,9 +534,9 @@ void ath6kl_connect_ap_mode_bss(struct ath6kl *ar, u16 channel)
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "AP mode started on %u MHz\n", channel); ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "AP mode started on %u MHz\n", channel);
switch (ar->auth_mode) { switch (vif->auth_mode) {
case NONE_AUTH: case NONE_AUTH:
if (ar->prwise_crypto == WEP_CRYPT) if (vif->prwise_crypto == WEP_CRYPT)
ath6kl_install_static_wep_keys(ar); ath6kl_install_static_wep_keys(ar);
break; break;
case WPA_PSK_AUTH: case WPA_PSK_AUTH: