diff options
-rw-r--r-- | net/mac80211/debugfs_key.c | 17 | ||||
-rw-r--r-- | net/mac80211/key.h | 3 | ||||
-rw-r--r-- | net/mac80211/wpa.c | 5 |
3 files changed, 24 insertions, 1 deletions
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index 2d4235497f1b..c3a3082b72e5 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -199,6 +199,22 @@ static ssize_t key_icverrors_read(struct file *file, char __user *userbuf, | |||
199 | } | 199 | } |
200 | KEY_OPS(icverrors); | 200 | KEY_OPS(icverrors); |
201 | 201 | ||
202 | static ssize_t key_mic_failures_read(struct file *file, char __user *userbuf, | ||
203 | size_t count, loff_t *ppos) | ||
204 | { | ||
205 | struct ieee80211_key *key = file->private_data; | ||
206 | char buf[20]; | ||
207 | int len; | ||
208 | |||
209 | if (key->conf.cipher != WLAN_CIPHER_SUITE_TKIP) | ||
210 | return -EINVAL; | ||
211 | |||
212 | len = scnprintf(buf, sizeof(buf), "%u\n", key->u.tkip.mic_failures); | ||
213 | |||
214 | return simple_read_from_buffer(userbuf, count, ppos, buf, len); | ||
215 | } | ||
216 | KEY_OPS(mic_failures); | ||
217 | |||
202 | static ssize_t key_key_read(struct file *file, char __user *userbuf, | 218 | static ssize_t key_key_read(struct file *file, char __user *userbuf, |
203 | size_t count, loff_t *ppos) | 219 | size_t count, loff_t *ppos) |
204 | { | 220 | { |
@@ -260,6 +276,7 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key) | |||
260 | DEBUGFS_ADD(rx_spec); | 276 | DEBUGFS_ADD(rx_spec); |
261 | DEBUGFS_ADD(replays); | 277 | DEBUGFS_ADD(replays); |
262 | DEBUGFS_ADD(icverrors); | 278 | DEBUGFS_ADD(icverrors); |
279 | DEBUGFS_ADD(mic_failures); | ||
263 | DEBUGFS_ADD(key); | 280 | DEBUGFS_ADD(key); |
264 | DEBUGFS_ADD(ifindex); | 281 | DEBUGFS_ADD(ifindex); |
265 | }; | 282 | }; |
diff --git a/net/mac80211/key.h b/net/mac80211/key.h index 7cff0d3a519c..382dc44ed330 100644 --- a/net/mac80211/key.h +++ b/net/mac80211/key.h | |||
@@ -81,6 +81,9 @@ struct ieee80211_key { | |||
81 | 81 | ||
82 | /* last received RSC */ | 82 | /* last received RSC */ |
83 | struct tkip_ctx rx[IEEE80211_NUM_TIDS]; | 83 | struct tkip_ctx rx[IEEE80211_NUM_TIDS]; |
84 | |||
85 | /* number of mic failures */ | ||
86 | u32 mic_failures; | ||
84 | } tkip; | 87 | } tkip; |
85 | struct { | 88 | struct { |
86 | atomic64_t tx_pn; | 89 | atomic64_t tx_pn; |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index 8bd2f5c6a56e..c175ee866ff4 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -104,7 +104,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) | |||
104 | */ | 104 | */ |
105 | if (status->flag & (RX_FLAG_MMIC_STRIPPED | RX_FLAG_IV_STRIPPED)) { | 105 | if (status->flag & (RX_FLAG_MMIC_STRIPPED | RX_FLAG_IV_STRIPPED)) { |
106 | if (status->flag & RX_FLAG_MMIC_ERROR) | 106 | if (status->flag & RX_FLAG_MMIC_ERROR) |
107 | goto mic_fail; | 107 | goto mic_fail_no_key; |
108 | 108 | ||
109 | if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key && | 109 | if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key && |
110 | rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP) | 110 | rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP) |
@@ -161,6 +161,9 @@ update_iv: | |||
161 | return RX_CONTINUE; | 161 | return RX_CONTINUE; |
162 | 162 | ||
163 | mic_fail: | 163 | mic_fail: |
164 | rx->key->u.tkip.mic_failures++; | ||
165 | |||
166 | mic_fail_no_key: | ||
164 | /* | 167 | /* |
165 | * In some cases the key can be unset - e.g. a multicast packet, in | 168 | * In some cases the key can be unset - e.g. a multicast packet, in |
166 | * a driver that supports HW encryption. Send up the key idx only if | 169 | * a driver that supports HW encryption. Send up the key idx only if |