aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-08 08:22:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:09 -0400
commitfffd0934b9390f34bec45762192b7edd3b12b4b5 (patch)
treed9779803763261f5795fe39a402d79c4220a3a22 /net/mac80211/util.c
parentb9454e83cac42fcdc90bfbfba479132bd6629455 (diff)
cfg80211: rework key operation
This reworks the key operation in cfg80211, and now only allows, from userspace, configuring keys (via nl80211) after the connection has been established (in managed mode), the IBSS been joined (in IBSS mode), at any time (in AP[_VLAN] modes) or never for all the other modes. In order to do shared key authentication correctly, it is now possible to give a WEP key to the AUTH command. To configure static WEP keys, these are given to the CONNECT or IBSS_JOIN command directly, for a userspace SME it is assumed it will configure it properly after the connection has been established. Since mac80211 used to check the default key in IBSS mode to see whether or not the network is protected, it needs an update in that area, as well as an update to make use of the WEP key passed to auth() for shared key authentication. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r--net/mac80211/util.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 915e77769312..dbf66b52d38c 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -31,6 +31,7 @@
31#include "mesh.h" 31#include "mesh.h"
32#include "wme.h" 32#include "wme.h"
33#include "led.h" 33#include "led.h"
34#include "wep.h"
34 35
35/* privid for wiphys to determine whether they belong to us or not */ 36/* privid for wiphys to determine whether they belong to us or not */
36void *mac80211_wiphy_privid = &mac80211_wiphy_privid; 37void *mac80211_wiphy_privid = &mac80211_wiphy_privid;
@@ -804,12 +805,13 @@ u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
804 805
805void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, 806void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
806 u16 transaction, u16 auth_alg, 807 u16 transaction, u16 auth_alg,
807 u8 *extra, size_t extra_len, 808 u8 *extra, size_t extra_len, const u8 *bssid,
808 const u8 *bssid, int encrypt) 809 const u8 *key, u8 key_len, u8 key_idx)
809{ 810{
810 struct ieee80211_local *local = sdata->local; 811 struct ieee80211_local *local = sdata->local;
811 struct sk_buff *skb; 812 struct sk_buff *skb;
812 struct ieee80211_mgmt *mgmt; 813 struct ieee80211_mgmt *mgmt;
814 int err;
813 815
814 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 816 skb = dev_alloc_skb(local->hw.extra_tx_headroom +
815 sizeof(*mgmt) + 6 + extra_len); 817 sizeof(*mgmt) + 6 + extra_len);
@@ -824,8 +826,6 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
824 memset(mgmt, 0, 24 + 6); 826 memset(mgmt, 0, 24 + 6);
825 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 827 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
826 IEEE80211_STYPE_AUTH); 828 IEEE80211_STYPE_AUTH);
827 if (encrypt)
828 mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
829 memcpy(mgmt->da, bssid, ETH_ALEN); 829 memcpy(mgmt->da, bssid, ETH_ALEN);
830 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); 830 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
831 memcpy(mgmt->bssid, bssid, ETH_ALEN); 831 memcpy(mgmt->bssid, bssid, ETH_ALEN);
@@ -835,7 +835,13 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
835 if (extra) 835 if (extra)
836 memcpy(skb_put(skb, extra_len), extra, extra_len); 836 memcpy(skb_put(skb, extra_len), extra, extra_len);
837 837
838 ieee80211_tx_skb(sdata, skb, encrypt); 838 if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
839 mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
840 err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx);
841 WARN_ON(err);
842 }
843
844 ieee80211_tx_skb(sdata, skb, 0);
839} 845}
840 846
841int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, 847int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,