linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mac80211: add debug file for mic failure
@ 2012-12-04 14:17 Saravana
  2012-12-04 14:57 ` Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Saravana @ 2012-12-04 14:17 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

The mic failure count will provide the number of mic failure that 
have happened without a countermeasure being started. Once the 
countermeasure is started, the counter will be reset to 0.
This count will be helpful when the consecutive 
mic failure occur at intervals greater than 60 seconds regularly(frequently).

Signed-off-by: Saravana <saravanad@posedge.com>
---
 net/mac80211/debugfs_key.c |   17 +++++++++++++++++
 net/mac80211/key.h         |    3 +++
 net/mac80211/wpa.c         |    2 ++
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 2d42354..65ecfee 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,
 }
 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)
 {
@@ -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);
 };
diff --git a/net/mac80211/key.h b/net/mac80211/key.h
index 7cff0d3..382dc44 100644
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
@@ -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;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 8bd2f5c..aad79f3 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -161,6 +161,8 @@ update_iv:
 	return RX_CONTINUE;
 
 mic_fail:
+
+	rx->key->u.tkip.mic_failures++;
 	/*
 	 * 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mac80211: add debug file for mic failure
  2012-12-04 14:17 [PATCH v2] mac80211: add debug file for mic failure Saravana
@ 2012-12-04 14:57 ` Johannes Berg
  2012-12-04 19:07   ` Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2012-12-04 14:57 UTC (permalink / raw)
  To: Saravana; +Cc: linux-wireless

On Tue, 2012-12-04 at 19:47 +0530, Saravana wrote:
> The mic failure count will provide the number of mic failure that 
> have happened without a countermeasure being started. Once the 
> countermeasure is started, the counter will be reset to 0.
> This count will be helpful when the consecutive 
> mic failure occur at intervals greater than 60 seconds regularly(frequently).

Applied.

johannes


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mac80211: add debug file for mic failure
  2012-12-04 14:57 ` Johannes Berg
@ 2012-12-04 19:07   ` Johannes Berg
  2012-12-05  6:54     ` Saravana
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2012-12-04 19:07 UTC (permalink / raw)
  To: Saravana; +Cc: linux-wireless

On Tue, 2012-12-04 at 15:57 +0100, Johannes Berg wrote:
> On Tue, 2012-12-04 at 19:47 +0530, Saravana wrote:
> > The mic failure count will provide the number of mic failure that 
> > have happened without a countermeasure being started. Once the 
> > countermeasure is started, the counter will be reset to 0.
> > This count will be helpful when the consecutive 
> > mic failure occur at intervals greater than 60 seconds regularly(frequently).
> 
> Applied.

Never mind, dropped. It has a null pointer issue and still has
whitespace issues. Please figure out how to actually indent
parameters ...

Also, signed-off-by should be your full name, is that really just
"Saravana"? Your email seems to indicate there's something else
("saravanad")

johannes


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mac80211: add debug file for mic failure
  2012-12-04 19:07   ` Johannes Berg
@ 2012-12-05  6:54     ` Saravana
  2012-12-05  8:44       ` Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Saravana @ 2012-12-05  6:54 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On 12/05/2012 12:37 AM, Johannes Berg wrote:
> On Tue, 2012-12-04 at 15:57 +0100, Johannes Berg wrote:
>> On Tue, 2012-12-04 at 19:47 +0530, Saravana wrote:
>>> The mic failure count will provide the number of mic failure that 
>>> have happened without a countermeasure being started. Once the 
>>> countermeasure is started, the counter will be reset to 0.
>>> This count will be helpful when the consecutive 
>>> mic failure occur at intervals greater than 60 seconds regularly(frequently).
>>
>> Applied.
> 
> Never mind, dropped. It has a null pointer issue and still has

could the null pointer issue be prevented by checking 
the rx->key is valid before update the mic failure? Is it acceptable?

	if (rx->key)
		rx->key->u.tkip.mic_failures++


> whitespace issues. Please figure out how to actually indent
> parameters ...
> 
The patch was verified with the checkpatch script. it didn't point out whitespace
error and the indentation issue.Is there any other scripts that needs to be run additionally?
Please let me know how to figure out this issue ?

> Also, signed-off-by should be your full name, is that really just
> "Saravana"? Your email seems to indicate there's something else
> ("saravanad")
> 

My full name is Saravanakumar and my Father name is Doraiswami. 
Saravanad, d-indicates my starting letter of my Father name.
I will probably use Saravanakumar in the future patches..

> johannes
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mac80211: add debug file for mic failure
  2012-12-05  6:54     ` Saravana
@ 2012-12-05  8:44       ` Johannes Berg
  2012-12-05  9:28         ` Saravana
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2012-12-05  8:44 UTC (permalink / raw)
  To: Saravana; +Cc: linux-wireless

On Wed, 2012-12-05 at 12:24 +0530, Saravana wrote:
> On 12/05/2012 12:37 AM, Johannes Berg wrote:
> > On Tue, 2012-12-04 at 15:57 +0100, Johannes Berg wrote:
> >> On Tue, 2012-12-04 at 19:47 +0530, Saravana wrote:
> >>> The mic failure count will provide the number of mic failure that 
> >>> have happened without a countermeasure being started. Once the 
> >>> countermeasure is started, the counter will be reset to 0.
> >>> This count will be helpful when the consecutive 
> >>> mic failure occur at intervals greater than 60 seconds regularly(frequently).
> >>
> >> Applied.
> > 
> > Never mind, dropped. It has a null pointer issue and still has
> 
> could the null pointer issue be prevented by checking 
> the rx->key is valid before update the mic failure? Is it acceptable?
> 
> 	if (rx->key)
> 		rx->key->u.tkip.mic_failures++

Should probably use two labels instead.

> > whitespace issues. Please figure out how to actually indent
> > parameters ...
> > 
> The patch was verified with the checkpatch script. it didn't point out whitespace
> error and the indentation issue.Is there any other scripts that needs to be run additionally?
> Please let me know how to figure out this issue ?

*shrug*, not sure. You've indented the function arguments wrong:

static ssize_t key_mic_failures_read(struct file ...
					size_t count)

you should use spaces there at the end to line up right under "struct",
not only tabs that go too far (or not far enough)

> > Also, signed-off-by should be your full name, is that really just
> > "Saravana"? Your email seems to indicate there's something else
> > ("saravanad")
> > 
> 
> My full name is Saravanakumar and my Father name is Doraiswami. 
> Saravanad, d-indicates my starting letter of my Father name.
> I will probably use Saravanakumar in the future patches..

Hah, sorry. I make this mistake all the time, my bad, I apologise. No
need to do anything differently.

Anyway ... I've fixed it up for you now.

johannes


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mac80211: add debug file for mic failure
  2012-12-05  8:44       ` Johannes Berg
@ 2012-12-05  9:28         ` Saravana
  0 siblings, 0 replies; 6+ messages in thread
From: Saravana @ 2012-12-05  9:28 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

> 
> Anyway ... I've fixed it up for you now.
> 
Thank you for fixing the patch..:)
> johannes
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-05  9:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-04 14:17 [PATCH v2] mac80211: add debug file for mic failure Saravana
2012-12-04 14:57 ` Johannes Berg
2012-12-04 19:07   ` Johannes Berg
2012-12-05  6:54     ` Saravana
2012-12-05  8:44       ` Johannes Berg
2012-12-05  9:28         ` Saravana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).