aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/debugfs_key.c
diff options
context:
space:
mode:
authorSaravana <saravanad@posedge.com>2012-12-04 09:17:42 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-12-05 03:44:41 -0500
commitb98ea05861d76f458029096e8b2939fcb58e9530 (patch)
treea12b1993b0495a2c5f980f14ea94553ccae2b24e /net/mac80211/debugfs_key.c
parenta6662dbae0b3a7a91317ec88b5aa0cf8d716f183 (diff)
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>
Diffstat (limited to 'net/mac80211/debugfs_key.c')
-rw-r--r--net/mac80211/debugfs_key.c17
1 files changed, 17 insertions, 0 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}
200KEY_OPS(icverrors); 200KEY_OPS(icverrors);
201 201
202static 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}
216KEY_OPS(mic_failures);
217
202static ssize_t key_key_read(struct file *file, char __user *userbuf, 218static 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};