diff options
Diffstat (limited to 'net/mac80211/ieee80211_ioctl.c')
-rw-r--r-- | net/mac80211/ieee80211_ioctl.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c index 73909ec85f2a..352f03bd8a3a 100644 --- a/net/mac80211/ieee80211_ioctl.c +++ b/net/mac80211/ieee80211_ioctl.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "ieee80211_rate.h" | 25 | #include "ieee80211_rate.h" |
26 | #include "wpa.h" | 26 | #include "wpa.h" |
27 | #include "aes_ccm.h" | 27 | #include "aes_ccm.h" |
28 | #include "debugfs_key.h" | ||
28 | 29 | ||
29 | static int ieee80211_regdom = 0x10; /* FCC */ | 30 | static int ieee80211_regdom = 0x10; /* FCC */ |
30 | module_param(ieee80211_regdom, int, 0444); | 31 | module_param(ieee80211_regdom, int, 0444); |
@@ -180,8 +181,11 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, | |||
180 | } | 181 | } |
181 | kfree(keyconf); | 182 | kfree(keyconf); |
182 | 183 | ||
183 | if (set_tx_key || sdata->default_key == key) | 184 | if (set_tx_key || sdata->default_key == key) { |
185 | ieee80211_debugfs_key_remove_default(sdata); | ||
184 | sdata->default_key = NULL; | 186 | sdata->default_key = NULL; |
187 | } | ||
188 | ieee80211_debugfs_key_remove(key); | ||
185 | if (sta) | 189 | if (sta) |
186 | sta->key = NULL; | 190 | sta->key = NULL; |
187 | else | 191 | else |
@@ -221,13 +225,19 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, | |||
221 | } | 225 | } |
222 | } | 226 | } |
223 | 227 | ||
224 | if (set_tx_key || sdata->default_key == old_key) | 228 | if (set_tx_key || sdata->default_key == old_key) { |
229 | ieee80211_debugfs_key_remove_default(sdata); | ||
225 | sdata->default_key = NULL; | 230 | sdata->default_key = NULL; |
231 | } | ||
232 | ieee80211_debugfs_key_remove(old_key); | ||
226 | if (sta) | 233 | if (sta) |
227 | sta->key = key; | 234 | sta->key = key; |
228 | else | 235 | else |
229 | sdata->keys[idx] = key; | 236 | sdata->keys[idx] = key; |
230 | ieee80211_key_free(old_key); | 237 | ieee80211_key_free(old_key); |
238 | ieee80211_debugfs_key_add(local, key); | ||
239 | if (sta) | ||
240 | ieee80211_debugfs_key_sta_link(key, sta); | ||
231 | 241 | ||
232 | if (try_hwaccel && | 242 | if (try_hwaccel && |
233 | (alg == ALG_WEP || alg == ALG_TKIP || alg == ALG_CCMP)) | 243 | (alg == ALG_WEP || alg == ALG_TKIP || alg == ALG_CCMP)) |
@@ -236,6 +246,8 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, | |||
236 | 246 | ||
237 | if (set_tx_key || (!sta && !sdata->default_key && key)) { | 247 | if (set_tx_key || (!sta && !sdata->default_key && key)) { |
238 | sdata->default_key = key; | 248 | sdata->default_key = key; |
249 | if (key) | ||
250 | ieee80211_debugfs_key_add_default(sdata); | ||
239 | 251 | ||
240 | if (local->ops->set_key_idx && | 252 | if (local->ops->set_key_idx && |
241 | local->ops->set_key_idx(local_to_hw(local), idx)) | 253 | local->ops->set_key_idx(local_to_hw(local), idx)) |
@@ -1505,8 +1517,12 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev, | |||
1505 | alg = ALG_NONE; | 1517 | alg = ALG_NONE; |
1506 | else if (erq->length == 0) { | 1518 | else if (erq->length == 0) { |
1507 | /* No key data - just set the default TX key index */ | 1519 | /* No key data - just set the default TX key index */ |
1508 | if (sdata->default_key != sdata->keys[idx]) | 1520 | if (sdata->default_key != sdata->keys[idx]) { |
1521 | ieee80211_debugfs_key_remove_default(sdata); | ||
1509 | sdata->default_key = sdata->keys[idx]; | 1522 | sdata->default_key = sdata->keys[idx]; |
1523 | if (sdata->default_key) | ||
1524 | ieee80211_debugfs_key_add_default(sdata); | ||
1525 | } | ||
1510 | return 0; | 1526 | return 0; |
1511 | } | 1527 | } |
1512 | 1528 | ||