* [PATCH 6/7] mac80211: wpa.c use new access helpers
@ 2008-06-06 17:51 Harvey Harrison
0 siblings, 0 replies; only message in thread
From: Harvey Harrison @ 2008-06-06 17:51 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
net/mac80211/wpa.c | 46 +++++++++++-----------------------------------
1 files changed, 11 insertions(+), 35 deletions(-)
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 9f6fd20..21a795f 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -24,46 +24,22 @@ static int ieee80211_get_hdr_info(const struct sk_buff *skb, u8 **sa, u8 **da,
{
struct ieee80211_hdr *hdr;
size_t hdrlen;
- u16 fc;
- int a4_included;
- u8 *pos;
+ __le16 fc;
- hdr = (struct ieee80211_hdr *) skb->data;
- fc = le16_to_cpu(hdr->frame_control);
+ hdr = (struct ieee80211_hdr *)skb->data;
+ fc = hdr->frame_control;
- hdrlen = 24;
- if ((fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) ==
- (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
- hdrlen += ETH_ALEN;
- *sa = hdr->addr4;
- *da = hdr->addr3;
- } else if (fc & IEEE80211_FCTL_FROMDS) {
- *sa = hdr->addr3;
- *da = hdr->addr1;
- } else if (fc & IEEE80211_FCTL_TODS) {
- *sa = hdr->addr2;
- *da = hdr->addr3;
- } else {
- *sa = hdr->addr2;
- *da = hdr->addr1;
- }
+ hdrlen = ieee80211_hdrlen(fc);
- if (fc & 0x80)
- hdrlen += 2;
+ *sa = ieee80211_get_SA(hdr);
+ *da = ieee80211_get_DA(hdr);
*data = skb->data + hdrlen;
*data_len = skb->len - hdrlen;
- a4_included = (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
- (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
- if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA &&
- fc & IEEE80211_STYPE_QOS_DATA) {
- pos = (u8 *) &hdr->addr4;
- if (a4_included)
- pos += 6;
- *qos_tid = pos[0] & 0x0f;
- *qos_tid |= 0x80; /* qos_included flag */
- } else
+ if (ieee80211_data_has_qos(fc))
+ *qos_tid = (*ieee80211_get_qos_ctl(hdr, hdrlen) & 0x0f) | 0x80;
+ else
*qos_tid = 0;
return skb->len < hdrlen ? -1 : 0;
--
1.5.6.rc1.257.gba91d
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-06-06 18:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-06 17:51 [PATCH 6/7] mac80211: wpa.c use new access helpers Harvey Harrison
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.