linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Linux kernel 3.12 PN-KEY Mismatch in wpa.c, packet drop
@ 2014-11-21 15:01 deepak kumar Pradhan
  2014-11-21 15:12 ` Fwd: " deepak kumar Pradhan
  0 siblings, 1 reply; 4+ messages in thread
From: deepak kumar Pradhan @ 2014-11-21 15:01 UTC (permalink / raw)
  To: linux-wireless

Hi,
When I am sending heavy traffic through wireless, the packet number
and key is mismatching.
I have applied the below patch which solves my pn-key mismatch packet drop.
diff -Nurp linux-custom_1/net/mac80211/wpa.c linux-custom/net/mac80211/wpa.c
--- linux-custom_1/net/mac80211/wpa.c   2014-11-09 23:14:57.000000000 -0800
+++ linux-custom/net/mac80211/wpa.c     2014-11-13 05:16:45.000000000 -0800
@@ -483,7 +483,7 @@ ieee80211_crypto_ccmp_encrypt(struct iee
        return TX_CONTINUE;
 }

-
+#define MAX_PN_TOLERANCE 0x05  //PN-KEY mismatch
 ieee80211_rx_result
 ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
 {
@@ -495,6 +495,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
        u8 pn[IEEE80211_CCMP_PN_LEN];
        int data_len;
        int queue;
+       static const u8 zero_pn[IEEE80211_CCMP_PN_LEN] = {0};

        hdrlen = ieee80211_hdrlen(hdr->frame_control);

@@ -537,8 +538,16 @@ ieee80211_crypto_ccmp_decrypt(struct iee
                            skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
                        return RX_DROP_UNUSABLE;
        }
-
-       memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
+
+       //PN-KEY mismatch start
+       if (memcmp(key->u.ccmp.rx_pn[queue], zero_pn,
IEEE80211_CCMP_PN_LEN) == 0)
+       {
+               if((memcmp(pn,zero_pn,(IEEE80211_CCMP_PN_LEN-1)) == 0)
&& (pn[IEEE80211_CCMP_PN_LEN-1] < MAX_PN_TOLERANCE))
+                       memcpy(key->u.ccmp.rx_pn[queue], pn,
IEEE80211_CCMP_PN_LEN);
+       }
+       else
+               memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
+       //PN-KEY mismatch end

        /* Remove CCMP header and MIC */
        if (pskb_trim(skb, skb->len - IEEE80211_CCMP_MIC_LEN))


-- 
Deepak Kumar Pradhan

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

* Fwd: Linux kernel 3.12 PN-KEY Mismatch in wpa.c, packet drop
  2014-11-21 15:01 Linux kernel 3.12 PN-KEY Mismatch in wpa.c, packet drop deepak kumar Pradhan
@ 2014-11-21 15:12 ` deepak kumar Pradhan
  2014-11-21 15:19   ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: deepak kumar Pradhan @ 2014-11-21 15:12 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg

Hi,

Sorry for interrupting you.
The below patch do recovers from pn-key mismatch in kernel 3.12 kernel
packet drop issue.
I don't know where I need to submit this patch for proper solution.


---------- Forwarded message ----------
From: deepak kumar Pradhan <hydipu@gmail.com>
Date: Fri, Nov 21, 2014 at 8:31 PM
Subject: Linux kernel 3.12 PN-KEY Mismatch in wpa.c, packet drop
To: linux-wireless@vger.kernel.org


Hi,
When I am sending heavy traffic through wireless, the packet number
and key is mismatching.
I have applied the below patch which solves my pn-key mismatch packet drop.
diff -Nurp linux-custom_1/net/mac80211/wpa.c linux-custom/net/mac80211/wpa.c
--- linux-custom_1/net/mac80211/wpa.c   2014-11-09 23:14:57.000000000 -0800
+++ linux-custom/net/mac80211/wpa.c     2014-11-13 05:16:45.000000000 -0800
@@ -483,7 +483,7 @@ ieee80211_crypto_ccmp_encrypt(struct iee
        return TX_CONTINUE;
 }

-
+#define MAX_PN_TOLERANCE 0x05  //PN-KEY mismatch
 ieee80211_rx_result
 ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
 {
@@ -495,6 +495,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
        u8 pn[IEEE80211_CCMP_PN_LEN];
        int data_len;
        int queue;
+       static const u8 zero_pn[IEEE80211_CCMP_PN_LEN] = {0};

        hdrlen = ieee80211_hdrlen(hdr->frame_control);

@@ -537,8 +538,16 @@ ieee80211_crypto_ccmp_decrypt(struct iee
                            skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
                        return RX_DROP_UNUSABLE;
        }
-
-       memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
+
+       //PN-KEY mismatch start
+       if (memcmp(key->u.ccmp.rx_pn[queue], zero_pn,
IEEE80211_CCMP_PN_LEN) == 0)
+       {
+               if((memcmp(pn,zero_pn,(IEEE80211_CCMP_PN_LEN-1)) == 0)
&& (pn[IEEE80211_CCMP_PN_LEN-1] < MAX_PN_TOLERANCE))
+                       memcpy(key->u.ccmp.rx_pn[queue], pn,
IEEE80211_CCMP_PN_LEN);
+       }
+       else
+               memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
+       //PN-KEY mismatch end

        /* Remove CCMP header and MIC */
        if (pskb_trim(skb, skb->len - IEEE80211_CCMP_MIC_LEN))


--
Deepak Kumar Pradhan

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

* Re: Fwd: Linux kernel 3.12 PN-KEY Mismatch in wpa.c, packet drop
  2014-11-21 15:12 ` Fwd: " deepak kumar Pradhan
@ 2014-11-21 15:19   ` Johannes Berg
  2014-11-24  7:10     ` deepak kumar Pradhan
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2014-11-21 15:19 UTC (permalink / raw)
  To: deepak kumar Pradhan; +Cc: linux-wireless

On Fri, 2014-11-21 at 20:42 +0530, deepak kumar Pradhan wrote:
> Hi,
> 
> Sorry for interrupting you.
> The below patch do recovers from pn-key mismatch in kernel 3.12 kernel
> packet drop issue.
> I don't know where I need to submit this patch for proper solution.

This is the right place for submitting a proper solution, but I believe
you've already been told that what you're doing isn't a proper solution
at all.

johannes


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

* Re: Fwd: Linux kernel 3.12 PN-KEY Mismatch in wpa.c, packet drop
  2014-11-21 15:19   ` Johannes Berg
@ 2014-11-24  7:10     ` deepak kumar Pradhan
  0 siblings, 0 replies; 4+ messages in thread
From: deepak kumar Pradhan @ 2014-11-24  7:10 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

Thank you Johannes for your response. Since we were facing this issue,
i looked at the available patches. None solved the issue for us.
I may be missing something, can you please let me know if the solution
for this is already available?
Any inputs much appreciated.

regards

On Fri, Nov 21, 2014 at 8:49 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Fri, 2014-11-21 at 20:42 +0530, deepak kumar Pradhan wrote:
>> Hi,
>>
>> Sorry for interrupting you.
>> The below patch do recovers from pn-key mismatch in kernel 3.12 kernel
>> packet drop issue.
>> I don't know where I need to submit this patch for proper solution.
>
> This is the right place for submitting a proper solution, but I believe
> you've already been told that what you're doing isn't a proper solution
> at all.
>
> johannes
>



-- 
Deepak Kumar Pradhan

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

end of thread, other threads:[~2014-11-24  7:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-21 15:01 Linux kernel 3.12 PN-KEY Mismatch in wpa.c, packet drop deepak kumar Pradhan
2014-11-21 15:12 ` Fwd: " deepak kumar Pradhan
2014-11-21 15:19   ` Johannes Berg
2014-11-24  7:10     ` deepak kumar Pradhan

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).