Commit 1ea893fd authored by Dan Williams's avatar Dan Williams Committed by John W. Linville

hostap: convert usage of net/ieee80211.h to linux/ieee80211.h

So that net/ieee80211.h can be made private to ipw2x00 in a follow-up.
Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4d8faf69
...@@ -31,7 +31,7 @@ void hostap_dump_rx_header(const char *name, ...@@ -31,7 +31,7 @@ void hostap_dump_rx_header(const char *name,
void hostap_dump_tx_header(const char *name, void hostap_dump_tx_header(const char *name,
const struct hfa384x_tx_frame *tx); const struct hfa384x_tx_frame *tx);
extern const struct header_ops hostap_80211_ops; extern const struct header_ops hostap_80211_ops;
int hostap_80211_get_hdrlen(u16 fc); int hostap_80211_get_hdrlen(__le16 fc);
struct net_device_stats *hostap_get_stats(struct net_device *dev); struct net_device_stats *hostap_get_stats(struct net_device *dev);
void hostap_setup_dev(struct net_device *dev, local_info_t *local, void hostap_setup_dev(struct net_device *dev, local_info_t *local,
int type); int type);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define HOSTAP_80211_H #define HOSTAP_80211_H
#include <linux/types.h> #include <linux/types.h>
#include <net/ieee80211.h> #include <linux/skbuff.h>
struct hostap_ieee80211_mgmt { struct hostap_ieee80211_mgmt {
__le16 frame_control; __le16 frame_control;
......
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <net/lib80211.h> #include <net/lib80211.h>
#include <linux/if_arp.h>
#include "hostap_80211.h" #include "hostap_80211.h"
#include "hostap.h" #include "hostap.h"
...@@ -17,10 +18,10 @@ static unsigned char bridge_tunnel_header[] = ...@@ -17,10 +18,10 @@ static unsigned char bridge_tunnel_header[] =
void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
struct hostap_80211_rx_status *rx_stats) struct hostap_80211_rx_status *rx_stats)
{ {
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr *hdr;
u16 fc; u16 fc;
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d " printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d "
"jiffies=%ld\n", "jiffies=%ld\n",
...@@ -30,9 +31,10 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, ...@@ -30,9 +31,10 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
if (skb->len < 2) if (skb->len < 2)
return; return;
fc = le16_to_cpu(hdr->frame_ctl); fc = le16_to_cpu(hdr->frame_control);
printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s",
fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, fc, (fc & IEEE80211_FCTL_FTYPE) >> 2,
(fc & IEEE80211_FCTL_STYPE) >> 4,
fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
...@@ -42,7 +44,7 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, ...@@ -42,7 +44,7 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
} }
printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id),
le16_to_cpu(hdr->seq_ctl)); le16_to_cpu(hdr->seq_ctrl));
printk(KERN_DEBUG " A1=%pM", hdr->addr1); printk(KERN_DEBUG " A1=%pM", hdr->addr1);
printk(" A2=%pM", hdr->addr2); printk(" A2=%pM", hdr->addr2);
...@@ -63,7 +65,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, ...@@ -63,7 +65,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
int hdrlen, phdrlen, head_need, tail_need; int hdrlen, phdrlen, head_need, tail_need;
u16 fc; u16 fc;
int prism_header, ret; int prism_header, ret;
struct ieee80211_hdr_4addr *fhdr; struct ieee80211_hdr *fhdr;
iface = netdev_priv(dev); iface = netdev_priv(dev);
local = iface->local; local = iface->local;
...@@ -84,8 +86,8 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, ...@@ -84,8 +86,8 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
phdrlen = 0; phdrlen = 0;
} }
fhdr = (struct ieee80211_hdr_4addr *) skb->data; fhdr = (struct ieee80211_hdr *) skb->data;
fc = le16_to_cpu(fhdr->frame_ctl); fc = le16_to_cpu(fhdr->frame_control);
if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) {
printk(KERN_DEBUG "%s: dropped management frame with header " printk(KERN_DEBUG "%s: dropped management frame with header "
...@@ -94,7 +96,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, ...@@ -94,7 +96,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
return 0; return 0;
} }
hdrlen = hostap_80211_get_hdrlen(fc); hdrlen = hostap_80211_get_hdrlen(fhdr->frame_control);
/* check if there is enough room for extra data; if not, expand skb /* check if there is enough room for extra data; if not, expand skb
* buffer to be large enough for the changes */ * buffer to be large enough for the changes */
...@@ -247,21 +249,21 @@ prism2_frag_cache_find(local_info_t *local, unsigned int seq, ...@@ -247,21 +249,21 @@ prism2_frag_cache_find(local_info_t *local, unsigned int seq,
/* Called only as a tasklet (software IRQ) */ /* Called only as a tasklet (software IRQ) */
static struct sk_buff * static struct sk_buff *
prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr_4addr *hdr) prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr)
{ {
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
u16 sc; u16 sc;
unsigned int frag, seq; unsigned int frag, seq;
struct prism2_frag_entry *entry; struct prism2_frag_entry *entry;
sc = le16_to_cpu(hdr->seq_ctl); sc = le16_to_cpu(hdr->seq_ctrl);
frag = WLAN_GET_SEQ_FRAG(sc); frag = sc & IEEE80211_SCTL_FRAG;
seq = WLAN_GET_SEQ_SEQ(sc) >> 4; seq = (sc & IEEE80211_SCTL_SEQ) >> 4;
if (frag == 0) { if (frag == 0) {
/* Reserve enough space to fit maximum frame length */ /* Reserve enough space to fit maximum frame length */
skb = dev_alloc_skb(local->dev->mtu + skb = dev_alloc_skb(local->dev->mtu +
sizeof(struct ieee80211_hdr_4addr) + sizeof(struct ieee80211_hdr) +
8 /* LLC */ + 8 /* LLC */ +
2 /* alignment */ + 2 /* alignment */ +
8 /* WEP */ + ETH_ALEN /* WDS */); 8 /* WEP */ + ETH_ALEN /* WDS */);
...@@ -299,14 +301,14 @@ prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr_4addr *hdr) ...@@ -299,14 +301,14 @@ prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr_4addr *hdr)
/* Called only as a tasklet (software IRQ) */ /* Called only as a tasklet (software IRQ) */
static int prism2_frag_cache_invalidate(local_info_t *local, static int prism2_frag_cache_invalidate(local_info_t *local,
struct ieee80211_hdr_4addr *hdr) struct ieee80211_hdr *hdr)
{ {
u16 sc; u16 sc;
unsigned int seq; unsigned int seq;
struct prism2_frag_entry *entry; struct prism2_frag_entry *entry;
sc = le16_to_cpu(hdr->seq_ctl); sc = le16_to_cpu(hdr->seq_ctrl);
seq = WLAN_GET_SEQ_SEQ(sc) >> 4; seq = (sc & IEEE80211_SCTL_SEQ) >> 4;
entry = prism2_frag_cache_find(local, seq, -1, hdr->addr2, hdr->addr1); entry = prism2_frag_cache_find(local, seq, -1, hdr->addr2, hdr->addr1);
...@@ -472,10 +474,8 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb, ...@@ -472,10 +474,8 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb,
struct hostap_80211_rx_status *rx_stats, u16 type, struct hostap_80211_rx_status *rx_stats, u16 type,
u16 stype) u16 stype)
{ {
if (local->iw_mode == IW_MODE_MASTER) { if (local->iw_mode == IW_MODE_MASTER)
hostap_update_sta_ps(local, (struct ieee80211_hdr_4addr *) hostap_update_sta_ps(local, (struct ieee80211_hdr *) skb->data);
skb->data);
}
if (local->hostapd && type == IEEE80211_FTYPE_MGMT) { if (local->hostapd && type == IEEE80211_FTYPE_MGMT) {
if (stype == IEEE80211_STYPE_BEACON && if (stype == IEEE80211_STYPE_BEACON &&
...@@ -552,8 +552,8 @@ static struct net_device *prism2_rx_get_wds(local_info_t *local, ...@@ -552,8 +552,8 @@ static struct net_device *prism2_rx_get_wds(local_info_t *local,
static int static int
hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr, hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, u16 fc,
u16 fc, struct net_device **wds) struct net_device **wds)
{ {
/* FIX: is this really supposed to accept WDS frames only in Master /* FIX: is this really supposed to accept WDS frames only in Master
* mode? What about Repeater or Managed with WDS frames? */ * mode? What about Repeater or Managed with WDS frames? */
...@@ -611,14 +611,14 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb) ...@@ -611,14 +611,14 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb)
{ {
struct net_device *dev = local->dev; struct net_device *dev = local->dev;
u16 fc, ethertype; u16 fc, ethertype;
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr *hdr;
u8 *pos; u8 *pos;
if (skb->len < 24) if (skb->len < 24)
return 0; return 0;
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
fc = le16_to_cpu(hdr->frame_ctl); fc = le16_to_cpu(hdr->frame_control);
/* check that the frame is unicast frame to us */ /* check that the frame is unicast frame to us */
if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
...@@ -651,14 +651,14 @@ static int ...@@ -651,14 +651,14 @@ static int
hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
struct lib80211_crypt_data *crypt) struct lib80211_crypt_data *crypt)
{ {
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr *hdr;
int res, hdrlen; int res, hdrlen;
if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
return 0; return 0;
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); hdrlen = hostap_80211_get_hdrlen(hdr->frame_control);
if (local->tkip_countermeasures && if (local->tkip_countermeasures &&
strcmp(crypt->ops->name, "TKIP") == 0) { strcmp(crypt->ops->name, "TKIP") == 0) {
...@@ -689,14 +689,14 @@ static int ...@@ -689,14 +689,14 @@ static int
hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb,
int keyidx, struct lib80211_crypt_data *crypt) int keyidx, struct lib80211_crypt_data *crypt)
{ {
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr *hdr;
int res, hdrlen; int res, hdrlen;
if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) if (crypt == NULL || crypt->ops->decrypt_msdu == NULL)
return 0; return 0;
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); hdrlen = hostap_80211_get_hdrlen(hdr->frame_control);
atomic_inc(&crypt->refcnt); atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
...@@ -720,7 +720,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -720,7 +720,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr *hdr;
size_t hdrlen; size_t hdrlen;
u16 fc, type, stype, sc; u16 fc, type, stype, sc;
struct net_device *wds = NULL; struct net_device *wds = NULL;
...@@ -747,18 +747,18 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -747,18 +747,18 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
dev = local->ddev; dev = local->ddev;
iface = netdev_priv(dev); iface = netdev_priv(dev);
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
stats = hostap_get_stats(dev); stats = hostap_get_stats(dev);
if (skb->len < 10) if (skb->len < 10)
goto rx_dropped; goto rx_dropped;
fc = le16_to_cpu(hdr->frame_ctl); fc = le16_to_cpu(hdr->frame_control);
type = WLAN_FC_GET_TYPE(fc); type = fc & IEEE80211_FCTL_FTYPE;
stype = WLAN_FC_GET_STYPE(fc); stype = fc & IEEE80211_FCTL_STYPE;
sc = le16_to_cpu(hdr->seq_ctl); sc = le16_to_cpu(hdr->seq_ctrl);
frag = WLAN_GET_SEQ_FRAG(sc); frag = sc & IEEE80211_SCTL_FRAG;
hdrlen = hostap_80211_get_hdrlen(fc); hdrlen = hostap_80211_get_hdrlen(hdr->frame_control);
/* Put this code here so that we avoid duplicating it in all /* Put this code here so that we avoid duplicating it in all
* Rx paths. - Jean II */ * Rx paths. - Jean II */
...@@ -918,7 +918,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -918,7 +918,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) &&
(keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
goto rx_dropped; goto rx_dropped;
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
/* skb: hdr + (possibly fragmented) plaintext payload */ /* skb: hdr + (possibly fragmented) plaintext payload */
...@@ -931,7 +931,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -931,7 +931,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
printk(KERN_DEBUG "%s: Rx cannot get skb from " printk(KERN_DEBUG "%s: Rx cannot get skb from "
"fragment cache (morefrag=%d seq=%u frag=%u)\n", "fragment cache (morefrag=%d seq=%u frag=%u)\n",
dev->name, (fc & IEEE80211_FCTL_MOREFRAGS) != 0, dev->name, (fc & IEEE80211_FCTL_MOREFRAGS) != 0,
WLAN_GET_SEQ_SEQ(sc) >> 4, frag); (sc & IEEE80211_SCTL_SEQ) >> 4, frag);
goto rx_dropped; goto rx_dropped;
} }
...@@ -972,7 +972,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -972,7 +972,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
/* this was the last fragment and the frame will be /* this was the last fragment and the frame will be
* delivered, so remove skb from fragment cache */ * delivered, so remove skb from fragment cache */
skb = frag_skb; skb = frag_skb;
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
prism2_frag_cache_invalidate(local, hdr); prism2_frag_cache_invalidate(local, hdr);
} }
...@@ -983,7 +983,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -983,7 +983,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt))
goto rx_dropped; goto rx_dropped;
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) { if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) {
if (local->ieee_802_1x && if (local->ieee_802_1x &&
hostap_is_eapol_frame(local, skb)) { hostap_is_eapol_frame(local, skb)) {
......
...@@ -15,10 +15,10 @@ static unsigned char bridge_tunnel_header[] = ...@@ -15,10 +15,10 @@ static unsigned char bridge_tunnel_header[] =
void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) void hostap_dump_tx_80211(const char *name, struct sk_buff *skb)
{ {
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr *hdr;
u16 fc; u16 fc;
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n", printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n",
name, skb->len, jiffies); name, skb->len, jiffies);
...@@ -26,9 +26,10 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) ...@@ -26,9 +26,10 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb)
if (skb->len < 2) if (skb->len < 2)
return; return;
fc = le16_to_cpu(hdr->frame_ctl); fc = le16_to_cpu(hdr->frame_control);
printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s",
fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, fc, (fc & IEEE80211_FCTL_FTYPE) >> 2,
(fc & IEEE80211_FCTL_STYPE) >> 4,
fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
...@@ -38,7 +39,7 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) ...@@ -38,7 +39,7 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb)
} }
printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id),
le16_to_cpu(hdr->seq_ctl)); le16_to_cpu(hdr->seq_ctrl));
printk(KERN_DEBUG " A1=%pM", hdr->addr1); printk(KERN_DEBUG " A1=%pM", hdr->addr1);
printk(" A2=%pM", hdr->addr2); printk(" A2=%pM", hdr->addr2);
...@@ -57,7 +58,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -57,7 +58,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
int need_headroom, need_tailroom = 0; int need_headroom, need_tailroom = 0;
struct ieee80211_hdr_4addr hdr; struct ieee80211_hdr hdr;
u16 fc, ethertype = 0; u16 fc, ethertype = 0;
enum { enum {
WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME
...@@ -201,7 +202,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -201,7 +202,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
memcpy(&hdr.addr3, local->bssid, ETH_ALEN); memcpy(&hdr.addr3, local->bssid, ETH_ALEN);
} }
hdr.frame_ctl = cpu_to_le16(fc); hdr.frame_control = cpu_to_le16(fc);
skb_pull(skb, skip_header_bytes); skb_pull(skb, skip_header_bytes);
need_headroom = local->func->need_tx_headroom + hdr_len + encaps_len; need_headroom = local->func->need_tx_headroom + hdr_len + encaps_len;
...@@ -265,7 +266,7 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -265,7 +266,7 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
struct hostap_skb_tx_data *meta; struct hostap_skb_tx_data *meta;
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr *hdr;
u16 fc; u16 fc;
iface = netdev_priv(dev); iface = netdev_priv(dev);
...@@ -287,10 +288,10 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -287,10 +288,10 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
meta->iface = iface; meta->iface = iface;
if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) {
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
fc = le16_to_cpu(hdr->frame_ctl); fc = le16_to_cpu(hdr->frame_control);
if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && if (ieee80211_is_data(hdr->frame_control) &&
WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) { (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_DATA) {
u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN + u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN +
sizeof(rfc1042_header)]; sizeof(rfc1042_header)];
meta->ethertype = (pos[0] << 8) | pos[1]; meta->ethertype = (pos[0] << 8) | pos[1];
...@@ -310,8 +311,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, ...@@ -310,8 +311,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
{ {
struct hostap_interface *iface; struct hostap_interface *iface;
local_info_t *local; local_info_t *local;
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr *hdr;
u16 fc;
int prefix_len, postfix_len, hdr_len, res; int prefix_len, postfix_len, hdr_len, res;
iface = netdev_priv(skb->dev); iface = netdev_priv(skb->dev);
...@@ -324,7 +324,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, ...@@ -324,7 +324,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
if (local->tkip_countermeasures && if (local->tkip_countermeasures &&
strcmp(crypt->ops->name, "TKIP") == 0) { strcmp(crypt->ops->name, "TKIP") == 0) {
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
"TX packet to %pM\n", "TX packet to %pM\n",
...@@ -349,9 +349,8 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, ...@@ -349,9 +349,8 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
return NULL; return NULL;
} }
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
fc = le16_to_cpu(hdr->frame_ctl); hdr_len = hostap_80211_get_hdrlen(hdr->frame_control);
hdr_len = hostap_80211_get_hdrlen(fc);
/* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so
* call both MSDU and MPDU encryption functions from here. */ * call both MSDU and MPDU encryption functions from here. */
...@@ -384,7 +383,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -384,7 +383,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
ap_tx_ret tx_ret; ap_tx_ret tx_ret;
struct hostap_skb_tx_data *meta; struct hostap_skb_tx_data *meta;
int no_encrypt = 0; int no_encrypt = 0;
struct ieee80211_hdr_4addr *hdr; struct ieee80211_hdr *hdr;
iface = netdev_priv(dev); iface = netdev_priv(dev);
local = iface->local; local = iface->local;
...@@ -427,14 +426,14 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -427,14 +426,14 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
tx_ret = hostap_handle_sta_tx(local, &tx); tx_ret = hostap_handle_sta_tx(local, &tx);
skb = tx.skb; skb = tx.skb;
meta = (struct hostap_skb_tx_data *) skb->cb; meta = (struct hostap_skb_tx_data *) skb->cb;
hdr = (struct ieee80211_hdr_4addr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
fc = le16_to_cpu(hdr->frame_ctl); fc = le16_to_cpu(hdr->frame_control);
switch (tx_ret) { switch (tx_ret) {
case AP_TX_CONTINUE: case AP_TX_CONTINUE:
break; break;
case AP_TX_CONTINUE_NOT_AUTHORIZED: case AP_TX_CONTINUE_NOT_AUTHORIZED:
if (local->ieee_802_1x && if (local->ieee_802_1x &&
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && ieee80211_is_data(hdr->frame_control) &&
meta->ethertype != ETH_P_PAE && meta->ethertype != ETH_P_PAE &&
!(meta->flags & HOSTAP_TX_FLAGS_WDS)) { !(meta->flags & HOSTAP_TX_FLAGS_WDS)) {
printk(KERN_DEBUG "%s: dropped frame to unauthorized " printk(KERN_DEBUG "%s: dropped frame to unauthorized "
...@@ -469,10 +468,10 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -469,10 +468,10 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* remove special version from the frame header */ /* remove special version from the frame header */
fc &= ~IEEE80211_FCTL_VERS; fc &= ~IEEE80211_FCTL_VERS;
hdr->frame_ctl = cpu_to_le16(fc); hdr->frame_control = cpu_to_le16(fc);
} }
if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_DATA) { if (!ieee80211_is_data(hdr->frame_control)) {
no_encrypt = 1; no_encrypt = 1;
tx.crypt = NULL; tx.crypt = NULL;
} }
...@@ -493,9 +492,9 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -493,9 +492,9 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Add ISWEP flag both for firmware and host based encryption /* Add ISWEP flag both for firmware and host based encryption
*/ */
fc |= IEEE80211_FCTL_PROTECTED; fc |= IEEE80211_FCTL_PROTECTED;
hdr->frame_ctl = cpu_to_le16(fc); hdr->frame_control = cpu_to_le16(fc);
} else if (local->drop_unencrypted && } else if (local->drop_unencrypted &&
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && ieee80211_is_data(hdr->frame_control) &&
meta->ethertype != ETH_P_PAE) { meta->ethertype != ETH_P_PAE) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "%s: dropped unencrypted TX data " printk(KERN_DEBUG "%s: dropped unencrypted TX data "
......
This diff is collapsed.
...@@ -235,7 +235,7 @@ struct hostap_tx_data { ...@@ -235,7 +235,7 @@ struct hostap_tx_data {
ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx);
void hostap_handle_sta_release(void *ptr); void hostap_handle_sta_release(void *ptr);
void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb); void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb);
int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr); int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr);
typedef enum { typedef enum {
AP_RX_CONTINUE, AP_RX_DROP, AP_RX_EXIT, AP_RX_CONTINUE_NOT_AUTHORIZED AP_RX_CONTINUE, AP_RX_DROP, AP_RX_EXIT, AP_RX_CONTINUE_NOT_AUTHORIZED
} ap_rx_ret; } ap_rx_ret;
...@@ -243,13 +243,13 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, ...@@ -243,13 +243,13 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
struct sk_buff *skb, struct sk_buff *skb,
struct hostap_80211_rx_status *rx_stats, struct hostap_80211_rx_status *rx_stats,
int wds); int wds);
int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr_4addr *hdr, int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr *hdr,
struct lib80211_crypt_data **crypt, struct lib80211_crypt_data **crypt,
void **sta_ptr); void **sta_ptr);
int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr);
int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr);
int hostap_add_sta(struct ap_data *ap, u8 *sta_addr); int hostap_add_sta(struct ap_data *ap, u8 *sta_addr);
int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr_4addr *hdr, int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr *hdr,
struct hostap_80211_rx_status *rx_stats); struct hostap_80211_rx_status *rx_stats);
void hostap_update_rates(local_info_t *local); void hostap_update_rates(local_info_t *local);
void hostap_add_wds_links(local_info_t *local); void hostap_add_wds_links(local_info_t *local);
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/wireless.h> #include <linux/wireless.h>
#include <net/iw_handler.h> #include <net/iw_handler.h>
#include <net/ieee80211.h>
#include <net/lib80211.h> #include <net/lib80211.h>
#include <asm/irq.h> #include <asm/irq.h>
...@@ -1840,8 +1839,8 @@ static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev) ...@@ -1840,8 +1839,8 @@ static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev)
hdr_len = 24; hdr_len = 24;
skb_copy_from_linear_data(skb, &txdesc.frame_control, hdr_len); skb_copy_from_linear_data(skb, &txdesc.frame_control, hdr_len);
fc = le16_to_cpu(txdesc.frame_control); fc = le16_to_cpu(txdesc.frame_control);
if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && if (ieee80211_is_data(txdesc.frame_control) &&
(fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS) && ieee80211_has_a4(txdesc.frame_control) &&
skb->len >= 30) { skb->len >= 30) {
/* Addr4 */ /* Addr4 */
skb_copy_from_linear_data_offset(skb, hdr_len, txdesc.addr4, skb_copy_from_linear_data_offset(skb, hdr_len, txdesc.addr4,
...@@ -2082,7 +2081,7 @@ static void hostap_rx_skb(local_info_t *local, struct sk_buff *skb) ...@@ -2082,7 +2081,7 @@ static void hostap_rx_skb(local_info_t *local, struct sk_buff *skb)
stats.rate = rxdesc->rate; stats.rate = rxdesc->rate;
/* Convert Prism2 RX structure into IEEE 802.11 header */ /* Convert Prism2 RX structure into IEEE 802.11 header */
hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(rxdesc->frame_control)); hdrlen = hostap_80211_get_hdrlen(rxdesc->frame_control);
if (hdrlen > rx_hdrlen) if (hdrlen > rx_hdrlen)
hdrlen = rx_hdrlen; hdrlen = rx_hdrlen;
...@@ -2204,7 +2203,7 @@ static void hostap_tx_callback(local_info_t *local, ...@@ -2204,7 +2203,7 @@ static void hostap_tx_callback(local_info_t *local,
return; return;
} }
hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(txdesc->frame_control)); hdrlen = hostap_80211_get_hdrlen(txdesc->frame_control);
len = le16_to_cpu(txdesc->data_len); len = le16_to_cpu(txdesc->data_len);
skb = dev_alloc_skb(hdrlen + len); skb = dev_alloc_skb(hdrlen + len);
if (skb == NULL) { if (skb == NULL) {
...@@ -2315,8 +2314,7 @@ static void hostap_sta_tx_exc_tasklet(unsigned long data) ...@@ -2315,8 +2314,7 @@ static void hostap_sta_tx_exc_tasklet(unsigned long data)
if (skb->len >= sizeof(*txdesc)) { if (skb->len >= sizeof(*txdesc)) {
/* Convert Prism2 RX structure into IEEE 802.11 header /* Convert Prism2 RX structure into IEEE 802.11 header
*/ */
u16 fc = le16_to_cpu(txdesc->frame_control); int hdrlen = hostap_80211_get_hdrlen(txdesc->frame_control);
int hdrlen = hostap_80211_get_hdrlen(fc);
memmove(skb_pull(skb, sizeof(*txdesc) - hdrlen), memmove(skb_pull(skb, sizeof(*txdesc) - hdrlen),
&txdesc->frame_control, hdrlen); &txdesc->frame_control, hdrlen);
...@@ -2394,12 +2392,12 @@ static void prism2_txexc(local_info_t *local) ...@@ -2394,12 +2392,12 @@ static void prism2_txexc(local_info_t *local)
PDEBUG(DEBUG_EXTRA, " retry_count=%d tx_rate=%d fc=0x%04x " PDEBUG(DEBUG_EXTRA, " retry_count=%d tx_rate=%d fc=0x%04x "
"(%s%s%s::%d%s%s)\n", "(%s%s%s::%d%s%s)\n",
txdesc.retry_count, txdesc.tx_rate, fc, txdesc.retry_count, txdesc.tx_rate, fc,
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT ? "Mgmt" : "", ieee80211_is_mgmt(txdesc.frame_control) ? "Mgmt" : "",
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "", ieee80211_is_ctl(txdesc.frame_control) ? "Ctrl" : "",
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "", ieee80211_is_data(txdesc.frame_control) ? "Data" : "",
WLAN_FC_GET_STYPE(fc) >> 4, (fc & IEEE80211_FCTL_STYPE) >> 4,
fc & IEEE80211_FCTL_TODS ? " ToDS" : "", ieee80211_has_tods(txdesc.frame_control) ? " ToDS" : "",
fc & IEEE80211_FCTL_FROMDS ? " FromDS" : ""); ieee80211_has_fromds(txdesc.frame_control) ? " FromDS" : "");
PDEBUG(DEBUG_EXTRA, " A1=%pM A2=%pM A3=%pM A4=%pM\n", PDEBUG(DEBUG_EXTRA, " A1=%pM A2=%pM A3=%pM A4=%pM\n",
txdesc.addr1, txdesc.addr2, txdesc.addr1, txdesc.addr2,
txdesc.addr3, txdesc.addr4); txdesc.addr3, txdesc.addr4);
......
/* Host AP driver Info Frame processing (part of hostap.o module) */ /* Host AP driver Info Frame processing (part of hostap.o module) */
#include <linux/if_arp.h>
#include "hostap_wlan.h" #include "hostap_wlan.h"
#include "hostap.h" #include "hostap.h"
#include "hostap_ap.h" #include "hostap_ap.h"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/if_arp.h>
#include <net/lib80211.h> #include <net/lib80211.h>
#include "hostap_wlan.h" #include "hostap_wlan.h"
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <net/net_namespace.h> #include <net/net_namespace.h>
#include <net/iw_handler.h> #include <net/iw_handler.h>
#include <net/ieee80211.h>
#include <net/lib80211.h> #include <net/lib80211.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -543,7 +542,8 @@ void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx) ...@@ -543,7 +542,8 @@ void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx)
fc = __le16_to_cpu(rx->frame_control); fc = __le16_to_cpu(rx->frame_control);
printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x "
"data_len=%d%s%s\n", "data_len=%d%s%s\n",
fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, fc, (fc & IEEE80211_FCTL_FTYPE) >> 2,
(fc & IEEE80211_FCTL_STYPE) >> 4,
__le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl), __le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl),
__le16_to_cpu(rx->data_len), __le16_to_cpu(rx->data_len),
fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
...@@ -570,7 +570,8 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx) ...@@ -570,7 +570,8 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
fc = __le16_to_cpu(tx->frame_control); fc = __le16_to_cpu(tx->frame_control);
printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x "
"data_len=%d%s%s\n", "data_len=%d%s%s\n",
fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, fc, (fc & IEEE80211_FCTL_FTYPE) >> 2,
(fc & IEEE80211_FCTL_STYPE) >> 4,
__le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl), __le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl),
__le16_to_cpu(tx->data_len), __le16_to_cpu(tx->data_len),
fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
...@@ -593,29 +594,16 @@ static int hostap_80211_header_parse(const struct sk_buff *skb, ...@@ -593,29 +594,16 @@ static int hostap_80211_header_parse(const struct sk_buff *skb,
} }
int hostap_80211_get_hdrlen(u16 fc) int hostap_80211_get_hdrlen(__le16 fc)
{ {
int hdrlen = 24; if (ieee80211_is_data(fc) && ieee80211_has_a4 (fc))
return 30; /* Addr4 */
switch (WLAN_FC_GET_TYPE(fc)) { else if (ieee80211_is_cts(fc) || ieee80211_is_ack(fc))
case IEEE80211_FTYPE_DATA: return 10;
if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) else if (ieee80211_is_ctl(fc))
hdrlen = 30; /* Addr4 */ return 16;
break;
case IEEE80211_FTYPE_CTL: return 24;
switch (WLAN_FC_GET_STYPE(fc)) {
case IEEE80211_STYPE_CTS:
case IEEE80211_STYPE_ACK:
hdrlen = 10;
break;
default:
hdrlen = 16;
break;
}
break;
}
return hdrlen;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment