diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-08-28 17:01:55 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:48:53 -0400 |
commit | 11a843b7e16062389c53ba393c7913956e034eb2 (patch) | |
tree | 7f557a55220a0de38f0eafe1a5147487ec39b790 /net/mac80211/ieee80211_key.h | |
parent | 3aefaa3294193c931b20a574f718efee6baf27d4 (diff) |
[MAC80211]: rework key handling
This moves all the key handling code out from ieee80211_ioctl.c
into key.c and also does the following changes including documentation
updates in mac80211.h:
1) Turn off hardware acceleration for keys when the interface
is down. This is necessary because otherwise monitor
interfaces could be decrypting frames for other interfaces
that are down at the moment. Also, it should go some way
towards better suspend/resume support, in any case the
routines used here could be used for that as well.
Additionally, this makes the driver interface nicer, keys
for a specific local MAC address are only ever present
while an interface with that MAC address is enabled.
2) Change driver set_key() callback interface to allow only
return values of -ENOSPC, -EOPNOTSUPP and 0, warn on all
other return values. This allows debugging the stack when
a driver notices it's handed a key while it is down.
3) Invert the flag meaning to KEY_FLAG_UPLOADED_TO_HARDWARE.
4) Remove REMOVE_ALL_KEYS command as it isn't used nor do we
want to use it, we'll use DISABLE_KEY for each key. It is
hard to use REMOVE_ALL_KEYS because we can handle multiple
virtual interfaces with different key configuration, so we'd
have to keep track of a lot of state for this and that isn't
worth it.
5) Warn when disabling a key fails, it musn't.
6) Remove IEEE80211_HW_NO_TKIP_WMM_HWACCEL in favour of per-key
IEEE80211_KEY_FLAG_WMM_STA to let driver sort it out itself.
7) Tell driver that a (non-WEP) key is used only for transmission
by using an all-zeroes station MAC address when configuring.
8) Change the set_key() callback to have access to the local MAC
address the key is being added for.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/ieee80211_key.h')
-rw-r--r-- | net/mac80211/ieee80211_key.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/mac80211/ieee80211_key.h b/net/mac80211/ieee80211_key.h index 58e192530826..a4e5fbbe045c 100644 --- a/net/mac80211/ieee80211_key.h +++ b/net/mac80211/ieee80211_key.h | |||
@@ -41,7 +41,21 @@ | |||
41 | 41 | ||
42 | #define NUM_RX_DATA_QUEUES 17 | 42 | #define NUM_RX_DATA_QUEUES 17 |
43 | 43 | ||
44 | struct ieee80211_local; | ||
45 | struct ieee80211_sub_if_data; | ||
46 | struct sta_info; | ||
47 | |||
48 | #define KEY_FLAG_UPLOADED_TO_HARDWARE (1<<0) | ||
49 | |||
44 | struct ieee80211_key { | 50 | struct ieee80211_key { |
51 | struct ieee80211_local *local; | ||
52 | struct ieee80211_sub_if_data *sdata; | ||
53 | struct sta_info *sta; | ||
54 | |||
55 | struct list_head list; | ||
56 | |||
57 | unsigned int flags; | ||
58 | |||
45 | union { | 59 | union { |
46 | struct { | 60 | struct { |
47 | /* last used TSC */ | 61 | /* last used TSC */ |
@@ -97,4 +111,16 @@ struct ieee80211_key { | |||
97 | struct ieee80211_key_conf conf; | 111 | struct ieee80211_key_conf conf; |
98 | }; | 112 | }; |
99 | 113 | ||
114 | struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata, | ||
115 | struct sta_info *sta, | ||
116 | ieee80211_key_alg alg, | ||
117 | int idx, | ||
118 | size_t key_len, | ||
119 | const u8 *key_data); | ||
120 | void ieee80211_key_free(struct ieee80211_key *key); | ||
121 | void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx); | ||
122 | void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata); | ||
123 | void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata); | ||
124 | void ieee80211_disable_keys(struct ieee80211_sub_if_data *sdata); | ||
125 | |||
100 | #endif /* IEEE80211_KEY_H */ | 126 | #endif /* IEEE80211_KEY_H */ |