mac80211: add debug file for mic failure
The mic failure count provides the number of mic failures that have happened on a given key (without a countermeasure being started, since that would remove the key). Signed-off-by: Saravana <saravanad@posedge.com> [fix NULL pointer issues] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
a6662dbae0
commit
b98ea05861
@ -199,6 +199,22 @@ static ssize_t key_icverrors_read(struct file *file, char __user *userbuf,
|
|||||||
}
|
}
|
||||||
KEY_OPS(icverrors);
|
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,
|
static ssize_t key_key_read(struct file *file, char __user *userbuf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
@ -260,6 +276,7 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key)
|
|||||||
DEBUGFS_ADD(rx_spec);
|
DEBUGFS_ADD(rx_spec);
|
||||||
DEBUGFS_ADD(replays);
|
DEBUGFS_ADD(replays);
|
||||||
DEBUGFS_ADD(icverrors);
|
DEBUGFS_ADD(icverrors);
|
||||||
|
DEBUGFS_ADD(mic_failures);
|
||||||
DEBUGFS_ADD(key);
|
DEBUGFS_ADD(key);
|
||||||
DEBUGFS_ADD(ifindex);
|
DEBUGFS_ADD(ifindex);
|
||||||
};
|
};
|
||||||
|
@ -81,6 +81,9 @@ struct ieee80211_key {
|
|||||||
|
|
||||||
/* last received RSC */
|
/* last received RSC */
|
||||||
struct tkip_ctx rx[IEEE80211_NUM_TIDS];
|
struct tkip_ctx rx[IEEE80211_NUM_TIDS];
|
||||||
|
|
||||||
|
/* number of mic failures */
|
||||||
|
u32 mic_failures;
|
||||||
} tkip;
|
} tkip;
|
||||||
struct {
|
struct {
|
||||||
atomic64_t tx_pn;
|
atomic64_t tx_pn;
|
||||||
|
@ -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_STRIPPED | RX_FLAG_IV_STRIPPED)) {
|
||||||
if (status->flag & RX_FLAG_MMIC_ERROR)
|
if (status->flag & RX_FLAG_MMIC_ERROR)
|
||||||
goto mic_fail;
|
goto mic_fail_no_key;
|
||||||
|
|
||||||
if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key &&
|
if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key &&
|
||||||
rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)
|
rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)
|
||||||
@ -161,6 +161,9 @@ update_iv:
|
|||||||
return RX_CONTINUE;
|
return RX_CONTINUE;
|
||||||
|
|
||||||
mic_fail:
|
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
|
* 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
|
* a driver that supports HW encryption. Send up the key idx only if
|
||||||
|
Loading…
x
Reference in New Issue
Block a user