2012-10-01 15:26:09

by Chaoxing Lin

[permalink] [raw]
Subject: 802.11w bip_aad() bug ?

Gentlemen,

In kernel/net/mac80211/wpa.c function bip_add is as below (in the end).

I think the aad[1] should be
aad[1] = skb->data[1] & ~(BIT(3) | BIT(4) | BIT(5));


Reference 1: ieee802.11-2012 page 1212
"FC-MPDU Frame Control field, with:
1) Retry bit (bit 11) masked to 0
2) Power Management bit (bit 12) masked to 0
3) More Data bit (bit 13) masked to 0"

Reference 2: ieee80211-2012, page 404, Figure 8-12

The bit 11 should be bit 3 of second byte.
The bit 12 should be bit 4 of second byte.
The bit 13 should be bit 5 of second byte.


What did I miss??



-------------------------------------
static void bip_aad(struct sk_buff *skb, u8 *aad)
{
/* BIP AAD: FC(masked) || A1 || A2 || A3 */

/* FC type/subtype */
aad[0] = skb->data[0];
/* Mask FC Retry, PwrMgt, MoreData flags to zero */
aad[1] = skb->data[1] & ~(BIT(4) | BIT(5) | BIT(6));
/* A1 || A2 || A3 */
memcpy(aad + 2, skb->data + 4, 3 * ETH_ALEN);
}


2012-10-01 19:20:20

by Johannes Berg

[permalink] [raw]
Subject: Re: 802.11w bip_aad() bug ?

On Mon, 2012-10-01 at 15:13 +0000, Chaoxing Lin wrote:
> Gentlemen,
>
> In kernel/net/mac80211/wpa.c function bip_add is as below (in the end).
>
> I think the aad[1] should be
> aad[1] = skb->data[1] & ~(BIT(3) | BIT(4) | BIT(5));
>
>
> Reference 1: ieee802.11-2012 page 1212
> "FC-MPDU Frame Control field, with:
> 1) Retry bit (bit 11) masked to 0
> 2) Power Management bit (bit 12) masked to 0
> 3) More Data bit (bit 13) masked to 0"
>
> Reference 2: ieee80211-2012, page 404, Figure 8-12
>
> The bit 11 should be bit 3 of second byte.
> The bit 12 should be bit 4 of second byte.
> The bit 13 should be bit 5 of second byte.
>
>
> What did I miss??

Nothing, we just fixed that:
http://git.kernel.org/?p=linux/kernel/git/jberg/mac80211.git;a=commitdiff;h=33766368f6532313571534f9112b1796d6651bbe

(note that the URL might not be accessible yet, I pieced it together and
had evidently forgotten to push out this change before, so you may have
to wait for git.kernel.org to sync with the master)

johannes