summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/hostap/hostap.c10
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c12
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c12
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c24
-rw-r--r--drivers/net/wireless/hostap/hostap_common.h73
-rw-r--r--drivers/net/wireless/hostap/hostap_crypt_ccmp.c4
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c13
7 files changed, 46 insertions, 102 deletions
diff --git a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c
index 182891f1dd02..75c75103f678 100644
--- a/drivers/net/wireless/hostap/hostap.c
+++ b/drivers/net/wireless/hostap/hostap.c
@@ -26,6 +26,8 @@
#include <linux/rtnetlink.h>
#include <linux/wireless.h>
#include <net/iw_handler.h>
+#include <net/ieee80211.h>
+#include <net/ieee80211_crypt.h>
#include <asm/uaccess.h>
#include "hostap_wlan.h"
@@ -596,7 +598,7 @@ void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx)
fc = __le16_to_cpu(rx->frame_control);
printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x "
"data_len=%d%s%s\n",
- fc, WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc),
+ fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc),
__le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl),
__le16_to_cpu(rx->data_len),
fc & WLAN_FC_TODS ? " [ToDS]" : "",
@@ -625,7 +627,7 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
fc = __le16_to_cpu(tx->frame_control);
printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x "
"data_len=%d%s%s\n",
- fc, WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc),
+ fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc),
__le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl),
__le16_to_cpu(tx->data_len),
fc & WLAN_FC_TODS ? " [ToDS]" : "",
@@ -668,13 +670,13 @@ int hostap_80211_get_hdrlen(u16 fc)
{
int hdrlen = 24;
- switch (WLAN_FC_GET_TYPE(fc)) {
+ switch (HOSTAP_FC_GET_TYPE(fc)) {
case WLAN_FC_TYPE_DATA:
if ((fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS))
hdrlen = 30; /* Addr4 */
break;
case WLAN_FC_TYPE_CTRL:
- switch (WLAN_FC_GET_STYPE(fc)) {
+ switch (HOSTAP_FC_GET_STYPE(fc)) {
case WLAN_FC_STYPE_CTS:
case WLAN_FC_STYPE_ACK:
hdrlen = 10;
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 026d47d9c521..a0da9b9c890c 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -21,7 +21,7 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
fc = le16_to_cpu(hdr->frame_control);
printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s",
- fc, WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc),
+ fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc),
fc & WLAN_FC_TODS ? " [ToDS]" : "",
fc & WLAN_FC_FROMDS ? " [FromDS]" : "");
@@ -224,7 +224,7 @@ prism2_frag_cache_get(local_info_t *local, struct hostap_ieee80211_hdr *hdr)
sc = le16_to_cpu(hdr->seq_ctrl);
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 */
@@ -274,7 +274,7 @@ static int prism2_frag_cache_invalidate(local_info_t *local,
struct prism2_frag_entry *entry;
sc = le16_to_cpu(hdr->seq_ctrl);
- seq = WLAN_GET_SEQ_SEQ(sc);
+ seq = WLAN_GET_SEQ_SEQ(sc) >> 4;
entry = prism2_frag_cache_find(local, seq, -1, hdr->addr2, hdr->addr1);
@@ -719,8 +719,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
goto rx_dropped;
fc = le16_to_cpu(hdr->frame_control);
- type = WLAN_FC_GET_TYPE(fc);
- stype = WLAN_FC_GET_STYPE(fc);
+ type = HOSTAP_FC_GET_TYPE(fc);
+ stype = HOSTAP_FC_GET_STYPE(fc);
sc = le16_to_cpu(hdr->seq_ctrl);
frag = WLAN_GET_SEQ_FRAG(sc);
hdrlen = hostap_80211_get_hdrlen(fc);
@@ -896,7 +896,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *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);
+ WLAN_GET_SEQ_SEQ(sc) >> 4, frag);
goto rx_dropped;
}
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index 8a94a80ec55f..52e81cd406fb 100644
--- a/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -13,7 +13,7 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb)
fc = le16_to_cpu(hdr->frame_control);
printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s",
- fc, WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc),
+ fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc),
fc & WLAN_FC_TODS ? " [ToDS]" : "",
fc & WLAN_FC_FROMDS ? " [FromDS]" : "");
@@ -267,8 +267,8 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) {
hdr = (struct hostap_ieee80211_hdr *) skb->data;
fc = le16_to_cpu(hdr->frame_control);
- if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
- WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_DATA) {
+ if (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
+ HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_DATA) {
u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN +
sizeof(rfc1042_header)];
meta->ethertype = (pos[0] << 8) | pos[1];
@@ -409,7 +409,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
break;
case AP_TX_CONTINUE_NOT_AUTHORIZED:
if (local->ieee_802_1x &&
- WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
+ HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
meta->ethertype != ETH_P_PAE && !meta->wds) {
printk(KERN_DEBUG "%s: dropped frame to unauthorized "
"port (IEEE 802.1X): ethertype=0x%04x\n",
@@ -446,7 +446,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
hdr->frame_control = cpu_to_le16(fc);
}
- if (WLAN_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA) {
+ if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA) {
no_encrypt = 1;
tx.crypt = NULL;
}
@@ -467,7 +467,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
fc |= WLAN_FC_ISWEP;
hdr->frame_control = cpu_to_le16(fc);
} else if (local->drop_unencrypted &&
- WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
+ HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
meta->ethertype != ETH_P_PAE) {
if (net_ratelimit()) {
printk(KERN_DEBUG "%s: dropped unencrypted TX data "
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index b9684e3a568b..f59912a0fb4c 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -634,8 +634,8 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
hdr = (struct hostap_ieee80211_hdr *) skb->data;
fc = le16_to_cpu(hdr->frame_control);
- if (WLAN_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT ||
- WLAN_FC_GET_STYPE(fc) != WLAN_FC_STYPE_AUTH ||
+ if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT ||
+ HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_AUTH ||
skb->len < IEEE80211_MGMT_HDR_LEN + 6) {
printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid "
"frame\n", dev->name);
@@ -703,9 +703,9 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
hdr = (struct hostap_ieee80211_hdr *) skb->data;
fc = le16_to_cpu(hdr->frame_control);
- if (WLAN_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT ||
- (WLAN_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ASSOC_RESP &&
- WLAN_FC_GET_STYPE(fc) != WLAN_FC_STYPE_REASSOC_RESP) ||
+ if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT ||
+ (HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ASSOC_RESP &&
+ HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_REASSOC_RESP) ||
skb->len < IEEE80211_MGMT_HDR_LEN + 4) {
printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid "
"frame\n", dev->name);
@@ -2145,8 +2145,8 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
* buffer is long enough */
hdr = (struct hostap_ieee80211_hdr *) skb->data;
fc = le16_to_cpu(hdr->frame_control);
- type = WLAN_FC_GET_TYPE(fc);
- stype = WLAN_FC_GET_STYPE(fc);
+ type = HOSTAP_FC_GET_TYPE(fc);
+ stype = HOSTAP_FC_GET_STYPE(fc);
#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
if (!local->hostapd && type == WLAN_FC_TYPE_DATA) {
@@ -2271,8 +2271,8 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
fc = le16_to_cpu(hdr->frame_control);
if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL &&
- WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
- WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
+ HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
+ HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
goto drop;
skb->protocol = __constant_htons(ETH_P_HOSTAP);
@@ -2907,7 +2907,7 @@ int hostap_update_sta_ps(local_info_t *local, struct hostap_ieee80211_hdr *hdr)
fc = le16_to_cpu(hdr->frame_control);
hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT,
- WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc));
+ HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc));
atomic_dec(&sta->users);
return 0;
@@ -2932,8 +2932,8 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
hdr = (struct hostap_ieee80211_hdr *) skb->data;
fc = le16_to_cpu(hdr->frame_control);
- type = WLAN_FC_GET_TYPE(fc);
- stype = WLAN_FC_GET_STYPE(fc);
+ type = HOSTAP_FC_GET_TYPE(fc);
+ stype = HOSTAP_FC_GET_STYPE(fc);
spin_lock(&local->ap->sta_table_lock);
sta = ap_get_sta(local->ap, hdr->addr2);
diff --git a/drivers/net/wireless/hostap/hostap_common.h b/drivers/net/wireless/hostap/hostap_common.h
index feec70e68d4e..3b79d9e95e6f 100644
--- a/drivers/net/wireless/hostap/hostap_common.h
+++ b/drivers/net/wireless/hostap/hostap_common.h
@@ -27,14 +27,14 @@
#define WLAN_FC_ISWEP BIT(14)
#define WLAN_FC_ORDER BIT(15)
-#define WLAN_FC_GET_TYPE(fc) (((fc) & (BIT(3) | BIT(2))) >> 2)
-#define WLAN_FC_GET_STYPE(fc) \
+/*
+ * To be replaced with ieee80211.h WLAN_FC_GET_* once HostAP code is updated to
+ * use the versions without right shift.
+ */
+#define HOSTAP_FC_GET_TYPE(fc) (((fc) & (BIT(3) | BIT(2))) >> 2)
+#define HOSTAP_FC_GET_STYPE(fc) \
(((fc) & (BIT(7) | BIT(6) | BIT(5) | BIT(4))) >> 4)
-#define WLAN_GET_SEQ_FRAG(seq) ((seq) & (BIT(3) | BIT(2) | BIT(1) | BIT(0)))
-#define WLAN_GET_SEQ_SEQ(seq) \
- (((seq) & (~(BIT(3) | BIT(2) | BIT(1) | BIT(0)))) >> 4)
-
#define WLAN_FC_TYPE_MGMT 0
#define WLAN_FC_TYPE_CTRL 1
#define WLAN_FC_TYPE_DATA 2
@@ -70,66 +70,7 @@
#define WLAN_FC_STYPE_CFPOLL 6
#define WLAN_FC_STYPE_CFACKPOLL 7
-/* Authentication algorithms */
-#define WLAN_AUTH_OPEN 0
-#define WLAN_AUTH_SHARED_KEY 1
-
-#define WLAN_AUTH_CHALLENGE_LEN 128
-
-#define WLAN_CAPABILITY_ESS BIT(0)
-#define WLAN_CAPABILITY_IBSS BIT(1)
-#define WLAN_CAPABILITY_CF_POLLABLE BIT(2)
-#define WLAN_CAPABILITY_CF_POLL_REQUEST BIT(3)
-#define WLAN_CAPABILITY_PRIVACY BIT(4)
-
-/* Status codes */
-#define WLAN_STATUS_SUCCESS 0
-#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
-#define WLAN_STATUS_CAPS_UNSUPPORTED 10
-#define WLAN_STATUS_REASSOC_NO_ASSOC 11
-#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
-#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
-#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
-#define WLAN_STATUS_CHALLENGE_FAIL 15
-#define WLAN_STATUS_AUTH_TIMEOUT 16
-#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
-#define WLAN_STATUS_ASSOC_DENIED_RATES 18
-/* 802.11b */
-#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
-#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
-#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
-/* IEEE 802.11i */
-#define WLAN_STATUS_INVALID_IE 40
-#define WLAN_STATUS_GROUP_CIPHER_NOT_VALID 41
-#define WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID 42
-#define WLAN_STATUS_AKMP_NOT_VALID 43
-#define WLAN_STATUS_UNSUPPORTED_RSN_IE_VERSION 44
-#define WLAN_STATUS_INVALID_RSN_IE_CAPAB 45
-#define WLAN_STATUS_CIPHER_REJECTED_PER_POLICY 46
-
-/* Reason codes */
-#define WLAN_REASON_UNSPECIFIED 1
-#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
-#define WLAN_REASON_DEAUTH_LEAVING 3
-#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
-#define WLAN_REASON_DISASSOC_AP_BUSY 5
-#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
-#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
-#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
-#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
-/* IEEE 802.11i */
-#define WLAN_REASON_INVALID_IE 13
-#define WLAN_REASON_MICHAEL_MIC_FAILURE 14
-#define WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT 15
-#define WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT 16
-#define WLAN_REASON_IE_IN_4WAY_DIFFERS 17
-#define WLAN_REASON_GROUP_CIPHER_NOT_VALID 18
-#define WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID 19
-#define WLAN_REASON_AKMP_NOT_VALID 20
-#define WLAN_REASON_UNSUPPORTED_RSN_IE_VERSION 21
-#define WLAN_REASON_INVALID_RSN_IE_CAPAB 22
-#define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23
-#define WLAN_REASON_CIPHER_SUITE_REJECTED 24
+#define WLAN_CAPABILITY_ESS WLAN_CAPABILITY_BSS
/* Information Element IDs */
diff --git a/drivers/net/wireless/hostap/hostap_crypt_ccmp.c b/drivers/net/wireless/hostap/hostap_crypt_ccmp.c
index ad26aac2d5fe..9e18340f7a38 100644
--- a/drivers/net/wireless/hostap/hostap_crypt_ccmp.c
+++ b/drivers/net/wireless/hostap/hostap_crypt_ccmp.c
@@ -151,8 +151,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
fc = le16_to_cpu(hdr->frame_control);
a4_included = ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) ==
(WLAN_FC_TODS | WLAN_FC_FROMDS));
- qc_included = ((WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA) &&
- (WLAN_FC_GET_STYPE(fc) & 0x08));
+ qc_included = ((HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA) &&
+ (HOSTAP_FC_GET_STYPE(fc) & 0x08));
aad_len = 22;
if (a4_included)
aad_len += 6;
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index 80d0cd30c9d3..72a8a19ad8c0 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -48,9 +48,10 @@
#include <linux/rtnetlink.h>
#include <linux/wireless.h>
#include <net/iw_handler.h>
+#include <net/ieee80211.h>
+#include <net/ieee80211_crypt.h>
#include <asm/irq.h>
-
#include "hostap_80211.h"
#include "hostap.h"
#include "hostap_ap.h"
@@ -1890,7 +1891,7 @@ static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev)
hdr_len = 24;
memcpy(&txdesc.frame_control, skb->data, hdr_len);
fc = le16_to_cpu(txdesc.frame_control);
- if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
+ if (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
(fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS) && skb->len >= 30) {
/* Addr4 */
memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN);
@@ -2521,10 +2522,10 @@ static void prism2_txexc(local_info_t *local)
PDEBUG(DEBUG_EXTRA, " retry_count=%d tx_rate=%d fc=0x%04x "
"(%s%s%s::%d%s%s)\n",
txdesc.retry_count, txdesc.tx_rate, fc,
- WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT ? "Mgmt" : "",
- WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_CTRL ? "Ctrl" : "",
- WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA ? "Data" : "",
- WLAN_FC_GET_STYPE(fc),
+ HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT ? "Mgmt" : "",
+ HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_CTRL ? "Ctrl" : "",
+ HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA ? "Data" : "",
+ HOSTAP_FC_GET_STYPE(fc),
fc & WLAN_FC_TODS ? " ToDS" : "",
fc & WLAN_FC_FROMDS ? " FromDS" : "");
PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3="
OpenPOWER on IntegriCloud