Commit b2f4a2e3 authored by Jouni Malinen's avatar Jouni Malinen Committed by Jeff Garzik

[PATCH] hostap: Replace WLAN_FC_ defines with ieee80211 ones

Replace remaining WLAN_FC_* defines with the ones used in ieee80211
header file. This completes the move from hostap version of frame
control field processing to ieee80211 version.
Signed-off-by: default avatarJouni Malinen <jkmaline@cc.hut.fi>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent e313087e
...@@ -597,8 +597,8 @@ void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx) ...@@ -597,8 +597,8 @@ void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx)
fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 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 & WLAN_FC_TODS ? " [ToDS]" : "", fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4=" printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4="
MACSTR "\n", MACSTR "\n",
...@@ -626,8 +626,8 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx) ...@@ -626,8 +626,8 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 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 & WLAN_FC_TODS ? " [ToDS]" : "", fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4=" printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4="
MACSTR "\n", MACSTR "\n",
...@@ -668,7 +668,7 @@ int hostap_80211_get_hdrlen(u16 fc) ...@@ -668,7 +668,7 @@ int hostap_80211_get_hdrlen(u16 fc)
switch (WLAN_FC_GET_TYPE(fc)) { switch (WLAN_FC_GET_TYPE(fc)) {
case IEEE80211_FTYPE_DATA: case IEEE80211_FTYPE_DATA:
if ((fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS)) if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
hdrlen = 30; /* Addr4 */ hdrlen = 30; /* Addr4 */
break; break;
case IEEE80211_FTYPE_CTL: case IEEE80211_FTYPE_CTL:
......
...@@ -22,8 +22,8 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, ...@@ -22,8 +22,8 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
fc = le16_to_cpu(hdr->frame_ctl); fc = le16_to_cpu(hdr->frame_ctl);
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, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
fc & WLAN_FC_TODS ? " [ToDS]" : "", fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
if (skb->len < IEEE80211_DATA_HDR3_LEN) { if (skb->len < IEEE80211_DATA_HDR3_LEN) {
printk("\n"); printk("\n");
...@@ -73,9 +73,9 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, ...@@ -73,9 +73,9 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
fc = le16_to_cpu(hdr->frame_ctl); 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 " 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); dev_kfree_skb_any(skb);
return 0; return 0;
} }
...@@ -525,9 +525,9 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, ...@@ -525,9 +525,9 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr,
{ {
/* 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? */
if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) != if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) !=
(WLAN_FC_TODS | WLAN_FC_FROMDS) && (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS) &&
(local->iw_mode != IW_MODE_MASTER || !(fc & WLAN_FC_TODS))) (local->iw_mode != IW_MODE_MASTER || !(fc & IEEE80211_FCTL_TODS)))
return 0; /* not a WDS frame */ return 0; /* not a WDS frame */
/* Possible WDS frame: either IEEE 802.11 compliant (if FromDS) /* Possible WDS frame: either IEEE 802.11 compliant (if FromDS)
...@@ -539,14 +539,15 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, ...@@ -539,14 +539,15 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr,
/* RA (or BSSID) is not ours - drop */ /* RA (or BSSID) is not ours - drop */
PDEBUG(DEBUG_EXTRA, "%s: received WDS frame with " PDEBUG(DEBUG_EXTRA, "%s: received WDS frame with "
"not own or broadcast %s=" MACSTR "\n", "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)); MAC2STR(hdr->addr1));
return -1; return -1;
} }
/* check if the frame came from a registered WDS connection */ /* check if the frame came from a registered WDS connection */
*wds = prism2_rx_get_wds(local, hdr->addr2); *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->iw_mode != IW_MODE_INFRA ||
!(local->wds_type & HOSTAP_WDS_AP_CLIENT) || !(local->wds_type & HOSTAP_WDS_AP_CLIENT) ||
memcmp(hdr->addr2, local->bssid, ETH_ALEN) != 0)) { memcmp(hdr->addr2, local->bssid, ETH_ALEN) != 0)) {
...@@ -560,7 +561,7 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, ...@@ -560,7 +561,7 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr,
return -1; 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)) { hostap_is_sta_assoc(local->ap, hdr->addr2)) {
/* STA is actually associated with us even though it has a /* STA is actually associated with us even though it has a
* registered WDS link. Assume it is in 'AP client' mode. * registered WDS link. Assume it is in 'AP client' mode.
...@@ -588,11 +589,13 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb) ...@@ -588,11 +589,13 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb)
fc = le16_to_cpu(hdr->frame_ctl); fc = le16_to_cpu(hdr->frame_ctl);
/* check that the frame is unicast frame to us */ /* 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->addr1, dev->dev_addr, ETH_ALEN) == 0 &&
memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {
/* ToDS frame with own addr BSSID and DA */ /* 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) { memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
/* FromDS frame with own addr as DA */ /* FromDS frame with own addr as DA */
} else } else
...@@ -770,7 +773,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -770,7 +773,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
crypt->ops->decrypt_mpdu == NULL)) crypt->ops->decrypt_mpdu == NULL))
crypt = NULL; crypt = NULL;
if (!crypt && (fc & WLAN_FC_ISWEP)) { if (!crypt && (fc & IEEE80211_FCTL_WEP)) {
#if 0 #if 0
/* This seems to be triggered by some (multicast?) /* This seems to be triggered by some (multicast?)
* frames from other than current BSS, so just drop the * frames from other than current BSS, so just drop the
...@@ -788,7 +791,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -788,7 +791,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
if (type != IEEE80211_FTYPE_DATA) { if (type != IEEE80211_FTYPE_DATA) {
if (type == IEEE80211_FTYPE_MGMT && if (type == IEEE80211_FTYPE_MGMT &&
stype == IEEE80211_STYPE_AUTH && stype == IEEE80211_STYPE_AUTH &&
fc & WLAN_FC_ISWEP && local->host_decrypt && fc & IEEE80211_FCTL_WEP && local->host_decrypt &&
(keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
{ {
printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
...@@ -809,16 +812,16 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -809,16 +812,16 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
if (skb->len < IEEE80211_DATA_HDR3_LEN) if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped; goto rx_dropped;
switch (fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)) { switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
case WLAN_FC_FROMDS: case IEEE80211_FCTL_FROMDS:
memcpy(dst, hdr->addr1, ETH_ALEN); memcpy(dst, hdr->addr1, ETH_ALEN);
memcpy(src, hdr->addr3, ETH_ALEN); memcpy(src, hdr->addr3, ETH_ALEN);
break; break;
case WLAN_FC_TODS: case IEEE80211_FCTL_TODS:
memcpy(dst, hdr->addr3, ETH_ALEN); memcpy(dst, hdr->addr3, ETH_ALEN);
memcpy(src, hdr->addr2, ETH_ALEN); memcpy(src, hdr->addr2, ETH_ALEN);
break; break;
case WLAN_FC_FROMDS | WLAN_FC_TODS: case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS:
if (skb->len < IEEE80211_DATA_HDR4_LEN) if (skb->len < IEEE80211_DATA_HDR4_LEN)
goto rx_dropped; goto rx_dropped;
memcpy(dst, hdr->addr3, ETH_ALEN); memcpy(dst, hdr->addr3, ETH_ALEN);
...@@ -838,7 +841,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -838,7 +841,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
} }
if (local->iw_mode == IW_MODE_MASTER && !wds && 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 && local->stadev &&
memcmp(hdr->addr2, local->assoc_ap_addr, ETH_ALEN) == 0) { memcmp(hdr->addr2, local->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */ /* Frame from BSSID of the AP for which we are a client */
...@@ -882,22 +886,22 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -882,22 +886,22 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */ /* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (local->host_decrypt && (fc & WLAN_FC_ISWEP) && if (local->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
(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 *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
/* skb: hdr + (possibly fragmented) plaintext payload */ /* skb: hdr + (possibly fragmented) plaintext payload */
if (local->host_decrypt && (fc & WLAN_FC_ISWEP) && if (local->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
(frag != 0 || (fc & WLAN_FC_MOREFRAG))) { (frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen; int flen;
struct sk_buff *frag_skb = struct sk_buff *frag_skb =
prism2_frag_cache_get(local, hdr); prism2_frag_cache_get(local, hdr);
if (!frag_skb) { if (!frag_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 & WLAN_FC_MOREFRAG) != 0, dev->name, (fc & IEEE80211_FCTL_MOREFRAGS) != 0,
WLAN_GET_SEQ_SEQ(sc) >> 4, frag); WLAN_GET_SEQ_SEQ(sc) >> 4, frag);
goto rx_dropped; goto rx_dropped;
} }
...@@ -927,7 +931,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -927,7 +931,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
dev_kfree_skb(skb); dev_kfree_skb(skb);
skb = NULL; skb = NULL;
if (fc & WLAN_FC_MOREFRAG) { if (fc & IEEE80211_FCTL_MOREFRAGS) {
/* more fragments expected - leave the skb in fragment /* more fragments expected - leave the skb in fragment
* cache for now; it will be delivered to upper layers * cache for now; it will be delivered to upper layers
* after all fragments have been received */ * after all fragments have been received */
...@@ -944,12 +948,12 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -944,12 +948,12 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still /* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */ * encrypted/authenticated */
if (local->host_decrypt && (fc & WLAN_FC_ISWEP) && if (local->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
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 *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & WLAN_FC_ISWEP) && !local->open_wep) { if (crypt && !(fc & IEEE80211_FCTL_WEP) && !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)) {
/* pass unencrypted EAPOL frames even if encryption is /* pass unencrypted EAPOL frames even if encryption is
...@@ -964,7 +968,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -964,7 +968,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
} }
} }
if (local->drop_unencrypted && !(fc & WLAN_FC_ISWEP) && if (local->drop_unencrypted && !(fc & IEEE80211_FCTL_WEP) &&
!hostap_is_eapol_frame(local, skb)) { !hostap_is_eapol_frame(local, skb)) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "%s: dropped unencrypted RX data " printk(KERN_DEBUG "%s: dropped unencrypted RX data "
...@@ -1023,7 +1027,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -1023,7 +1027,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); 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) { skb->len >= ETH_HLEN + ETH_ALEN) {
/* Non-standard frame: get addr4 from its bogus location after /* Non-standard frame: get addr4 from its bogus location after
* the payload */ * the payload */
......
...@@ -14,8 +14,8 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) ...@@ -14,8 +14,8 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb)
fc = le16_to_cpu(hdr->frame_ctl); fc = le16_to_cpu(hdr->frame_ctl);
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, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
fc & WLAN_FC_TODS ? " [ToDS]" : "", fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
if (skb->len < IEEE80211_DATA_HDR3_LEN) { if (skb->len < IEEE80211_DATA_HDR3_LEN) {
printk("\n"); printk("\n");
...@@ -128,7 +128,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -128,7 +128,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
* frame format */ * frame format */
if (use_wds == WDS_COMPLIANT_FRAME) { if (use_wds == WDS_COMPLIANT_FRAME) {
fc |= WLAN_FC_FROMDS | WLAN_FC_TODS; fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS;
/* From&To DS: Addr1 = RA, Addr2 = TA, Addr3 = DA, /* From&To DS: Addr1 = RA, Addr2 = TA, Addr3 = DA,
* Addr4 = SA */ * Addr4 = SA */
memcpy(&hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); memcpy(&hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN);
...@@ -136,7 +136,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -136,7 +136,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
} else { } else {
/* bogus 4-addr format to workaround Prism2 station /* bogus 4-addr format to workaround Prism2 station
* f/w bug */ * f/w bug */
fc |= WLAN_FC_TODS; fc |= IEEE80211_FCTL_TODS;
/* From DS: Addr1 = DA (used as RA), /* From DS: Addr1 = DA (used as RA),
* Addr2 = BSSID (used as TA), Addr3 = SA (used as DA), * Addr2 = BSSID (used as TA), Addr3 = SA (used as DA),
*/ */
...@@ -161,13 +161,13 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -161,13 +161,13 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN);
memcpy(&hdr.addr3, skb->data, ETH_ALEN); memcpy(&hdr.addr3, skb->data, ETH_ALEN);
} else if (local->iw_mode == IW_MODE_MASTER && !to_assoc_ap) { } else if (local->iw_mode == IW_MODE_MASTER && !to_assoc_ap) {
fc |= WLAN_FC_FROMDS; fc |= IEEE80211_FCTL_FROMDS;
/* From DS: Addr1 = DA, Addr2 = BSSID, Addr3 = SA */ /* From DS: Addr1 = DA, Addr2 = BSSID, Addr3 = SA */
memcpy(&hdr.addr1, skb->data, ETH_ALEN); memcpy(&hdr.addr1, skb->data, ETH_ALEN);
memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN);
memcpy(&hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); memcpy(&hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN);
} else if (local->iw_mode == IW_MODE_INFRA || to_assoc_ap) { } else if (local->iw_mode == IW_MODE_INFRA || to_assoc_ap) {
fc |= WLAN_FC_TODS; fc |= IEEE80211_FCTL_TODS;
/* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */ /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */
memcpy(&hdr.addr1, to_assoc_ap ? memcpy(&hdr.addr1, to_assoc_ap ?
local->assoc_ap_addr : local->bssid, ETH_ALEN); local->assoc_ap_addr : local->bssid, ETH_ALEN);
...@@ -439,12 +439,12 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -439,12 +439,12 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Request TX callback if protocol version is 2 in 802.11 header; /* Request TX callback if protocol version is 2 in 802.11 header;
* this version 2 is a special case used between hostapd and kernel * this version 2 is a special case used between hostapd and kernel
* driver */ * driver */
if (((fc & WLAN_FC_PVER) == BIT(1)) && if (((fc & IEEE80211_FCTL_VERS) == BIT(1)) &&
local->ap && local->ap->tx_callback_idx && meta->tx_cb_idx == 0) { local->ap && local->ap->tx_callback_idx && meta->tx_cb_idx == 0) {
meta->tx_cb_idx = local->ap->tx_callback_idx; meta->tx_cb_idx = local->ap->tx_callback_idx;
/* remove special version from the frame header */ /* remove special version from the frame header */
fc &= ~WLAN_FC_PVER; fc &= ~IEEE80211_FCTL_VERS;
hdr->frame_ctl = cpu_to_le16(fc); hdr->frame_ctl = cpu_to_le16(fc);
} }
...@@ -454,7 +454,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -454,7 +454,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
} }
if (local->ieee_802_1x && meta->ethertype == ETH_P_PAE && tx.crypt && if (local->ieee_802_1x && meta->ethertype == ETH_P_PAE && tx.crypt &&
!(fc & WLAN_FC_ISWEP)) { !(fc & IEEE80211_FCTL_VERS)) {
no_encrypt = 1; no_encrypt = 1;
PDEBUG(DEBUG_EXTRA2, "%s: TX: IEEE 802.1X - passing " PDEBUG(DEBUG_EXTRA2, "%s: TX: IEEE 802.1X - passing "
"unencrypted EAPOL frame\n", dev->name); "unencrypted EAPOL frame\n", dev->name);
...@@ -466,7 +466,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -466,7 +466,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
else if ((tx.crypt || local->crypt[local->tx_keyidx]) && !no_encrypt) { else if ((tx.crypt || local->crypt[local->tx_keyidx]) && !no_encrypt) {
/* Add ISWEP flag both for firmware and host based encryption /* Add ISWEP flag both for firmware and host based encryption
*/ */
fc |= WLAN_FC_ISWEP; fc |= IEEE80211_FCTL_WEP;
hdr->frame_ctl = cpu_to_le16(fc); hdr->frame_ctl = cpu_to_le16(fc);
} else if (local->drop_unencrypted && } else if (local->drop_unencrypted &&
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
......
...@@ -604,7 +604,7 @@ static void hostap_ap_tx_cb(struct sk_buff *skb, int ok, void *data) ...@@ -604,7 +604,7 @@ static void hostap_ap_tx_cb(struct sk_buff *skb, int ok, void *data)
/* Pass the TX callback frame to the hostapd; use 802.11 header version /* Pass the TX callback frame to the hostapd; use 802.11 header version
* 1 to indicate failure (no ACK) and 2 success (frame ACKed) */ * 1 to indicate failure (no ACK) and 2 success (frame ACKed) */
fc &= ~WLAN_FC_PVER; fc &= ~IEEE80211_FCTL_VERS;
fc |= ok ? BIT(1) : BIT(0); fc |= ok ? BIT(1) : BIT(0);
hdr->frame_ctl = cpu_to_le16(fc); hdr->frame_ctl = cpu_to_le16(fc);
...@@ -956,7 +956,7 @@ static void prism2_send_mgmt(struct net_device *dev, ...@@ -956,7 +956,7 @@ static void prism2_send_mgmt(struct net_device *dev,
memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */ memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */
if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) { if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) {
fc |= WLAN_FC_FROMDS; fc |= IEEE80211_FCTL_FROMDS;
memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */ memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */
memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */
} else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) { } else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) {
...@@ -1436,7 +1436,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, ...@@ -1436,7 +1436,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
challenge == NULL || challenge == NULL ||
memcmp(sta->u.sta.challenge, challenge, memcmp(sta->u.sta.challenge, challenge,
WLAN_AUTH_CHALLENGE_LEN) != 0 || WLAN_AUTH_CHALLENGE_LEN) != 0 ||
!(fc & WLAN_FC_ISWEP)) { !(fc & IEEE80211_FCTL_WEP)) {
txt = "challenge response incorrect"; txt = "challenge response incorrect";
resp = WLAN_STATUS_CHALLENGE_FAIL; resp = WLAN_STATUS_CHALLENGE_FAIL;
goto fail; goto fail;
...@@ -1871,7 +1871,7 @@ static void handle_pspoll(local_info_t *local, ...@@ -1871,7 +1871,7 @@ static void handle_pspoll(local_info_t *local,
PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MACSTR ", TA=" MACSTR PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MACSTR ", TA=" MACSTR
" PWRMGT=%d\n", " PWRMGT=%d\n",
MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr1), MAC2STR(hdr->addr2),
!!(le16_to_cpu(hdr->frame_ctl) & WLAN_FC_PWRMGT)); !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM));
if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MACSTR PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MACSTR
...@@ -2150,7 +2150,8 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb, ...@@ -2150,7 +2150,8 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
if (!local->hostapd && type == IEEE80211_FTYPE_DATA) { if (!local->hostapd && type == IEEE80211_FTYPE_DATA) {
PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n"); PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n");
if (!(fc & WLAN_FC_TODS) || (fc & WLAN_FC_FROMDS)) { if (!(fc & IEEE80211_FCTL_TODS) ||
(fc & IEEE80211_FCTL_FROMDS)) {
if (stype == IEEE80211_STYPE_NULLFUNC) { if (stype == IEEE80211_STYPE_NULLFUNC) {
/* no ToDS nullfunc seems to be used to check /* no ToDS nullfunc seems to be used to check
* AP association; so send reject message to * AP association; so send reject message to
...@@ -2746,7 +2747,8 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx) ...@@ -2746,7 +2747,8 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) { if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) {
/* indicate to STA that more frames follow */ /* indicate to STA that more frames follow */
hdr->frame_ctl |= __constant_cpu_to_le16(WLAN_FC_MOREDATA); hdr->frame_ctl |=
__constant_cpu_to_le16(IEEE80211_FCTL_MOREDATA);
} }
if (meta->flags & HOSTAP_TX_FLAGS_BUFFERED_FRAME) { if (meta->flags & HOSTAP_TX_FLAGS_BUFFERED_FRAME) {
...@@ -2905,7 +2907,7 @@ int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr) ...@@ -2905,7 +2907,7 @@ int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr)
return -1; return -1;
fc = le16_to_cpu(hdr->frame_ctl); fc = le16_to_cpu(hdr->frame_ctl);
hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM,
WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc)); WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc));
atomic_dec(&sta->users); atomic_dec(&sta->users);
...@@ -2946,7 +2948,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, ...@@ -2946,7 +2948,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
ret = AP_RX_CONTINUE; ret = AP_RX_CONTINUE;
if (fc & WLAN_FC_TODS) { if (fc & IEEE80211_FCTL_TODS) {
if (!wds && (sta == NULL || !(sta->flags & WLAN_STA_ASSOC))) { if (!wds && (sta == NULL || !(sta->flags & WLAN_STA_ASSOC))) {
if (local->hostapd) { if (local->hostapd) {
prism2_rx_80211(local->apdev, skb, rx_stats, prism2_rx_80211(local->apdev, skb, rx_stats,
...@@ -2964,7 +2966,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, ...@@ -2964,7 +2966,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
ret = AP_RX_EXIT; ret = AP_RX_EXIT;
goto out; goto out;
} }
} else if (fc & WLAN_FC_FROMDS) { } else if (fc & IEEE80211_FCTL_FROMDS) {
if (!wds) { if (!wds) {
/* FromDS frame - not for us; probably /* FromDS frame - not for us; probably
* broadcast/multicast in another BSS - drop */ * broadcast/multicast in another BSS - drop */
...@@ -3019,7 +3021,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, ...@@ -3019,7 +3021,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
} }
if (sta) { if (sta) {
hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM,
type, stype); type, stype);
sta->rx_packets++; sta->rx_packets++;
...@@ -3028,7 +3030,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, ...@@ -3028,7 +3030,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
} }
if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC && if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC &&
fc & WLAN_FC_TODS) { fc & IEEE80211_FCTL_TODS) {
if (local->hostapd) { if (local->hostapd) {
prism2_rx_80211(local->apdev, skb, rx_stats, prism2_rx_80211(local->apdev, skb, rx_stats,
PRISM2_RX_NULLFUNC_ACK); PRISM2_RX_NULLFUNC_ACK);
......
...@@ -9,16 +9,6 @@ ...@@ -9,16 +9,6 @@
/* IEEE 802.11 defines */ /* IEEE 802.11 defines */
#define WLAN_FC_PVER (BIT(1) | BIT(0))
#define WLAN_FC_TODS BIT(8)
#define WLAN_FC_FROMDS BIT(9)
#define WLAN_FC_MOREFRAG BIT(10)
#define WLAN_FC_RETRY BIT(11)
#define WLAN_FC_PWRMGT BIT(12)
#define WLAN_FC_MOREDATA BIT(13)
#define WLAN_FC_ISWEP BIT(14)
#define WLAN_FC_ORDER BIT(15)
/* Information Element IDs */ /* Information Element IDs */
#define WLAN_EID_SSID 0 #define WLAN_EID_SSID 0
#define WLAN_EID_SUPP_RATES 1 #define WLAN_EID_SUPP_RATES 1
......
...@@ -1844,7 +1844,8 @@ static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev) ...@@ -1844,7 +1844,8 @@ static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev)
memcpy(&txdesc.frame_control, skb->data, hdr_len); memcpy(&txdesc.frame_control, skb->data, 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 (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
(fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS) && skb->len >= 30) { (fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS) &&
skb->len >= 30) {
/* Addr4 */ /* Addr4 */
memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN); memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN);
hdr_len += ETH_ALEN; hdr_len += ETH_ALEN;
...@@ -2399,8 +2400,8 @@ static void prism2_txexc(local_info_t *local) ...@@ -2399,8 +2400,8 @@ static void prism2_txexc(local_info_t *local)
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "", WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "",
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "", WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "",
WLAN_FC_GET_STYPE(fc) >> 4, WLAN_FC_GET_STYPE(fc) >> 4,
fc & WLAN_FC_TODS ? " ToDS" : "", fc & IEEE80211_FCTL_TODS ? " ToDS" : "",
fc & WLAN_FC_FROMDS ? " FromDS" : ""); fc & IEEE80211_FCTL_FROMDS ? " FromDS" : "");
PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3=" PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3="
MACSTR " A4=" MACSTR "\n", MACSTR " A4=" MACSTR "\n",
MAC2STR(txdesc.addr1), MAC2STR(txdesc.addr2), MAC2STR(txdesc.addr1), MAC2STR(txdesc.addr2),
......
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