Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 342133
b: refs/heads/master
c: b98ea05
h: refs/heads/master
i:
  342131: 30cecec
v: v3
  • Loading branch information
Saravana authored and Johannes Berg committed Dec 5, 2012
1 parent fc56c8b commit 071bda7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a6662dbae0b3a7a91317ec88b5aa0cf8d716f183
refs/heads/master: b98ea05861d76f458029096e8b2939fcb58e9530
17 changes: 17 additions & 0 deletions trunk/net/mac80211/debugfs_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@ static ssize_t key_icverrors_read(struct file *file, char __user *userbuf,
}
KEY_OPS(icverrors);

static ssize_t key_mic_failures_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct ieee80211_key *key = file->private_data;
char buf[20];
int len;

if (key->conf.cipher != WLAN_CIPHER_SUITE_TKIP)
return -EINVAL;

len = scnprintf(buf, sizeof(buf), "%u\n", key->u.tkip.mic_failures);

return simple_read_from_buffer(userbuf, count, ppos, buf, len);
}
KEY_OPS(mic_failures);

static ssize_t key_key_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
Expand Down Expand Up @@ -260,6 +276,7 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key)
DEBUGFS_ADD(rx_spec);
DEBUGFS_ADD(replays);
DEBUGFS_ADD(icverrors);
DEBUGFS_ADD(mic_failures);
DEBUGFS_ADD(key);
DEBUGFS_ADD(ifindex);
};
Expand Down
3 changes: 3 additions & 0 deletions trunk/net/mac80211/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ struct ieee80211_key {

/* last received RSC */
struct tkip_ctx rx[IEEE80211_NUM_TIDS];

/* number of mic failures */
u32 mic_failures;
} tkip;
struct {
atomic64_t tx_pn;
Expand Down
5 changes: 4 additions & 1 deletion trunk/net/mac80211/wpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
*/
if (status->flag & (RX_FLAG_MMIC_STRIPPED | RX_FLAG_IV_STRIPPED)) {
if (status->flag & RX_FLAG_MMIC_ERROR)
goto mic_fail;
goto mic_fail_no_key;

if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key &&
rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)
Expand Down Expand Up @@ -161,6 +161,9 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
return RX_CONTINUE;

mic_fail:
rx->key->u.tkip.mic_failures++;

mic_fail_no_key:
/*
* In some cases the key can be unset - e.g. a multicast packet, in
* a driver that supports HW encryption. Send up the key idx only if
Expand Down

0 comments on commit 071bda7

Please sign in to comment.