Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] ath10k: add mic bytes for pmf management packet
@ 2019-06-17  7:37 Wen Gong
  2019-06-17 16:03 ` Ben Greear
  2019-09-10 13:18 ` Kalle Valo
  0 siblings, 2 replies; 6+ messages in thread
From: Wen Gong @ 2019-06-17  7:37 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless

For PMF case, the action,deauth,disassoc management need to encrypt
by hardware, it need to reserve 8 bytes for encryption, otherwise
the packet will be sent out with error format, then PMF case will
fail.

After add the 8 bytes, it will pass the PMF case.

Tested with QCA6174 SDIO with firmware
WLAN.RMH.4.4.1-00005-QCARMSWP-1.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
---
 drivers/net/wireless/ath/ath10k/htt_tx.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index d8e9cc0..7bef9d9 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -1236,6 +1236,7 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
 	struct ath10k *ar = htt->ar;
 	int res, data_len;
 	struct htt_cmd_hdr *cmd_hdr;
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
 	struct htt_data_tx_desc *tx_desc;
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
 	struct sk_buff *tmp_skb;
@@ -1245,6 +1246,13 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
 	u8 flags0 = 0;
 	u16 flags1 = 0;
 
+	if ((ieee80211_is_action(hdr->frame_control) ||
+	     ieee80211_is_deauth(hdr->frame_control) ||
+	     ieee80211_is_disassoc(hdr->frame_control)) &&
+	     ieee80211_has_protected(hdr->frame_control)) {
+		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
+	}
+
 	data_len = msdu->len;
 
 	switch (txmode) {
-- 
1.9.1


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

* Re: [PATCH] ath10k: add mic bytes for pmf management packet
  2019-06-17  7:37 [PATCH] ath10k: add mic bytes for pmf management packet Wen Gong
@ 2019-06-17 16:03 ` Ben Greear
  2019-06-18  7:21   ` Wen Gong
  2019-09-10 13:18 ` Kalle Valo
  1 sibling, 1 reply; 6+ messages in thread
From: Ben Greear @ 2019-06-17 16:03 UTC (permalink / raw)
  To: Wen Gong, ath10k; +Cc: linux-wireless

On 6/17/19 12:37 AM, Wen Gong wrote:
> For PMF case, the action,deauth,disassoc management need to encrypt
> by hardware, it need to reserve 8 bytes for encryption, otherwise
> the packet will be sent out with error format, then PMF case will
> fail.
> 
> After add the 8 bytes, it will pass the PMF case.
> 
> Tested with QCA6174 SDIO with firmware
> WLAN.RMH.4.4.1-00005-QCARMSWP-1.
> 
> Signed-off-by: Wen Gong <wgong@codeaurora.org>
> ---
>   drivers/net/wireless/ath/ath10k/htt_tx.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
> index d8e9cc0..7bef9d9 100644
> --- a/drivers/net/wireless/ath/ath10k/htt_tx.c
> +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
> @@ -1236,6 +1236,7 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
>   	struct ath10k *ar = htt->ar;
>   	int res, data_len;
>   	struct htt_cmd_hdr *cmd_hdr;
> +	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data;
>   	struct htt_data_tx_desc *tx_desc;
>   	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
>   	struct sk_buff *tmp_skb;
> @@ -1245,6 +1246,13 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
>   	u8 flags0 = 0;
>   	u16 flags1 = 0;
>   
> +	if ((ieee80211_is_action(hdr->frame_control) ||
> +	     ieee80211_is_deauth(hdr->frame_control) ||
> +	     ieee80211_is_disassoc(hdr->frame_control)) &&
> +	     ieee80211_has_protected(hdr->frame_control)) {
> +		skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
> +	}

I was looking at mac80211 code recently, and it seems some action
frames are NOT supposed to be protected.  I added my own helper
method to my local ath10k.  Maybe you want to use this?


/* Copied from ieee80211_is_robust_mgmt_frame, but disable the check for has_protected
  * since we do tx hw crypt, and it won't actually be encrypted even when this flag is
  * set.
  */
bool ieee80211_is_robust_mgmt_frame_tx(struct ieee80211_hdr *hdr)
{
         if (ieee80211_is_disassoc(hdr->frame_control) ||
             ieee80211_is_deauth(hdr->frame_control))
                 return true;

         if (ieee80211_is_action(hdr->frame_control)) {
                 u8 *category;

                 /*
                  * Action frames, excluding Public Action frames, are Robust
                  * Management Frames. However, if we are looking at a Protected
                  * frame, skip the check since the data may be encrypted and
                  * the frame has already been found to be a Robust Management
                  * Frame (by the other end).
                  */
		/*
		if (ieee80211_has_protected(hdr->frame_control))
                         return true;
		*/
                 category = ((u8 *) hdr) + 24;
                 return *category != WLAN_CATEGORY_PUBLIC &&
                         *category != WLAN_CATEGORY_HT &&
                         *category != WLAN_CATEGORY_WNM_UNPROTECTED &&
                         *category != WLAN_CATEGORY_SELF_PROTECTED &&
                         *category != WLAN_CATEGORY_UNPROT_DMG &&
                         *category != WLAN_CATEGORY_VHT &&
                         *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
         }

         return false;
}

Thanks,
Ben

> +
>   	data_len = msdu->len;
>   
>   	switch (txmode) {
> 


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


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

* RE: [PATCH] ath10k: add mic bytes for pmf management packet
  2019-06-17 16:03 ` Ben Greear
@ 2019-06-18  7:21   ` Wen Gong
  2019-07-24 12:10     ` Kalle Valo
  0 siblings, 1 reply; 6+ messages in thread
From: Wen Gong @ 2019-06-18  7:21 UTC (permalink / raw)
  To: Ben Greear, Wen Gong, ath10k; +Cc: linux-wireless

> -----Original Message-----
> From: ath10k <ath10k-bounces@lists.infradead.org> On Behalf Of Ben
> Greear
> Sent: Tuesday, June 18, 2019 12:04 AM
> To: Wen Gong <wgong@codeaurora.org>; ath10k@lists.infradead.org
> Cc: linux-wireless@vger.kernel.org
> Subject: [EXT] Re: [PATCH] ath10k: add mic bytes for pmf management
> packet
> 
> I was looking at mac80211 code recently, and it seems some action
> frames are NOT supposed to be protected.  I added my own helper
> method to my local ath10k.  Maybe you want to use this?
> 
> 
> /* Copied from ieee80211_is_robust_mgmt_frame, but disable the check for
> has_protected
>   * since we do tx hw crypt, and it won't actually be encrypted even when this
> flag is
>   * set.
>   */
> bool ieee80211_is_robust_mgmt_frame_tx(struct ieee80211_hdr *hdr)
> {
>          if (ieee80211_is_disassoc(hdr->frame_control) ||
>              ieee80211_is_deauth(hdr->frame_control))
>                  return true;
> 
>          if (ieee80211_is_action(hdr->frame_control)) {
>                  u8 *category;
> 
>                  /*
>                   * Action frames, excluding Public Action frames, are Robust
>                   * Management Frames. However, if we are looking at a Protected
>                   * frame, skip the check since the data may be encrypted and
>                   * the frame has already been found to be a Robust Management
>                   * Frame (by the other end).
>                   */
> 		/*
> 		if (ieee80211_has_protected(hdr->frame_control))
>                          return true;
> 		*/
>                  category = ((u8 *) hdr) + 24;
>                  return *category != WLAN_CATEGORY_PUBLIC &&
>                          *category != WLAN_CATEGORY_HT &&
>                          *category != WLAN_CATEGORY_WNM_UNPROTECTED &&
>                          *category != WLAN_CATEGORY_SELF_PROTECTED &&
>                          *category != WLAN_CATEGORY_UNPROT_DMG &&
>                          *category != WLAN_CATEGORY_VHT &&
>                          *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
>          }
> 
>          return false;
> }
> 
> Thanks,
> Ben
> 
> > +
> >   	data_len = msdu->len;
> >
> >   	switch (txmode) {
> >
> 
> 
Thanks Ben,

seems the ieee80211_is_robust_mgmt_frame_tx is not 
match my change.

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

* Re: [PATCH] ath10k: add mic bytes for pmf management packet
  2019-06-18  7:21   ` Wen Gong
@ 2019-07-24 12:10     ` Kalle Valo
  2019-07-25  2:15       ` Wen Gong
  0 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2019-07-24 12:10 UTC (permalink / raw)
  To: Wen Gong; +Cc: Ben Greear, Wen Gong, ath10k\, linux-wireless\

Wen Gong <wgong@qti.qualcomm.com> writes:

>> -----Original Message-----
>> From: ath10k <ath10k-bounces@lists.infradead.org> On Behalf Of Ben
>> Greear
>> Sent: Tuesday, June 18, 2019 12:04 AM
>> To: Wen Gong <wgong@codeaurora.org>; ath10k@lists.infradead.org
>> Cc: linux-wireless@vger.kernel.org
>> Subject: [EXT] Re: [PATCH] ath10k: add mic bytes for pmf management
>> packet
>> 
>> I was looking at mac80211 code recently, and it seems some action
>> frames are NOT supposed to be protected.  I added my own helper
>> method to my local ath10k.  Maybe you want to use this?
>> 
>> 
>> /* Copied from ieee80211_is_robust_mgmt_frame, but disable the check for
>> has_protected
>>   * since we do tx hw crypt, and it won't actually be encrypted even when this
>> flag is
>>   * set.
>>   */
>> bool ieee80211_is_robust_mgmt_frame_tx(struct ieee80211_hdr *hdr)
>> {
>>          if (ieee80211_is_disassoc(hdr->frame_control) ||
>>              ieee80211_is_deauth(hdr->frame_control))
>>                  return true;
>> 
>>          if (ieee80211_is_action(hdr->frame_control)) {
>>                  u8 *category;
>> 
>>                  /*
>>                   * Action frames, excluding Public Action frames, are Robust
>>                   * Management Frames. However, if we are looking at a Protected
>>                   * frame, skip the check since the data may be encrypted and
>>                   * the frame has already been found to be a Robust Management
>>                   * Frame (by the other end).
>>                   */
>> 		/*
>> 		if (ieee80211_has_protected(hdr->frame_control))
>>                          return true;
>> 		*/
>>                  category = ((u8 *) hdr) + 24;
>>                  return *category != WLAN_CATEGORY_PUBLIC &&
>>                          *category != WLAN_CATEGORY_HT &&
>>                          *category != WLAN_CATEGORY_WNM_UNPROTECTED &&
>>                          *category != WLAN_CATEGORY_SELF_PROTECTED &&
>>                          *category != WLAN_CATEGORY_UNPROT_DMG &&
>>                          *category != WLAN_CATEGORY_VHT &&
>>                          *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
>>          }
>> 
>>          return false;
>> }
>> 
>> Thanks,
>> Ben
>> 
>> > +
>> >   	data_len = msdu->len;
>> >
>> >   	switch (txmode) {
>> >
>> 
>> 
> Thanks Ben,
>
> seems the ieee80211_is_robust_mgmt_frame_tx is not 
> match my change.

So what's the conclusion, can I take this patch?

-- 
Kalle Valo

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

* RE: [PATCH] ath10k: add mic bytes for pmf management packet
  2019-07-24 12:10     ` Kalle Valo
@ 2019-07-25  2:15       ` Wen Gong
  0 siblings, 0 replies; 6+ messages in thread
From: Wen Gong @ 2019-07-25  2:15 UTC (permalink / raw)
  To: kvalo; +Cc: Ben Greear, linux-wireless, ath10k, Wen Gong

> From: ath10k <ath10k-bounces@lists.infradead.org> On Behalf Of Kalle Valo
> Sent: Wednesday, July 24, 2019 8:11 PM
> To: Wen Gong <wgong@qti.qualcomm.com>
> Cc: Ben Greear <greearb@candelatech.com>; linux-wireless@vger.kernel.org;
> ath10k@lists.infradead.org; Wen Gong <wgong@codeaurora.org>
> Subject: [EXT] Re: [PATCH] ath10k: add mic bytes for pmf management
> packet
> > seems the ieee80211_is_robust_mgmt_frame_tx is not
> > match my change.
> 
> So what's the conclusion, can I take this patch?
> 
Yes, you can take this patch.
> --
> Kalle Valo
> 
> _______________________________________________
> ath10k mailing list
> ath10k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH] ath10k: add mic bytes for pmf management packet
  2019-06-17  7:37 [PATCH] ath10k: add mic bytes for pmf management packet Wen Gong
  2019-06-17 16:03 ` Ben Greear
@ 2019-09-10 13:18 ` Kalle Valo
  1 sibling, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-09-10 13:18 UTC (permalink / raw)
  To: Wen Gong; +Cc: ath10k, linux-wireless

Wen Gong <wgong@codeaurora.org> wrote:

> For PMF case, the action,deauth,disassoc management need to encrypt
> by hardware, it need to reserve 8 bytes for encryption, otherwise
> the packet will be sent out with error format, then PMF case will
> fail.
> 
> After add the 8 bytes, it will pass the PMF case.
> 
> Tested with QCA6174 SDIO with firmware
> WLAN.RMH.4.4.1-00005-QCARMSWP-1.
> 
> Signed-off-by: Wen Gong <wgong@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

83ac260151e7 ath10k: add mic bytes for pmf management packet

-- 
https://patchwork.kernel.org/patch/10998135/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17  7:37 [PATCH] ath10k: add mic bytes for pmf management packet Wen Gong
2019-06-17 16:03 ` Ben Greear
2019-06-18  7:21   ` Wen Gong
2019-07-24 12:10     ` Kalle Valo
2019-07-25  2:15       ` Wen Gong
2019-09-10 13:18 ` Kalle Valo

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org linux-wireless@archiver.kernel.org
	public-inbox-index linux-wireless


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/ public-inbox