diff options
author | Roland Vossen <rvossen@broadcom.com> | 2011-10-12 14:51:24 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-10-14 14:48:18 -0400 |
commit | a718e2fed1a31239922d06d7877fc3436eb05288 (patch) | |
tree | ad0955906c3ff82190ec2c6dec9738228f706523 /drivers | |
parent | c68cdc0ff6da538226bd440ecc6a005e74e0ace6 (diff) |
brcm80211: fmac: fixed weird indentation
And changed function name to something more appropriate.
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 99 |
1 files changed, 51 insertions, 48 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 1b09be0f4564..27a748e55036 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -1152,7 +1152,7 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) | |||
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | static s32 | 1154 | static s32 |
1155 | brcmf_set_set_sharedkey(struct net_device *ndev, | 1155 | brcmf_set_wep_sharedkey(struct net_device *ndev, |
1156 | struct cfg80211_connect_params *sme) | 1156 | struct cfg80211_connect_params *sme) |
1157 | { | 1157 | { |
1158 | struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); | 1158 | struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); |
@@ -1162,52 +1162,55 @@ brcmf_set_set_sharedkey(struct net_device *ndev, | |||
1162 | s32 err = 0; | 1162 | s32 err = 0; |
1163 | 1163 | ||
1164 | WL_CONN("key len (%d)\n", sme->key_len); | 1164 | WL_CONN("key len (%d)\n", sme->key_len); |
1165 | if (sme->key_len) { | ||
1166 | sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); | ||
1167 | WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n", | ||
1168 | sec->wpa_versions, sec->cipher_pairwise); | ||
1169 | if (! | ||
1170 | (sec->wpa_versions & (NL80211_WPA_VERSION_1 | | ||
1171 | NL80211_WPA_VERSION_2)) | ||
1172 | && (sec->cipher_pairwise & (WLAN_CIPHER_SUITE_WEP40 | | ||
1173 | WLAN_CIPHER_SUITE_WEP104))) { | ||
1174 | memset(&key, 0, sizeof(key)); | ||
1175 | key.len = (u32) sme->key_len; | ||
1176 | key.index = (u32) sme->key_idx; | ||
1177 | if (key.len > sizeof(key.data)) { | ||
1178 | WL_ERR("Too long key length (%u)\n", key.len); | ||
1179 | return -EINVAL; | ||
1180 | } | ||
1181 | memcpy(key.data, sme->key, key.len); | ||
1182 | key.flags = BRCMF_PRIMARY_KEY; | ||
1183 | switch (sec->cipher_pairwise) { | ||
1184 | case WLAN_CIPHER_SUITE_WEP40: | ||
1185 | key.algo = CRYPTO_ALGO_WEP1; | ||
1186 | break; | ||
1187 | case WLAN_CIPHER_SUITE_WEP104: | ||
1188 | key.algo = CRYPTO_ALGO_WEP128; | ||
1189 | break; | ||
1190 | default: | ||
1191 | WL_ERR("Invalid algorithm (%d)\n", | ||
1192 | sme->crypto.ciphers_pairwise[0]); | ||
1193 | return -EINVAL; | ||
1194 | } | ||
1195 | /* Set the new key/index */ | ||
1196 | WL_CONN("key length (%d) key index (%d) algo (%d)\n", | ||
1197 | key.len, key.index, key.algo); | ||
1198 | WL_CONN("key \"%s\"\n", key.data); | ||
1199 | err = send_key_to_dongle(ndev, &key); | ||
1200 | if (err) | ||
1201 | return err; | ||
1202 | 1165 | ||
1203 | if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) { | 1166 | if (sme->key_len == 0) |
1204 | WL_CONN("set auth_type to shared key\n"); | 1167 | return 0; |
1205 | val = 1; /* shared key */ | 1168 | |
1206 | err = brcmf_dev_intvar_set(ndev, "auth", val); | 1169 | sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); |
1207 | if (err) { | 1170 | WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n", |
1208 | WL_ERR("set auth failed (%d)\n", err); | 1171 | sec->wpa_versions, sec->cipher_pairwise); |
1209 | return err; | 1172 | |
1210 | } | 1173 | if (sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2)) |
1174 | return 0; | ||
1175 | |||
1176 | if (sec->cipher_pairwise & | ||
1177 | (WLAN_CIPHER_SUITE_WEP40 | WLAN_CIPHER_SUITE_WEP104)) { | ||
1178 | memset(&key, 0, sizeof(key)); | ||
1179 | key.len = (u32) sme->key_len; | ||
1180 | key.index = (u32) sme->key_idx; | ||
1181 | if (key.len > sizeof(key.data)) { | ||
1182 | WL_ERR("Too long key length (%u)\n", key.len); | ||
1183 | return -EINVAL; | ||
1184 | } | ||
1185 | memcpy(key.data, sme->key, key.len); | ||
1186 | key.flags = BRCMF_PRIMARY_KEY; | ||
1187 | switch (sec->cipher_pairwise) { | ||
1188 | case WLAN_CIPHER_SUITE_WEP40: | ||
1189 | key.algo = CRYPTO_ALGO_WEP1; | ||
1190 | break; | ||
1191 | case WLAN_CIPHER_SUITE_WEP104: | ||
1192 | key.algo = CRYPTO_ALGO_WEP128; | ||
1193 | break; | ||
1194 | default: | ||
1195 | WL_ERR("Invalid algorithm (%d)\n", | ||
1196 | sme->crypto.ciphers_pairwise[0]); | ||
1197 | return -EINVAL; | ||
1198 | } | ||
1199 | /* Set the new key/index */ | ||
1200 | WL_CONN("key length (%d) key index (%d) algo (%d)\n", | ||
1201 | key.len, key.index, key.algo); | ||
1202 | WL_CONN("key \"%s\"\n", key.data); | ||
1203 | err = send_key_to_dongle(ndev, &key); | ||
1204 | if (err) | ||
1205 | return err; | ||
1206 | |||
1207 | if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) { | ||
1208 | WL_CONN("set auth_type to shared key\n"); | ||
1209 | val = 1; /* shared key */ | ||
1210 | err = brcmf_dev_intvar_set(ndev, "auth", val); | ||
1211 | if (err) { | ||
1212 | WL_ERR("set auth failed (%d)\n", err); | ||
1213 | return err; | ||
1211 | } | 1214 | } |
1212 | } | 1215 | } |
1213 | } | 1216 | } |
@@ -1271,9 +1274,9 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, | |||
1271 | goto done; | 1274 | goto done; |
1272 | } | 1275 | } |
1273 | 1276 | ||
1274 | err = brcmf_set_set_sharedkey(ndev, sme); | 1277 | err = brcmf_set_wep_sharedkey(ndev, sme); |
1275 | if (err) { | 1278 | if (err) { |
1276 | WL_ERR("wl_set_set_sharedkey failed (%d)\n", err); | 1279 | WL_ERR("brcmf_set_wep_sharedkey failed (%d)\n", err); |
1277 | goto done; | 1280 | goto done; |
1278 | } | 1281 | } |
1279 | 1282 | ||