void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
struct hostap_80211_rx_status *rx_stats)
{
- struct hostap_ieee80211_hdr *hdr;
+ struct ieee80211_hdr_4addr *hdr;
u16 fc;
- hdr = (struct hostap_ieee80211_hdr *) skb->data;
+ hdr = (struct ieee80211_hdr_4addr *) skb->data;
printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d "
"jiffies=%ld\n",
if (skb->len < 2)
return;
- fc = le16_to_cpu(hdr->frame_control);
+ fc = le16_to_cpu(hdr->frame_ctl);
printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s",
- fc, WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc),
- fc & WLAN_FC_TODS ? " [ToDS]" : "",
- fc & WLAN_FC_FROMDS ? " [FromDS]" : "");
+ fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
+ fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
+ fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
if (skb->len < IEEE80211_DATA_HDR3_LEN) {
printk("\n");
}
printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id),
- le16_to_cpu(hdr->seq_ctrl));
+ le16_to_cpu(hdr->seq_ctl));
printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR,
MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr3));
int hdrlen, phdrlen, head_need, tail_need;
u16 fc;
int prism_header, ret;
- struct hostap_ieee80211_hdr *hdr;
+ struct ieee80211_hdr_4addr *hdr;
iface = netdev_priv(dev);
local = iface->local;
phdrlen = 0;
}
- hdr = (struct hostap_ieee80211_hdr *) skb->data;
- fc = le16_to_cpu(hdr->frame_control);
+ hdr = (struct ieee80211_hdr_4addr *) skb->data;
+ fc = le16_to_cpu(hdr->frame_ctl);
- if (type == PRISM2_RX_MGMT && (fc & WLAN_FC_PVER)) {
+ if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) {
printk(KERN_DEBUG "%s: dropped management frame with header "
- "version %d\n", dev->name, fc & WLAN_FC_PVER);
+ "version %d\n", dev->name, fc & IEEE80211_FCTL_VERS);
dev_kfree_skb_any(skb);
return 0;
}
hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
- LWNG_SETVAL(mactime, 2, 0, 0, rx_stats->mac_time);
+ LWNG_SETVAL(mactime, 2, 0, 4, rx_stats->mac_time);
LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-prism2_frag_cache_get(local_info_t *local, struct hostap_ieee80211_hdr *hdr)
+prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr_4addr *hdr)
{
struct sk_buff *skb = NULL;
u16 sc;
unsigned int frag, seq;
struct prism2_frag_entry *entry;
- sc = le16_to_cpu(hdr->seq_ctrl);
+ sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
- seq = WLAN_GET_SEQ_SEQ(sc);
+ seq = WLAN_GET_SEQ_SEQ(sc) >> 4;
if (frag == 0) {
/* Reserve enough space to fit maximum frame length */
skb = dev_alloc_skb(local->dev->mtu +
- sizeof(struct hostap_ieee80211_hdr) +
+ sizeof(struct ieee80211_hdr_4addr) +
8 /* LLC */ +
2 /* alignment */ +
8 /* WEP */ + ETH_ALEN /* WDS */);
/* Called only as a tasklet (software IRQ) */
static int prism2_frag_cache_invalidate(local_info_t *local,
- struct hostap_ieee80211_hdr *hdr)
+ struct ieee80211_hdr_4addr *hdr)
{
u16 sc;
unsigned int seq;
struct prism2_frag_entry *entry;
- sc = le16_to_cpu(hdr->seq_ctrl);
- seq = WLAN_GET_SEQ_SEQ(sc);
+ sc = le16_to_cpu(hdr->seq_ctl);
+ seq = WLAN_GET_SEQ_SEQ(sc) >> 4;
entry = prism2_frag_cache_find(local, seq, -1, hdr->addr2, hdr->addr1);
u16 stype)
{
if (local->iw_mode == IW_MODE_MASTER) {
- hostap_update_sta_ps(local, (struct hostap_ieee80211_hdr *)
+ hostap_update_sta_ps(local, (struct ieee80211_hdr_4addr *)
skb->data);
}
- if (local->hostapd && type == WLAN_FC_TYPE_MGMT) {
- if (stype == WLAN_FC_STYPE_BEACON &&
+ if (local->hostapd && type == IEEE80211_FTYPE_MGMT) {
+ if (stype == IEEE80211_STYPE_BEACON &&
local->iw_mode == IW_MODE_MASTER) {
struct sk_buff *skb2;
/* Process beacon frames also in kernel driver to
}
if (local->iw_mode == IW_MODE_MASTER) {
- if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) {
+ if (type != IEEE80211_FTYPE_MGMT &&
+ type != IEEE80211_FTYPE_CTL) {
printk(KERN_DEBUG "%s: unknown management frame "
"(type=0x%02x, stype=0x%02x) dropped\n",
- skb->dev->name, type, stype);
+ skb->dev->name, type >> 2, stype >> 4);
return -1;
}
hostap_rx(skb->dev, skb, rx_stats);
return 0;
- } else if (type == WLAN_FC_TYPE_MGMT &&
- (stype == WLAN_FC_STYPE_BEACON ||
- stype == WLAN_FC_STYPE_PROBE_RESP)) {
+ } else if (type == IEEE80211_FTYPE_MGMT &&
+ (stype == IEEE80211_STYPE_BEACON ||
+ stype == IEEE80211_STYPE_PROBE_RESP)) {
hostap_rx_sta_beacon(local, skb, stype);
return -1;
- } else if (type == WLAN_FC_TYPE_MGMT &&
- (stype == WLAN_FC_STYPE_ASSOC_RESP ||
- stype == WLAN_FC_STYPE_REASSOC_RESP)) {
+ } else if (type == IEEE80211_FTYPE_MGMT &&
+ (stype == IEEE80211_STYPE_ASSOC_RESP ||
+ stype == IEEE80211_STYPE_REASSOC_RESP)) {
/* Ignore (Re)AssocResp silently since these are not currently
* needed but are still received when WPA/RSN mode is enabled.
*/
} else {
printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: dropped unhandled"
" management frame in non-Host AP mode (type=%d:%d)\n",
- skb->dev->name, type, stype);
+ skb->dev->name, type >> 2, stype >> 4);
return -1;
}
}
static inline int
-hostap_rx_frame_wds(local_info_t *local, struct hostap_ieee80211_hdr *hdr,
+hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr,
u16 fc, struct net_device **wds)
{
/* FIX: is this really supposed to accept WDS frames only in Master
* mode? What about Repeater or Managed with WDS frames? */
- if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) !=
- (WLAN_FC_TODS | WLAN_FC_FROMDS) &&
- (local->iw_mode != IW_MODE_MASTER || !(fc & WLAN_FC_TODS)))
+ if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) !=
+ (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS) &&
+ (local->iw_mode != IW_MODE_MASTER || !(fc & IEEE80211_FCTL_TODS)))
return 0; /* not a WDS frame */
/* Possible WDS frame: either IEEE 802.11 compliant (if FromDS)
/* RA (or BSSID) is not ours - drop */
PDEBUG(DEBUG_EXTRA, "%s: received WDS frame with "
"not own or broadcast %s=" MACSTR "\n",
- local->dev->name, fc & WLAN_FC_FROMDS ? "RA" : "BSSID",
+ local->dev->name,
+ fc & IEEE80211_FCTL_FROMDS ? "RA" : "BSSID",
MAC2STR(hdr->addr1));
return -1;
}
/* check if the frame came from a registered WDS connection */
*wds = prism2_rx_get_wds(local, hdr->addr2);
- if (*wds == NULL && fc & WLAN_FC_FROMDS &&
+ if (*wds == NULL && fc & IEEE80211_FCTL_FROMDS &&
(local->iw_mode != IW_MODE_INFRA ||
!(local->wds_type & HOSTAP_WDS_AP_CLIENT) ||
memcmp(hdr->addr2, local->bssid, ETH_ALEN) != 0)) {
return -1;
}
- if (*wds && !(fc & WLAN_FC_FROMDS) && local->ap &&
+ if (*wds && !(fc & IEEE80211_FCTL_FROMDS) && local->ap &&
hostap_is_sta_assoc(local->ap, hdr->addr2)) {
/* STA is actually associated with us even though it has a
* registered WDS link. Assume it is in 'AP client' mode.
{
struct net_device *dev = local->dev;
u16 fc, ethertype;
- struct hostap_ieee80211_hdr *hdr;
+ struct ieee80211_hdr_4addr *hdr;
u8 *pos;
if (skb->len < 24)
return 0;
- hdr = (struct hostap_ieee80211_hdr *) skb->data;
- fc = le16_to_cpu(hdr->frame_control);
+ hdr = (struct ieee80211_hdr_4addr *) skb->data;
+ fc = le16_to_cpu(hdr->frame_ctl);
/* check that the frame is unicast frame to us */
- if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_TODS &&
+ if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
+ IEEE80211_FCTL_TODS &&
memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 &&
memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {
/* ToDS frame with own addr BSSID and DA */
- } else if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_FROMDS &&
+ } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
+ IEEE80211_FCTL_FROMDS &&
memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
/* FromDS frame with own addr as DA */
} else
/* Called only as a tasklet (software IRQ) */
static inline int
hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
- struct prism2_crypt_data *crypt)
+ struct ieee80211_crypt_data *crypt)
{
- struct hostap_ieee80211_hdr *hdr;
+ struct ieee80211_hdr_4addr *hdr;
int res, hdrlen;
if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
return 0;
- hdr = (struct hostap_ieee80211_hdr *) skb->data;
- hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
+ hdr = (struct ieee80211_hdr_4addr *) skb->data;
+ hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
if (local->tkip_countermeasures &&
strcmp(crypt->ops->name, "TKIP") == 0) {
/* Called only as a tasklet (software IRQ) */
static inline int
hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb,
- int keyidx, struct prism2_crypt_data *crypt)
+ int keyidx, struct ieee80211_crypt_data *crypt)
{
- struct hostap_ieee80211_hdr *hdr;
+ struct ieee80211_hdr_4addr *hdr;
int res, hdrlen;
if (crypt == NULL || crypt->ops->decrypt_msdu == NULL)
return 0;
- hdr = (struct hostap_ieee80211_hdr *) skb->data;
- hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
+ hdr = (struct ieee80211_hdr_4addr *) skb->data;
+ hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
{
struct hostap_interface *iface;
local_info_t *local;
- struct hostap_ieee80211_hdr *hdr;
+ struct ieee80211_hdr_4addr *hdr;
size_t hdrlen;
u16 fc, type, stype, sc;
struct net_device *wds = NULL;
int from_assoc_ap = 0;
u8 dst[ETH_ALEN];
u8 src[ETH_ALEN];
- struct prism2_crypt_data *crypt = NULL;
+ struct ieee80211_crypt_data *crypt = NULL;
void *sta = NULL;
int keyidx = 0;
dev = local->ddev;
iface = netdev_priv(dev);
- hdr = (struct hostap_ieee80211_hdr *) skb->data;
+ hdr = (struct ieee80211_hdr_4addr *) skb->data;
stats = hostap_get_stats(dev);
if (skb->len < 10)
goto rx_dropped;
- fc = le16_to_cpu(hdr->frame_control);
+ fc = le16_to_cpu(hdr->frame_ctl);
type = WLAN_FC_GET_TYPE(fc);
stype = WLAN_FC_GET_STYPE(fc);
- sc = le16_to_cpu(hdr->seq_ctrl);
+ sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
hdrlen = hostap_80211_get_hdrlen(fc);
struct iw_quality wstats;
wstats.level = rx_stats->signal;
wstats.noise = rx_stats->noise;
- wstats.updated = 6; /* No qual value */
+ wstats.updated = IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_UPDATED
+ | IW_QUAL_QUAL_INVALID | IW_QUAL_DBM;
/* Update spy records */
wireless_spy_update(dev, hdr->addr2, &wstats);
}
crypt->ops->decrypt_mpdu == NULL))
crypt = NULL;
- if (!crypt && (fc & WLAN_FC_ISWEP)) {
+ if (!crypt && (fc & IEEE80211_FCTL_PROTECTED)) {
#if 0
/* This seems to be triggered by some (multicast?)
* frames from other than current BSS, so just drop the
}
}
- if (type != WLAN_FC_TYPE_DATA) {
- if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_AUTH &&
- fc & WLAN_FC_ISWEP && local->host_decrypt &&
+ if (type != IEEE80211_FTYPE_DATA) {
+ if (type == IEEE80211_FTYPE_MGMT &&
+ stype == IEEE80211_STYPE_AUTH &&
+ fc & IEEE80211_FCTL_PROTECTED && local->host_decrypt &&
(keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
{
printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- switch (fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)) {
- case WLAN_FC_FROMDS:
+ switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
+ case IEEE80211_FCTL_FROMDS:
memcpy(dst, hdr->addr1, ETH_ALEN);
memcpy(src, hdr->addr3, ETH_ALEN);
break;
- case WLAN_FC_TODS:
+ case IEEE80211_FCTL_TODS:
memcpy(dst, hdr->addr3, ETH_ALEN);
memcpy(src, hdr->addr2, ETH_ALEN);
break;
- case WLAN_FC_FROMDS | WLAN_FC_TODS:
+ case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS:
if (skb->len < IEEE80211_DATA_HDR4_LEN)
goto rx_dropped;
memcpy(dst, hdr->addr3, ETH_ALEN);
}
if (local->iw_mode == IW_MODE_MASTER && !wds &&
- (fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_FROMDS &&
+ (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
+ IEEE80211_FCTL_FROMDS &&
local->stadev &&
memcmp(hdr->addr2, local->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
/* Nullfunc frames may have PS-bit set, so they must be passed to
* hostap_handle_sta_rx() before being dropped here. */
- if (stype != WLAN_FC_STYPE_DATA &&
- stype != WLAN_FC_STYPE_DATA_CFACK &&
- stype != WLAN_FC_STYPE_DATA_CFPOLL &&
- stype != WLAN_FC_STYPE_DATA_CFACKPOLL) {
- if (stype != WLAN_FC_STYPE_NULLFUNC)
+ if (stype != IEEE80211_STYPE_DATA &&
+ stype != IEEE80211_STYPE_DATA_CFACK &&
+ stype != IEEE80211_STYPE_DATA_CFPOLL &&
+ stype != IEEE80211_STYPE_DATA_CFACKPOLL) {
+ if (stype != IEEE80211_STYPE_NULLFUNC)
printk(KERN_DEBUG "%s: RX: dropped data frame "
"with no data (type=0x%02x, subtype=0x%02x)\n",
- dev->name, type, stype);
+ dev->name, type >> 2, stype >> 4);
goto rx_dropped;
}
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
- if (local->host_decrypt && (fc & WLAN_FC_ISWEP) &&
+ if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) &&
(keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
goto rx_dropped;
- hdr = (struct hostap_ieee80211_hdr *) skb->data;
+ hdr = (struct ieee80211_hdr_4addr *) skb->data;
/* skb: hdr + (possibly fragmented) plaintext payload */
- if (local->host_decrypt && (fc & WLAN_FC_ISWEP) &&
- (frag != 0 || (fc & WLAN_FC_MOREFRAG))) {
+ if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) &&
+ (frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
struct sk_buff *frag_skb =
prism2_frag_cache_get(local, hdr);
if (!frag_skb) {
printk(KERN_DEBUG "%s: Rx cannot get skb from "
"fragment cache (morefrag=%d seq=%u frag=%u)\n",
- dev->name, (fc & WLAN_FC_MOREFRAG) != 0,
- WLAN_GET_SEQ_SEQ(sc), frag);
+ dev->name, (fc & IEEE80211_FCTL_MOREFRAGS) != 0,
+ WLAN_GET_SEQ_SEQ(sc) >> 4, frag);
goto rx_dropped;
}
dev_kfree_skb(skb);
skb = NULL;
- if (fc & WLAN_FC_MOREFRAG) {
+ if (fc & IEEE80211_FCTL_MOREFRAGS) {
/* more fragments expected - leave the skb in fragment
* cache for now; it will be delivered to upper layers
* after all fragments have been received */
/* this was the last fragment and the frame will be
* delivered, so remove skb from fragment cache */
skb = frag_skb;
- hdr = (struct hostap_ieee80211_hdr *) skb->data;
+ hdr = (struct ieee80211_hdr_4addr *) skb->data;
prism2_frag_cache_invalidate(local, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
- if (local->host_decrypt && (fc & WLAN_FC_ISWEP) &&
+ if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) &&
hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt))
goto rx_dropped;
- hdr = (struct hostap_ieee80211_hdr *) skb->data;
- if (crypt && !(fc & WLAN_FC_ISWEP) && !local->open_wep) {
+ hdr = (struct ieee80211_hdr_4addr *) skb->data;
+ if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) {
if (local->ieee_802_1x &&
hostap_is_eapol_frame(local, skb)) {
/* pass unencrypted EAPOL frames even if encryption is
}
}
- if (local->drop_unencrypted && !(fc & WLAN_FC_ISWEP) &&
+ if (local->drop_unencrypted && !(fc & IEEE80211_FCTL_PROTECTED) &&
!hostap_is_eapol_frame(local, skb)) {
if (net_ratelimit()) {
printk(KERN_DEBUG "%s: dropped unencrypted RX data "
memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
}
- if (wds && ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_TODS) &&
+ if (wds && ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
+ IEEE80211_FCTL_TODS) &&
skb->len >= ETH_HLEN + ETH_ALEN) {
/* Non-standard frame: get addr4 from its bogus location after
* the payload */