linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath10k: fix protected flag stripping
@ 2014-05-19 11:15 Michal Kazior
  2014-05-20  1:48 ` Yeoh Chun-Yeow
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michal Kazior @ 2014-05-19 11:15 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, yeohchunyeow, Michal Kazior

This prevents protected flag being stripped from
undecrypted raw sniffed frames when monitor
interface is active.

Reported-by: Yeoh Chun-Yeow <yeohchunyeow@gmail.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 33 +++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index ac6a5fe..ac54d6e 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -778,17 +778,30 @@ static void ath10k_htt_rx_h_rates(struct ath10k *ar,
 static void ath10k_htt_rx_h_protected(struct ath10k_htt *htt,
 				      struct ieee80211_rx_status *rx_status,
 				      struct sk_buff *skb,
-				      enum htt_rx_mpdu_encrypt_type enctype)
+				      enum htt_rx_mpdu_encrypt_type enctype,
+				      enum rx_msdu_decap_format fmt,
+				      bool dot11frag)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 
+	rx_status->flag &= ~(RX_FLAG_DECRYPTED |
+			     RX_FLAG_IV_STRIPPED |
+			     RX_FLAG_MMIC_STRIPPED);
 
-	if (enctype == HTT_RX_MPDU_ENCRYPT_NONE) {
-		rx_status->flag &= ~(RX_FLAG_DECRYPTED |
-				     RX_FLAG_IV_STRIPPED |
-				     RX_FLAG_MMIC_STRIPPED);
+	if (enctype == HTT_RX_MPDU_ENCRYPT_NONE)
+		return;
+
+	/*
+	 * There's no explicit rx descriptor flag to indicate whether a given
+	 * frame has been decrypted or not. We're forced to use the decap
+	 * format as an implicit indication. However fragmentation rx is always
+	 * raw and it probably never reports undecrypted raws.
+	 *
+	 * This makes sure sniffed frames are reported as-is without stripping
+	 * the protected flag.
+	 */
+	if (fmt == RX_MSDU_DECAP_RAW && !dot11frag)
 		return;
-	}
 
 	rx_status->flag |= RX_FLAG_DECRYPTED |
 			   RX_FLAG_IV_STRIPPED |
@@ -942,7 +955,8 @@ static void ath10k_htt_rx_amsdu(struct ath10k_htt *htt,
 		}
 
 		skb_in = skb;
-		ath10k_htt_rx_h_protected(htt, rx_status, skb_in, enctype);
+		ath10k_htt_rx_h_protected(htt, rx_status, skb_in, enctype, fmt,
+					  false);
 		skb = skb->next;
 		skb_in->next = NULL;
 
@@ -1024,7 +1038,7 @@ static void ath10k_htt_rx_msdu(struct ath10k_htt *htt,
 		break;
 	}
 
-	ath10k_htt_rx_h_protected(htt, rx_status, skb, enctype);
+	ath10k_htt_rx_h_protected(htt, rx_status, skb, enctype, fmt, false);
 
 	ath10k_process_rx(htt->ar, rx_status, skb);
 }
@@ -1330,7 +1344,8 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt,
 
 	enctype = MS(__le32_to_cpu(rxd->mpdu_start.info0),
 		     RX_MPDU_START_INFO0_ENCRYPT_TYPE);
-	ath10k_htt_rx_h_protected(htt, rx_status, msdu_head, enctype);
+	ath10k_htt_rx_h_protected(htt, rx_status, msdu_head, enctype, fmt,
+				  true);
 	msdu_head->ip_summed = ath10k_htt_rx_get_csum_state(msdu_head);
 
 	if (tkip_mic_err)
-- 
1.8.5.3


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

* Re: [PATCH] ath10k: fix protected flag stripping
  2014-05-19 11:15 [PATCH] ath10k: fix protected flag stripping Michal Kazior
@ 2014-05-20  1:48 ` Yeoh Chun-Yeow
  2014-05-21 16:55 ` Kalle Valo
  2014-05-26  9:43 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Yeoh Chun-Yeow @ 2014-05-20  1:48 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org

On Mon, May 19, 2014 at 7:15 PM, Michal Kazior <michal.kazior@tieto.com> wrote:
> This prevents protected flag being stripped from
> undecrypted raw sniffed frames when monitor
> interface is active.
>
> Reported-by: Yeoh Chun-Yeow <yeohchunyeow@gmail.com>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>

Tested-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>

Test and work. Thanks

---
Chun-Yeow

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

* Re: [PATCH] ath10k: fix protected flag stripping
  2014-05-19 11:15 [PATCH] ath10k: fix protected flag stripping Michal Kazior
  2014-05-20  1:48 ` Yeoh Chun-Yeow
@ 2014-05-21 16:55 ` Kalle Valo
  2014-05-26  9:43 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2014-05-21 16:55 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k, yeohchunyeow, linux-wireless

Michal Kazior <michal.kazior@tieto.com> writes:

> This prevents protected flag being stripped from
> undecrypted raw sniffed frames when monitor
> interface is active.
>
> Reported-by: Yeoh Chun-Yeow <yeohchunyeow@gmail.com>

I changed this to match the Tested-by line:

    Reported-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
    Tested-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>

-- 
Kalle Valo

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

* Re: [PATCH] ath10k: fix protected flag stripping
  2014-05-19 11:15 [PATCH] ath10k: fix protected flag stripping Michal Kazior
  2014-05-20  1:48 ` Yeoh Chun-Yeow
  2014-05-21 16:55 ` Kalle Valo
@ 2014-05-26  9:43 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2014-05-26  9:43 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k, yeohchunyeow, linux-wireless

Michal Kazior <michal.kazior@tieto.com> writes:

> This prevents protected flag being stripped from
> undecrypted raw sniffed frames when monitor
> interface is active.
>
> Reported-by: Yeoh Chun-Yeow <yeohchunyeow@gmail.com>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>

Thanks, applied.

-- 
Kalle Valo

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

end of thread, other threads:[~2014-05-26  9:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-19 11:15 [PATCH] ath10k: fix protected flag stripping Michal Kazior
2014-05-20  1:48 ` Yeoh Chun-Yeow
2014-05-21 16:55 ` Kalle Valo
2014-05-26  9:43 ` Kalle Valo

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