* [RFC] mac80211: add debugfs file for mic failure
@ 2012-11-26 12:56 saravanad
2012-11-26 15:08 ` Johannes Berg
0 siblings, 1 reply; 6+ messages in thread
From: saravanad @ 2012-11-26 12:56 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless
Add a debugfs file showing the number of failure of
rx packet dropped due to mic failures. currently the
number of rx packet dropped is counted in general and
not with respect to a specific reason. This patch
counts the number of packet drop due to mic failure.
Signed-off-by: Saravana <saravanad@posedge.com>
---
The diff file is generated from wireless-testing git tree.
net/mac80211/debugfs_sta.c | 1 +
net/mac80211/sta_info.h | 3 +++
net/mac80211/wpa.c | 1 +
3 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 89281d2..b1aea94 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -377,6 +377,7 @@ void ieee80211_sta_debugfs_add(struct sta_info
*sta)
DEBUGFS_ADD_COUNTER(rx_duplicates, num_duplicates);
DEBUGFS_ADD_COUNTER(rx_fragments, rx_fragments);
DEBUGFS_ADD_COUNTER(rx_dropped, rx_dropped);
+ DEBUGFS_ADD_COUNTER(rx_dropped_mic_failure, rx_dropped_mic_failure);
DEBUGFS_ADD_COUNTER(tx_fragments, tx_fragments);
DEBUGFS_ADD_COUNTER(tx_filtered, tx_filtered_count);
DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed);
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 776f3d0..7456a95 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -247,6 +247,8 @@ struct sta_ampdu_mlme {
* @num_duplicates: number of duplicate frames received from this STA
* @rx_fragments: number of received MPDUs
* @rx_dropped: number of dropped MPDUs from this STA
+ * @rx_dropped_mic_failure: number of dropped MPDUs
+ * due to mic failure from this STA
* @last_signal: signal of last received frame from this STA
* @avg_signal: moving average of signal of received frames from this
STA
* @last_seq_ctrl: last received seq/frag number from this STA (per RX
queue)
@@ -326,6 +328,7 @@ struct sta_info {
unsigned long num_duplicates;
unsigned long rx_fragments;
unsigned long rx_dropped;
+ unsigned long rx_dropped_mic_failure;
int last_signal;
struct ewma avg_signal;
/* Plus 1 for non-QoS frames */
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 8bd2f5c..960403e 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -166,6 +166,7 @@ mic_fail:
* a driver that supports HW encryption. Send up the key idx only if
* the key is set.
*/
+ rx->sta->rx_dropped_mic_failure++;
mac80211_ev_michael_mic_failure(rx->sdata,
rx->key ? rx->key->conf.keyidx : -1,
(void *) skb->data, NULL, GFP_ATOMIC);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RFC] mac80211: add debugfs file for mic failure
2012-11-26 12:56 [RFC] mac80211: add debugfs file for mic failure saravanad
@ 2012-11-26 15:08 ` Johannes Berg
2012-11-27 5:57 ` Saravana
0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2012-11-26 15:08 UTC (permalink / raw)
To: saravanad; +Cc: linux-wireless
On Mon, 2012-11-26 at 04:56 -0800, saravanad@posedge.com wrote:
> Add a debugfs file showing the number of failure of
> rx packet dropped due to mic failures. currently the
> number of rx packet dropped is counted in general and
> not with respect to a specific reason. This patch
> counts the number of packet drop due to mic failure.
What's the value of this, shouldn't wpa_s/hostapd start countermeasures
pretty quickly?
johannes
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] mac80211: add debugfs file for mic failure
2012-11-26 15:08 ` Johannes Berg
@ 2012-11-27 5:57 ` Saravana
2012-11-29 6:29 ` Saravana
0 siblings, 1 reply; 6+ messages in thread
From: Saravana @ 2012-11-27 5:57 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
On 11/26/2012 08:38 PM, Johannes Berg wrote:
> On Mon, 2012-11-26 at 04:56 -0800, saravanad@posedge.com wrote:
>> Add a debugfs file showing the number of failure of
>> rx packet dropped due to mic failures. currently the
>> number of rx packet dropped is counted in general and
>> not with respect to a specific reason. This patch
>> counts the number of packet drop due to mic failure.
>
> What's the value of this, shouldn't wpa_s/hostapd start countermeasures
> pretty quickly?
>
This will just be a counter which keeps track of the number of mic
failures. Debugfs already had Rx dropped packet counter. This would
provide more granularity in respect to the reason of packet drop.
Yes, wpa_s/hostapd will start countermeasure quickly.
> johannes
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] mac80211: add debugfs file for mic failure
2012-11-27 5:57 ` Saravana
@ 2012-11-29 6:29 ` Saravana
0 siblings, 0 replies; 6+ messages in thread
From: Saravana @ 2012-11-29 6:29 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
On 11/27/2012 11:27 AM, Saravana wrote:
> On 11/26/2012 08:38 PM, Johannes Berg wrote:
>> On Mon, 2012-11-26 at 04:56 -0800, saravanad@posedge.com wrote:
>>> Add a debugfs file showing the number of failure of
>>> rx packet dropped due to mic failures. currently the
>>> number of rx packet dropped is counted in general and
>>> not with respect to a specific reason. This patch
>>> counts the number of packet drop due to mic failure.
>>
>> What's the value of this, shouldn't wpa_s/hostapd start countermeasures
>> pretty quickly?
>>
> This will just be a counter which keeps track of the number of mic failures. Debugfs already had Rx dropped packet counter. This would provide more granularity in respect to the reason of packet drop.
> Yes, wpa_s/hostapd will start countermeasure quickly.
>
>> johannes
>>
Could mic failure count be added to debugfs?
Saravana
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RFC] mac80211: add debugfs file for mic failure
@ 2012-12-04 13:19 Saravana
2012-12-04 13:24 ` Johannes Berg
0 siblings, 1 reply; 6+ messages in thread
From: Saravana @ 2012-12-04 13:19 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 | 20 ++++++++++++++++++++
net/mac80211/key.h | 3 +++
net/mac80211/wpa.c | 2 ++
3 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 2d42354..1cc262e 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -199,6 +199,25 @@ 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;
+
+ switch (key->conf.cipher) {
+ case WLAN_CIPHER_SUITE_TKIP:
+ len = scnprintf(buf, sizeof(buf), "%u\n",
+ key->u.tkip.mic_failures);
+ break;
+ default:
+ return 0;
+ }
+ 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 +279,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: [RFC] mac80211: add debugfs file for mic failure
2012-12-04 13:19 Saravana
@ 2012-12-04 13:24 ` Johannes Berg
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2012-12-04 13:24 UTC (permalink / raw)
To: Saravana; +Cc: linux-wireless
On Tue, 2012-12-04 at 18:49 +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).
>
> Signed-off-by: Saravana <saravanad@posedge.com>
> ---
> net/mac80211/debugfs_key.c | 20 ++++++++++++++++++++
> net/mac80211/key.h | 3 +++
> net/mac80211/wpa.c | 2 ++
> 3 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
> index 2d42354..1cc262e 100644
> --- a/net/mac80211/debugfs_key.c
> +++ b/net/mac80211/debugfs_key.c
> @@ -199,6 +199,25 @@ 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)
please fix indentation
> +{
> + struct ieee80211_key *key = file->private_data;
> + char buf[20];
> + int len;
> +
> + switch (key->conf.cipher) {
> + case WLAN_CIPHER_SUITE_TKIP:
> + len = scnprintf(buf, sizeof(buf), "%u\n",
> + key->u.tkip.mic_failures);
> + break;
> + default:
> + return 0;
> + }
I think this should just be
if (key->conf.cipher != TKIP)
return -EINVAL;
len = scnprintf(...)
> + return simple_read_from_buffer(userbuf, count, ppos, buf, len);
Other than that looks fine.
johannes
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-12-04 13:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-26 12:56 [RFC] mac80211: add debugfs file for mic failure saravanad
2012-11-26 15:08 ` Johannes Berg
2012-11-27 5:57 ` Saravana
2012-11-29 6:29 ` Saravana
-- strict thread matches above, loose matches on Subject: below --
2012-12-04 13:19 Saravana
2012-12-04 13:24 ` Johannes Berg
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).