Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102966
b: refs/heads/master
c: 6693be7
h: refs/heads/master
v: v3
  • Loading branch information
Harvey Harrison authored and John W. Linville committed Jun 14, 2008
1 parent 05e7105 commit 237ce4f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c9c6950c14ffc0e30e592fec1ebcb203ad3dff10
refs/heads/master: 6693be7124cb8e4f15f0d80ed6e3e50678771737
6 changes: 6 additions & 0 deletions trunk/include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,12 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
*/
int ieee80211_get_hdrlen(u16 fc);

/**
* ieee80211_hdrlen - get header length in bytes from frame control
* @fc: frame control field in little-endian format
*/
unsigned int ieee80211_hdrlen(__le16 fc);

/**
* ieee80211_get_tkip_key - get a TKIP rc4 for skb
*
Expand Down
32 changes: 32 additions & 0 deletions trunk/net/mac80211/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,38 @@ int ieee80211_get_hdrlen(u16 fc)
}
EXPORT_SYMBOL(ieee80211_get_hdrlen);

unsigned int ieee80211_hdrlen(__le16 fc)
{
unsigned int hdrlen = 24;

if (ieee80211_is_data(fc)) {
if (ieee80211_has_a4(fc))
hdrlen = 30;
if (ieee80211_is_data_qos(fc))
hdrlen += IEEE80211_QOS_CTL_LEN;
goto out;
}

if (ieee80211_is_ctl(fc)) {
/*
* ACK and CTS are 10 bytes, all others 16. To see how
* to get this condition consider
* subtype mask: 0b0000000011110000 (0x00F0)
* ACK subtype: 0b0000000011010000 (0x00D0)
* CTS subtype: 0b0000000011000000 (0x00C0)
* bits that matter: ^^^ (0x00E0)
* value of those: 0b0000000011000000 (0x00C0)
*/
if ((fc & cpu_to_le16(0x00E0)) == cpu_to_le16(0x00C0))
hdrlen = 10;
else
hdrlen = 16;
}
out:
return hdrlen;
}
EXPORT_SYMBOL(ieee80211_hdrlen);

unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb)
{
const struct ieee80211_hdr *hdr = (const struct ieee80211_hdr *)skb->data;
Expand Down

0 comments on commit 237ce4f

Please sign in to comment.