[PATCH] hostap: Use ieee80211 WLAN_FC_GET_{TYPE,STYPE}
Replace temporary HOSTAP_FC_GET_{TYPE,STYPE} macros with the ieee80211 version of WLAN_FC_GET_{TYPE,STYPE}. Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
This commit is contained in:
parent
c0f72ca8e4
commit
4339d32863
@ -594,7 +594,7 @@ 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, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc),
|
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 & WLAN_FC_TODS ? " [ToDS]" : "",
|
||||||
@ -623,7 +623,7 @@ 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, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc),
|
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 & WLAN_FC_TODS ? " [ToDS]" : "",
|
||||||
@ -666,15 +666,15 @@ int hostap_80211_get_hdrlen(u16 fc)
|
|||||||
{
|
{
|
||||||
int hdrlen = 24;
|
int hdrlen = 24;
|
||||||
|
|
||||||
switch (HOSTAP_FC_GET_TYPE(fc)) {
|
switch (WLAN_FC_GET_TYPE(fc)) {
|
||||||
case WLAN_FC_TYPE_DATA:
|
case IEEE80211_FTYPE_DATA:
|
||||||
if ((fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS))
|
if ((fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS))
|
||||||
hdrlen = 30; /* Addr4 */
|
hdrlen = 30; /* Addr4 */
|
||||||
break;
|
break;
|
||||||
case WLAN_FC_TYPE_CTRL:
|
case IEEE80211_FTYPE_CTL:
|
||||||
switch (HOSTAP_FC_GET_STYPE(fc)) {
|
switch (WLAN_FC_GET_STYPE(fc)) {
|
||||||
case WLAN_FC_STYPE_CTS:
|
case IEEE80211_STYPE_CTS:
|
||||||
case WLAN_FC_STYPE_ACK:
|
case IEEE80211_STYPE_ACK:
|
||||||
hdrlen = 10;
|
hdrlen = 10;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1093,7 +1093,7 @@ int prism2_update_comms_qual(struct net_device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype,
|
int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype,
|
||||||
u8 *body, size_t bodylen)
|
u8 *body, size_t bodylen)
|
||||||
{
|
{
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
@ -1108,8 +1108,7 @@ int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype,
|
|||||||
mgmt = (struct hostap_ieee80211_mgmt *)
|
mgmt = (struct hostap_ieee80211_mgmt *)
|
||||||
skb_put(skb, IEEE80211_MGMT_HDR_LEN);
|
skb_put(skb, IEEE80211_MGMT_HDR_LEN);
|
||||||
memset(mgmt, 0, IEEE80211_MGMT_HDR_LEN);
|
memset(mgmt, 0, IEEE80211_MGMT_HDR_LEN);
|
||||||
mgmt->frame_control =
|
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype);
|
||||||
cpu_to_le16((WLAN_FC_TYPE_MGMT << 2) | (stype << 4));
|
|
||||||
memcpy(mgmt->da, dst, ETH_ALEN);
|
memcpy(mgmt->da, dst, ETH_ALEN);
|
||||||
memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN);
|
memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN);
|
||||||
memcpy(mgmt->bssid, dst, ETH_ALEN);
|
memcpy(mgmt->bssid, dst, ETH_ALEN);
|
||||||
@ -1140,7 +1139,7 @@ int prism2_sta_deauth(local_info_t *local, u16 reason)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
reason = cpu_to_le16(reason);
|
reason = cpu_to_le16(reason);
|
||||||
ret = prism2_sta_send_mgmt(local, local->bssid, WLAN_FC_STYPE_DEAUTH,
|
ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH,
|
||||||
(u8 *) &reason, 2);
|
(u8 *) &reason, 2);
|
||||||
memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
|
memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
|
||||||
wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL);
|
wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL);
|
||||||
|
@ -37,7 +37,7 @@ struct net_device * hostap_add_interface(struct local_info *local,
|
|||||||
void hostap_remove_interface(struct net_device *dev, int rtnl_locked,
|
void hostap_remove_interface(struct net_device *dev, int rtnl_locked,
|
||||||
int remove_from_list);
|
int remove_from_list);
|
||||||
int prism2_update_comms_qual(struct net_device *dev);
|
int prism2_update_comms_qual(struct net_device *dev);
|
||||||
int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype,
|
int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype,
|
||||||
u8 *body, size_t bodylen);
|
u8 *body, size_t bodylen);
|
||||||
int prism2_sta_deauth(local_info_t *local, u16 reason);
|
int prism2_sta_deauth(local_info_t *local, u16 reason);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ 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, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc),
|
fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
|
||||||
fc & WLAN_FC_TODS ? " [ToDS]" : "",
|
fc & WLAN_FC_TODS ? " [ToDS]" : "",
|
||||||
fc & WLAN_FC_FROMDS ? " [FromDS]" : "");
|
fc & WLAN_FC_FROMDS ? " [FromDS]" : "");
|
||||||
|
|
||||||
@ -445,8 +445,8 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb,
|
|||||||
skb->data);
|
skb->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local->hostapd && type == WLAN_FC_TYPE_MGMT) {
|
if (local->hostapd && type == IEEE80211_FTYPE_MGMT) {
|
||||||
if (stype == WLAN_FC_STYPE_BEACON &&
|
if (stype == IEEE80211_STYPE_BEACON &&
|
||||||
local->iw_mode == IW_MODE_MASTER) {
|
local->iw_mode == IW_MODE_MASTER) {
|
||||||
struct sk_buff *skb2;
|
struct sk_buff *skb2;
|
||||||
/* Process beacon frames also in kernel driver to
|
/* Process beacon frames also in kernel driver to
|
||||||
@ -467,23 +467,24 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (local->iw_mode == IW_MODE_MASTER) {
|
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 "
|
printk(KERN_DEBUG "%s: unknown management frame "
|
||||||
"(type=0x%02x, stype=0x%02x) dropped\n",
|
"(type=0x%02x, stype=0x%02x) dropped\n",
|
||||||
skb->dev->name, type, stype);
|
skb->dev->name, type >> 2, stype >> 4);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hostap_rx(skb->dev, skb, rx_stats);
|
hostap_rx(skb->dev, skb, rx_stats);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (type == WLAN_FC_TYPE_MGMT &&
|
} else if (type == IEEE80211_FTYPE_MGMT &&
|
||||||
(stype == WLAN_FC_STYPE_BEACON ||
|
(stype == IEEE80211_STYPE_BEACON ||
|
||||||
stype == WLAN_FC_STYPE_PROBE_RESP)) {
|
stype == IEEE80211_STYPE_PROBE_RESP)) {
|
||||||
hostap_rx_sta_beacon(local, skb, stype);
|
hostap_rx_sta_beacon(local, skb, stype);
|
||||||
return -1;
|
return -1;
|
||||||
} else if (type == WLAN_FC_TYPE_MGMT &&
|
} else if (type == IEEE80211_FTYPE_MGMT &&
|
||||||
(stype == WLAN_FC_STYPE_ASSOC_RESP ||
|
(stype == IEEE80211_STYPE_ASSOC_RESP ||
|
||||||
stype == WLAN_FC_STYPE_REASSOC_RESP)) {
|
stype == IEEE80211_STYPE_REASSOC_RESP)) {
|
||||||
/* Ignore (Re)AssocResp silently since these are not currently
|
/* Ignore (Re)AssocResp silently since these are not currently
|
||||||
* needed but are still received when WPA/RSN mode is enabled.
|
* needed but are still received when WPA/RSN mode is enabled.
|
||||||
*/
|
*/
|
||||||
@ -491,7 +492,7 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb,
|
|||||||
} else {
|
} else {
|
||||||
printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: dropped unhandled"
|
printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: dropped unhandled"
|
||||||
" management frame in non-Host AP mode (type=%d:%d)\n",
|
" 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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -719,8 +720,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
|
|||||||
goto rx_dropped;
|
goto rx_dropped;
|
||||||
|
|
||||||
fc = le16_to_cpu(hdr->frame_ctl);
|
fc = le16_to_cpu(hdr->frame_ctl);
|
||||||
type = HOSTAP_FC_GET_TYPE(fc);
|
type = WLAN_FC_GET_TYPE(fc);
|
||||||
stype = HOSTAP_FC_GET_STYPE(fc);
|
stype = WLAN_FC_GET_STYPE(fc);
|
||||||
sc = le16_to_cpu(hdr->seq_ctl);
|
sc = le16_to_cpu(hdr->seq_ctl);
|
||||||
frag = WLAN_GET_SEQ_FRAG(sc);
|
frag = WLAN_GET_SEQ_FRAG(sc);
|
||||||
hdrlen = hostap_80211_get_hdrlen(fc);
|
hdrlen = hostap_80211_get_hdrlen(fc);
|
||||||
@ -784,8 +785,9 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != WLAN_FC_TYPE_DATA) {
|
if (type != IEEE80211_FTYPE_DATA) {
|
||||||
if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_AUTH &&
|
if (type == IEEE80211_FTYPE_MGMT &&
|
||||||
|
stype == IEEE80211_STYPE_AUTH &&
|
||||||
fc & WLAN_FC_ISWEP && local->host_decrypt &&
|
fc & WLAN_FC_ISWEP && local->host_decrypt &&
|
||||||
(keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
|
(keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
|
||||||
{
|
{
|
||||||
@ -867,14 +869,14 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
|
|||||||
|
|
||||||
/* Nullfunc frames may have PS-bit set, so they must be passed to
|
/* Nullfunc frames may have PS-bit set, so they must be passed to
|
||||||
* hostap_handle_sta_rx() before being dropped here. */
|
* hostap_handle_sta_rx() before being dropped here. */
|
||||||
if (stype != WLAN_FC_STYPE_DATA &&
|
if (stype != IEEE80211_STYPE_DATA &&
|
||||||
stype != WLAN_FC_STYPE_DATA_CFACK &&
|
stype != IEEE80211_STYPE_DATA_CFACK &&
|
||||||
stype != WLAN_FC_STYPE_DATA_CFPOLL &&
|
stype != IEEE80211_STYPE_DATA_CFPOLL &&
|
||||||
stype != WLAN_FC_STYPE_DATA_CFACKPOLL) {
|
stype != IEEE80211_STYPE_DATA_CFACKPOLL) {
|
||||||
if (stype != WLAN_FC_STYPE_NULLFUNC)
|
if (stype != IEEE80211_STYPE_NULLFUNC)
|
||||||
printk(KERN_DEBUG "%s: RX: dropped data frame "
|
printk(KERN_DEBUG "%s: RX: dropped data frame "
|
||||||
"with no data (type=0x%02x, subtype=0x%02x)\n",
|
"with no data (type=0x%02x, subtype=0x%02x)\n",
|
||||||
dev->name, type, stype);
|
dev->name, type >> 2, stype >> 4);
|
||||||
goto rx_dropped;
|
goto rx_dropped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ 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, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc),
|
fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
|
||||||
fc & WLAN_FC_TODS ? " [ToDS]" : "",
|
fc & WLAN_FC_TODS ? " [ToDS]" : "",
|
||||||
fc & WLAN_FC_FROMDS ? " [FromDS]" : "");
|
fc & WLAN_FC_FROMDS ? " [FromDS]" : "");
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
skip_header_bytes -= 2;
|
skip_header_bytes -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
fc = (WLAN_FC_TYPE_DATA << 2) | (WLAN_FC_STYPE_DATA << 4);
|
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
|
||||||
hdr_len = IEEE80211_DATA_HDR3_LEN;
|
hdr_len = IEEE80211_DATA_HDR3_LEN;
|
||||||
|
|
||||||
if (use_wds != WDS_NO) {
|
if (use_wds != WDS_NO) {
|
||||||
@ -268,8 +268,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) {
|
if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) {
|
||||||
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 (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
|
if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
|
||||||
HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_DATA) {
|
WLAN_FC_GET_STYPE(fc) == 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];
|
||||||
@ -410,7 +410,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
break;
|
break;
|
||||||
case AP_TX_CONTINUE_NOT_AUTHORIZED:
|
case AP_TX_CONTINUE_NOT_AUTHORIZED:
|
||||||
if (local->ieee_802_1x &&
|
if (local->ieee_802_1x &&
|
||||||
HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
|
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
|
||||||
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 "
|
||||||
@ -448,7 +448,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
hdr->frame_ctl = cpu_to_le16(fc);
|
hdr->frame_ctl = cpu_to_le16(fc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA) {
|
if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_DATA) {
|
||||||
no_encrypt = 1;
|
no_encrypt = 1;
|
||||||
tx.crypt = NULL;
|
tx.crypt = NULL;
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
fc |= WLAN_FC_ISWEP;
|
fc |= WLAN_FC_ISWEP;
|
||||||
hdr->frame_ctl = cpu_to_le16(fc);
|
hdr->frame_ctl = cpu_to_le16(fc);
|
||||||
} else if (local->drop_unencrypted &&
|
} else if (local->drop_unencrypted &&
|
||||||
HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
|
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
|
||||||
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 "
|
||||||
|
@ -46,7 +46,7 @@ static void handle_add_proc_queue(void *data);
|
|||||||
#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
|
#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
|
||||||
static void handle_wds_oper_queue(void *data);
|
static void handle_wds_oper_queue(void *data);
|
||||||
static void prism2_send_mgmt(struct net_device *dev,
|
static void prism2_send_mgmt(struct net_device *dev,
|
||||||
int type, int subtype, char *body,
|
u16 type_subtype, char *body,
|
||||||
int body_len, u8 *addr, u16 tx_cb_idx);
|
int body_len, u8 *addr, u16 tx_cb_idx);
|
||||||
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
|
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
|
||||||
|
|
||||||
@ -237,12 +237,12 @@ static void ap_handle_timer(unsigned long data)
|
|||||||
} else if (sta->timeout_next == STA_NULLFUNC) {
|
} else if (sta->timeout_next == STA_NULLFUNC) {
|
||||||
/* send data frame to poll STA and check whether this frame
|
/* send data frame to poll STA and check whether this frame
|
||||||
* is ACKed */
|
* is ACKed */
|
||||||
/* FIX: WLAN_FC_STYPE_NULLFUNC would be more appropriate, but
|
/* FIX: IEEE80211_STYPE_NULLFUNC would be more appropriate, but
|
||||||
* it is apparently not retried so TX Exc events are not
|
* it is apparently not retried so TX Exc events are not
|
||||||
* received for it */
|
* received for it */
|
||||||
sta->flags |= WLAN_STA_PENDING_POLL;
|
sta->flags |= WLAN_STA_PENDING_POLL;
|
||||||
prism2_send_mgmt(local->dev, WLAN_FC_TYPE_DATA,
|
prism2_send_mgmt(local->dev, IEEE80211_FTYPE_DATA |
|
||||||
WLAN_FC_STYPE_DATA, NULL, 0,
|
IEEE80211_STYPE_DATA, NULL, 0,
|
||||||
sta->addr, ap->tx_callback_poll);
|
sta->addr, ap->tx_callback_poll);
|
||||||
} else {
|
} else {
|
||||||
int deauth = sta->timeout_next == STA_DEAUTH;
|
int deauth = sta->timeout_next == STA_DEAUTH;
|
||||||
@ -255,9 +255,9 @@ static void ap_handle_timer(unsigned long data)
|
|||||||
|
|
||||||
resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID :
|
resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID :
|
||||||
WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
|
WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
|
||||||
prism2_send_mgmt(local->dev, WLAN_FC_TYPE_MGMT,
|
prism2_send_mgmt(local->dev, IEEE80211_FTYPE_MGMT |
|
||||||
(deauth ? WLAN_FC_STYPE_DEAUTH :
|
(deauth ? IEEE80211_STYPE_DEAUTH :
|
||||||
WLAN_FC_STYPE_DISASSOC),
|
IEEE80211_STYPE_DISASSOC),
|
||||||
(char *) &resp, 2, sta->addr, 0);
|
(char *) &resp, 2, sta->addr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +300,8 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap,
|
|||||||
* else we can do at this point since the driver is going to be shut
|
* else we can do at this point since the driver is going to be shut
|
||||||
* down */
|
* down */
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_DEAUTH,
|
prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
|
||||||
|
IEEE80211_STYPE_DEAUTH,
|
||||||
(char *) &resp, 2, addr, 0);
|
(char *) &resp, 2, addr, 0);
|
||||||
|
|
||||||
if (!resend || ap->num_sta <= 0)
|
if (!resend || ap->num_sta <= 0)
|
||||||
@ -471,7 +472,7 @@ static int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
|
resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
|
||||||
prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_DEAUTH,
|
prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH,
|
||||||
(char *) &resp, 2, sta->addr, 0);
|
(char *) &resp, 2, sta->addr, 0);
|
||||||
|
|
||||||
if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap)
|
if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap)
|
||||||
@ -634,8 +635,8 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
|
|||||||
|
|
||||||
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 (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT ||
|
if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT ||
|
||||||
HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_AUTH ||
|
WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH ||
|
||||||
skb->len < IEEE80211_MGMT_HDR_LEN + 6) {
|
skb->len < IEEE80211_MGMT_HDR_LEN + 6) {
|
||||||
printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid "
|
printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid "
|
||||||
"frame\n", dev->name);
|
"frame\n", dev->name);
|
||||||
@ -703,9 +704,9 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
|
|||||||
|
|
||||||
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 (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT ||
|
if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT ||
|
||||||
(HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ASSOC_RESP &&
|
(WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP &&
|
||||||
HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_REASSOC_RESP) ||
|
WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_REASSOC_RESP) ||
|
||||||
skb->len < IEEE80211_MGMT_HDR_LEN + 4) {
|
skb->len < IEEE80211_MGMT_HDR_LEN + 4) {
|
||||||
printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid "
|
printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid "
|
||||||
"frame\n", dev->name);
|
"frame\n", dev->name);
|
||||||
@ -912,7 +913,7 @@ static struct sta_info* ap_get_sta(struct ap_data *ap, u8 *sta)
|
|||||||
|
|
||||||
/* Called from timer handler and from scheduled AP queue handlers */
|
/* Called from timer handler and from scheduled AP queue handlers */
|
||||||
static void prism2_send_mgmt(struct net_device *dev,
|
static void prism2_send_mgmt(struct net_device *dev,
|
||||||
int type, int subtype, char *body,
|
u16 type_subtype, char *body,
|
||||||
int body_len, u8 *addr, u16 tx_cb_idx)
|
int body_len, u8 *addr, u16 tx_cb_idx)
|
||||||
{
|
{
|
||||||
struct hostap_interface *iface;
|
struct hostap_interface *iface;
|
||||||
@ -941,7 +942,7 @@ static void prism2_send_mgmt(struct net_device *dev,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fc = (type << 2) | (subtype << 4);
|
fc = type_subtype;
|
||||||
hdrlen = hostap_80211_get_hdrlen(fc);
|
hdrlen = hostap_80211_get_hdrlen(fc);
|
||||||
hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen);
|
hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen);
|
||||||
if (body)
|
if (body)
|
||||||
@ -954,11 +955,11 @@ 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 (type == WLAN_FC_TYPE_DATA) {
|
if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) {
|
||||||
fc |= WLAN_FC_FROMDS;
|
fc |= WLAN_FC_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 (type == WLAN_FC_TYPE_CTRL) {
|
} else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) {
|
||||||
/* control:ACK does not have addr2 or addr3 */
|
/* control:ACK does not have addr2 or addr3 */
|
||||||
memset(hdr->addr2, 0, ETH_ALEN);
|
memset(hdr->addr2, 0, ETH_ALEN);
|
||||||
memset(hdr->addr3, 0, ETH_ALEN);
|
memset(hdr->addr3, 0, ETH_ALEN);
|
||||||
@ -1475,7 +1476,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
|
|||||||
olen += 2 + WLAN_AUTH_CHALLENGE_LEN;
|
olen += 2 + WLAN_AUTH_CHALLENGE_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_AUTH,
|
prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH,
|
||||||
body, olen, hdr->addr2, ap->tx_callback_auth);
|
body, olen, hdr->addr2, ap->tx_callback_auth);
|
||||||
|
|
||||||
if (sta) {
|
if (sta) {
|
||||||
@ -1673,10 +1674,10 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
|
|||||||
pos = (u16 *) p;
|
pos = (u16 *) p;
|
||||||
}
|
}
|
||||||
|
|
||||||
prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT,
|
prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
|
||||||
(send_deauth ? WLAN_FC_STYPE_DEAUTH :
|
(send_deauth ? IEEE80211_STYPE_DEAUTH :
|
||||||
(reassoc ? WLAN_FC_STYPE_REASSOC_RESP :
|
(reassoc ? IEEE80211_STYPE_REASSOC_RESP :
|
||||||
WLAN_FC_STYPE_ASSOC_RESP)),
|
IEEE80211_STYPE_ASSOC_RESP)),
|
||||||
body, (u8 *) pos - (u8 *) body,
|
body, (u8 *) pos - (u8 *) body,
|
||||||
hdr->addr2,
|
hdr->addr2,
|
||||||
send_deauth ? 0 : local->ap->tx_callback_assoc);
|
send_deauth ? 0 : local->ap->tx_callback_assoc);
|
||||||
@ -1793,7 +1794,7 @@ static void ap_handle_data_nullfunc(local_info_t *local,
|
|||||||
* send control::ACK for the data::nullfunc */
|
* send control::ACK for the data::nullfunc */
|
||||||
|
|
||||||
printk(KERN_DEBUG "Sending control::ACK for data::nullfunc\n");
|
printk(KERN_DEBUG "Sending control::ACK for data::nullfunc\n");
|
||||||
prism2_send_mgmt(dev, WLAN_FC_TYPE_CTRL, WLAN_FC_STYPE_ACK,
|
prism2_send_mgmt(dev, IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK,
|
||||||
NULL, 0, hdr->addr2, 0);
|
NULL, 0, hdr->addr2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1820,9 +1821,9 @@ static void ap_handle_dropped_data(local_info_t *local,
|
|||||||
|
|
||||||
reason = __constant_cpu_to_le16(
|
reason = __constant_cpu_to_le16(
|
||||||
WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
|
WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
|
||||||
prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT,
|
prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
|
||||||
((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ?
|
((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ?
|
||||||
WLAN_FC_STYPE_DEAUTH : WLAN_FC_STYPE_DISASSOC),
|
IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC),
|
||||||
(char *) &reason, sizeof(reason), hdr->addr2, 0);
|
(char *) &reason, sizeof(reason), hdr->addr2, 0);
|
||||||
|
|
||||||
if (sta)
|
if (sta)
|
||||||
@ -2142,15 +2143,15 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
|
|||||||
* buffer is long enough */
|
* buffer is long enough */
|
||||||
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);
|
||||||
type = HOSTAP_FC_GET_TYPE(fc);
|
type = WLAN_FC_GET_TYPE(fc);
|
||||||
stype = HOSTAP_FC_GET_STYPE(fc);
|
stype = WLAN_FC_GET_STYPE(fc);
|
||||||
|
|
||||||
#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
|
#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
|
||||||
if (!local->hostapd && type == WLAN_FC_TYPE_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 & WLAN_FC_TODS) || (fc & WLAN_FC_FROMDS)) {
|
||||||
if (stype == WLAN_FC_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
|
||||||
* speed up re-association */
|
* speed up re-association */
|
||||||
@ -2169,20 +2170,21 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local->ap->nullfunc_ack && stype == WLAN_FC_STYPE_NULLFUNC)
|
if (local->ap->nullfunc_ack &&
|
||||||
|
stype == IEEE80211_STYPE_NULLFUNC)
|
||||||
ap_handle_data_nullfunc(local, hdr);
|
ap_handle_data_nullfunc(local, hdr);
|
||||||
else
|
else
|
||||||
ap_handle_dropped_data(local, hdr);
|
ap_handle_dropped_data(local, hdr);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_BEACON) {
|
if (type == IEEE80211_FTYPE_MGMT && stype == IEEE80211_STYPE_BEACON) {
|
||||||
handle_beacon(local, skb, rx_stats);
|
handle_beacon(local, skb, rx_stats);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
|
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
|
||||||
|
|
||||||
if (type == WLAN_FC_TYPE_CTRL && stype == WLAN_FC_STYPE_PSPOLL) {
|
if (type == IEEE80211_FTYPE_CTL && stype == IEEE80211_STYPE_PSPOLL) {
|
||||||
handle_pspoll(local, hdr, rx_stats);
|
handle_pspoll(local, hdr, rx_stats);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -2194,7 +2196,7 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
|
#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
|
||||||
if (type != WLAN_FC_TYPE_MGMT) {
|
if (type != IEEE80211_FTYPE_MGMT) {
|
||||||
PDEBUG(DEBUG_AP, "handle_ap_item - not a management frame?\n");
|
PDEBUG(DEBUG_AP, "handle_ap_item - not a management frame?\n");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -2212,32 +2214,33 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (stype) {
|
switch (stype) {
|
||||||
case WLAN_FC_STYPE_ASSOC_REQ:
|
case IEEE80211_STYPE_ASSOC_REQ:
|
||||||
handle_assoc(local, skb, rx_stats, 0);
|
handle_assoc(local, skb, rx_stats, 0);
|
||||||
break;
|
break;
|
||||||
case WLAN_FC_STYPE_ASSOC_RESP:
|
case IEEE80211_STYPE_ASSOC_RESP:
|
||||||
PDEBUG(DEBUG_AP, "==> ASSOC RESP (ignored)\n");
|
PDEBUG(DEBUG_AP, "==> ASSOC RESP (ignored)\n");
|
||||||
break;
|
break;
|
||||||
case WLAN_FC_STYPE_REASSOC_REQ:
|
case IEEE80211_STYPE_REASSOC_REQ:
|
||||||
handle_assoc(local, skb, rx_stats, 1);
|
handle_assoc(local, skb, rx_stats, 1);
|
||||||
break;
|
break;
|
||||||
case WLAN_FC_STYPE_REASSOC_RESP:
|
case IEEE80211_STYPE_REASSOC_RESP:
|
||||||
PDEBUG(DEBUG_AP, "==> REASSOC RESP (ignored)\n");
|
PDEBUG(DEBUG_AP, "==> REASSOC RESP (ignored)\n");
|
||||||
break;
|
break;
|
||||||
case WLAN_FC_STYPE_ATIM:
|
case IEEE80211_STYPE_ATIM:
|
||||||
PDEBUG(DEBUG_AP, "==> ATIM (ignored)\n");
|
PDEBUG(DEBUG_AP, "==> ATIM (ignored)\n");
|
||||||
break;
|
break;
|
||||||
case WLAN_FC_STYPE_DISASSOC:
|
case IEEE80211_STYPE_DISASSOC:
|
||||||
handle_disassoc(local, skb, rx_stats);
|
handle_disassoc(local, skb, rx_stats);
|
||||||
break;
|
break;
|
||||||
case WLAN_FC_STYPE_AUTH:
|
case IEEE80211_STYPE_AUTH:
|
||||||
handle_authen(local, skb, rx_stats);
|
handle_authen(local, skb, rx_stats);
|
||||||
break;
|
break;
|
||||||
case WLAN_FC_STYPE_DEAUTH:
|
case IEEE80211_STYPE_DEAUTH:
|
||||||
handle_deauth(local, skb, rx_stats);
|
handle_deauth(local, skb, rx_stats);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n", stype);
|
PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n",
|
||||||
|
stype >> 4);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
|
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
|
||||||
@ -2268,8 +2271,8 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
|
|||||||
fc = le16_to_cpu(hdr->frame_ctl);
|
fc = le16_to_cpu(hdr->frame_ctl);
|
||||||
|
|
||||||
if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL &&
|
if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL &&
|
||||||
HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
|
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT &&
|
||||||
HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
|
WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_BEACON)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
skb->protocol = __constant_htons(ETH_P_HOSTAP);
|
skb->protocol = __constant_htons(ETH_P_HOSTAP);
|
||||||
@ -2302,7 +2305,7 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
|
|||||||
|
|
||||||
/* Generate a fake pspoll frame to start packet delivery */
|
/* Generate a fake pspoll frame to start packet delivery */
|
||||||
hdr->frame_ctl = __constant_cpu_to_le16(
|
hdr->frame_ctl = __constant_cpu_to_le16(
|
||||||
(WLAN_FC_TYPE_CTRL << 2) | (WLAN_FC_STYPE_PSPOLL << 4));
|
IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
|
||||||
memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN);
|
memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN);
|
||||||
memcpy(hdr->addr2, sta->addr, ETH_ALEN);
|
memcpy(hdr->addr2, sta->addr, ETH_ALEN);
|
||||||
hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14));
|
hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14));
|
||||||
@ -2872,13 +2875,14 @@ static void hostap_update_sta_ps2(local_info_t *local, struct sta_info *sta,
|
|||||||
sta->flags |= WLAN_STA_PS;
|
sta->flags |= WLAN_STA_PS;
|
||||||
PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to use PS "
|
PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to use PS "
|
||||||
"mode (type=0x%02X, stype=0x%02X)\n",
|
"mode (type=0x%02X, stype=0x%02X)\n",
|
||||||
MAC2STR(sta->addr), type, stype);
|
MAC2STR(sta->addr), type >> 2, stype >> 4);
|
||||||
} else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) {
|
} else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) {
|
||||||
sta->flags &= ~WLAN_STA_PS;
|
sta->flags &= ~WLAN_STA_PS;
|
||||||
PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to not use "
|
PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to not use "
|
||||||
"PS mode (type=0x%02X, stype=0x%02X)\n",
|
"PS mode (type=0x%02X, stype=0x%02X)\n",
|
||||||
MAC2STR(sta->addr), type, stype);
|
MAC2STR(sta->addr), type >> 2, stype >> 4);
|
||||||
if (type != WLAN_FC_TYPE_CTRL || stype != WLAN_FC_STYPE_PSPOLL)
|
if (type != IEEE80211_FTYPE_CTL ||
|
||||||
|
stype != IEEE80211_STYPE_PSPOLL)
|
||||||
schedule_packet_send(local, sta);
|
schedule_packet_send(local, sta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2902,7 +2906,7 @@ int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr)
|
|||||||
|
|
||||||
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 & WLAN_FC_PWRMGT,
|
||||||
HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc));
|
WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc));
|
||||||
|
|
||||||
atomic_dec(&sta->users);
|
atomic_dec(&sta->users);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2927,8 +2931,8 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
|
|||||||
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);
|
||||||
type = HOSTAP_FC_GET_TYPE(fc);
|
type = WLAN_FC_GET_TYPE(fc);
|
||||||
stype = HOSTAP_FC_GET_STYPE(fc);
|
stype = WLAN_FC_GET_STYPE(fc);
|
||||||
|
|
||||||
spin_lock(&local->ap->sta_table_lock);
|
spin_lock(&local->ap->sta_table_lock);
|
||||||
sta = ap_get_sta(local->ap, hdr->addr2);
|
sta = ap_get_sta(local->ap, hdr->addr2);
|
||||||
@ -2952,8 +2956,8 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
|
|||||||
printk(KERN_DEBUG "%s: dropped received packet"
|
printk(KERN_DEBUG "%s: dropped received packet"
|
||||||
" from non-associated STA " MACSTR
|
" from non-associated STA " MACSTR
|
||||||
" (type=0x%02x, subtype=0x%02x)\n",
|
" (type=0x%02x, subtype=0x%02x)\n",
|
||||||
dev->name, MAC2STR(hdr->addr2), type,
|
dev->name, MAC2STR(hdr->addr2),
|
||||||
stype);
|
type >> 2, stype >> 4);
|
||||||
hostap_rx(dev, skb, rx_stats);
|
hostap_rx(dev, skb, rx_stats);
|
||||||
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
|
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
|
||||||
}
|
}
|
||||||
@ -2972,7 +2976,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
|
|||||||
ret = AP_RX_DROP;
|
ret = AP_RX_DROP;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else if (stype == WLAN_FC_STYPE_NULLFUNC && sta == NULL &&
|
} else if (stype == IEEE80211_STYPE_NULLFUNC && sta == NULL &&
|
||||||
memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
|
memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
|
||||||
|
|
||||||
if (local->hostapd) {
|
if (local->hostapd) {
|
||||||
@ -2994,7 +2998,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 (stype == WLAN_FC_STYPE_NULLFUNC) {
|
} else if (stype == IEEE80211_STYPE_NULLFUNC) {
|
||||||
/* At least Lucent cards seem to send periodic nullfunc
|
/* At least Lucent cards seem to send periodic nullfunc
|
||||||
* frames with ToDS. Let these through to update SQ
|
* frames with ToDS. Let these through to update SQ
|
||||||
* stats and PS state. Nullfunc frames do not contain
|
* stats and PS state. Nullfunc frames do not contain
|
||||||
@ -3007,7 +3011,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
|
|||||||
printk(KERN_DEBUG "%s: dropped received packet from "
|
printk(KERN_DEBUG "%s: dropped received packet from "
|
||||||
MACSTR " with no ToDS flag (type=0x%02x, "
|
MACSTR " with no ToDS flag (type=0x%02x, "
|
||||||
"subtype=0x%02x)\n", dev->name,
|
"subtype=0x%02x)\n", dev->name,
|
||||||
MAC2STR(hdr->addr2), type, stype);
|
MAC2STR(hdr->addr2), type >> 2, stype >> 4);
|
||||||
hostap_dump_rx_80211(dev->name, skb, rx_stats);
|
hostap_dump_rx_80211(dev->name, skb, rx_stats);
|
||||||
}
|
}
|
||||||
ret = AP_RX_DROP;
|
ret = AP_RX_DROP;
|
||||||
@ -3023,7 +3027,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
|
|||||||
sta->last_rx = jiffies;
|
sta->last_rx = jiffies;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local->ap->nullfunc_ack && stype == WLAN_FC_STYPE_NULLFUNC &&
|
if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC &&
|
||||||
fc & WLAN_FC_TODS) {
|
fc & WLAN_FC_TODS) {
|
||||||
if (local->hostapd) {
|
if (local->hostapd) {
|
||||||
prism2_rx_80211(local->apdev, skb, rx_stats,
|
prism2_rx_80211(local->apdev, skb, rx_stats,
|
||||||
|
@ -19,49 +19,6 @@
|
|||||||
#define WLAN_FC_ISWEP BIT(14)
|
#define WLAN_FC_ISWEP BIT(14)
|
||||||
#define WLAN_FC_ORDER BIT(15)
|
#define WLAN_FC_ORDER BIT(15)
|
||||||
|
|
||||||
/*
|
|
||||||
* 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_FC_TYPE_MGMT 0
|
|
||||||
#define WLAN_FC_TYPE_CTRL 1
|
|
||||||
#define WLAN_FC_TYPE_DATA 2
|
|
||||||
|
|
||||||
/* management */
|
|
||||||
#define WLAN_FC_STYPE_ASSOC_REQ 0
|
|
||||||
#define WLAN_FC_STYPE_ASSOC_RESP 1
|
|
||||||
#define WLAN_FC_STYPE_REASSOC_REQ 2
|
|
||||||
#define WLAN_FC_STYPE_REASSOC_RESP 3
|
|
||||||
#define WLAN_FC_STYPE_PROBE_REQ 4
|
|
||||||
#define WLAN_FC_STYPE_PROBE_RESP 5
|
|
||||||
#define WLAN_FC_STYPE_BEACON 8
|
|
||||||
#define WLAN_FC_STYPE_ATIM 9
|
|
||||||
#define WLAN_FC_STYPE_DISASSOC 10
|
|
||||||
#define WLAN_FC_STYPE_AUTH 11
|
|
||||||
#define WLAN_FC_STYPE_DEAUTH 12
|
|
||||||
|
|
||||||
/* control */
|
|
||||||
#define WLAN_FC_STYPE_PSPOLL 10
|
|
||||||
#define WLAN_FC_STYPE_RTS 11
|
|
||||||
#define WLAN_FC_STYPE_CTS 12
|
|
||||||
#define WLAN_FC_STYPE_ACK 13
|
|
||||||
#define WLAN_FC_STYPE_CFEND 14
|
|
||||||
#define WLAN_FC_STYPE_CFENDACK 15
|
|
||||||
|
|
||||||
/* data */
|
|
||||||
#define WLAN_FC_STYPE_DATA 0
|
|
||||||
#define WLAN_FC_STYPE_DATA_CFACK 1
|
|
||||||
#define WLAN_FC_STYPE_DATA_CFPOLL 2
|
|
||||||
#define WLAN_FC_STYPE_DATA_CFACKPOLL 3
|
|
||||||
#define WLAN_FC_STYPE_NULLFUNC 4
|
|
||||||
#define WLAN_FC_STYPE_CFACK 5
|
|
||||||
#define WLAN_FC_STYPE_CFPOLL 6
|
|
||||||
#define WLAN_FC_STYPE_CFACKPOLL 7
|
|
||||||
|
|
||||||
#define WLAN_CAPABILITY_ESS WLAN_CAPABILITY_BSS
|
#define WLAN_CAPABILITY_ESS WLAN_CAPABILITY_BSS
|
||||||
|
|
||||||
|
|
||||||
|
@ -1843,7 +1843,7 @@ static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev)
|
|||||||
hdr_len = 24;
|
hdr_len = 24;
|
||||||
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 (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA &&
|
if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
|
||||||
(fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS) && skb->len >= 30) {
|
(fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS) && skb->len >= 30) {
|
||||||
/* Addr4 */
|
/* Addr4 */
|
||||||
memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN);
|
memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN);
|
||||||
@ -2395,10 +2395,10 @@ 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,
|
||||||
HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT ? "Mgmt" : "",
|
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT ? "Mgmt" : "",
|
||||||
HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_CTRL ? "Ctrl" : "",
|
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "",
|
||||||
HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA ? "Data" : "",
|
WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "",
|
||||||
HOSTAP_FC_GET_STYPE(fc),
|
WLAN_FC_GET_STYPE(fc) >> 4,
|
||||||
fc & WLAN_FC_TODS ? " ToDS" : "",
|
fc & WLAN_FC_TODS ? " ToDS" : "",
|
||||||
fc & WLAN_FC_FROMDS ? " FromDS" : "");
|
fc & WLAN_FC_FROMDS ? " FromDS" : "");
|
||||||
PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3="
|
PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3="
|
||||||
|
@ -3784,11 +3784,11 @@ static int prism2_ioctl_siwmlme(struct net_device *dev,
|
|||||||
switch (mlme->cmd) {
|
switch (mlme->cmd) {
|
||||||
case IW_MLME_DEAUTH:
|
case IW_MLME_DEAUTH:
|
||||||
return prism2_sta_send_mgmt(local, mlme->addr.sa_data,
|
return prism2_sta_send_mgmt(local, mlme->addr.sa_data,
|
||||||
WLAN_FC_STYPE_DEAUTH,
|
IEEE80211_STYPE_DEAUTH,
|
||||||
(u8 *) &reason, 2);
|
(u8 *) &reason, 2);
|
||||||
case IW_MLME_DISASSOC:
|
case IW_MLME_DISASSOC:
|
||||||
return prism2_sta_send_mgmt(local, mlme->addr.sa_data,
|
return prism2_sta_send_mgmt(local, mlme->addr.sa_data,
|
||||||
WLAN_FC_STYPE_DISASSOC,
|
IEEE80211_STYPE_DISASSOC,
|
||||||
(u8 *) &reason, 2);
|
(u8 *) &reason, 2);
|
||||||
default:
|
default:
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
@ -3805,11 +3805,11 @@ static int prism2_ioctl_mlme(local_info_t *local,
|
|||||||
switch (param->u.mlme.cmd) {
|
switch (param->u.mlme.cmd) {
|
||||||
case MLME_STA_DEAUTH:
|
case MLME_STA_DEAUTH:
|
||||||
return prism2_sta_send_mgmt(local, param->sta_addr,
|
return prism2_sta_send_mgmt(local, param->sta_addr,
|
||||||
WLAN_FC_STYPE_DEAUTH,
|
IEEE80211_STYPE_DEAUTH,
|
||||||
(u8 *) &reason, 2);
|
(u8 *) &reason, 2);
|
||||||
case MLME_STA_DISASSOC:
|
case MLME_STA_DISASSOC:
|
||||||
return prism2_sta_send_mgmt(local, param->sta_addr,
|
return prism2_sta_send_mgmt(local, param->sta_addr,
|
||||||
WLAN_FC_STYPE_DISASSOC,
|
IEEE80211_STYPE_DISASSOC,
|
||||||
(u8 *) &reason, 2);
|
(u8 *) &reason, 2);
|
||||||
default:
|
default:
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
Loading…
Reference in New Issue
Block a user