aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap/hostap_ap.c
diff options
context:
space:
mode:
authorJouni Malinen <jkmaline@cc.hut.fi>2005-08-14 22:08:44 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-14 23:07:30 -0400
commit4339d328631aa815fe2181b9164b3690ca2db4da (patch)
tree1848ffbf700ccd4e38c70e218f91dd2a7eadf018 /drivers/net/wireless/hostap/hostap_ap.c
parentc0f72ca8e4f1b459b5582c1c8dcaf7e53151f069 (diff)
[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>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_ap.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c120
1 files changed, 62 insertions, 58 deletions
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 5cd8d23c30ee..596c4dde079d 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -46,7 +46,7 @@ static void handle_add_proc_queue(void *data);
46#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 46#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
47static void handle_wds_oper_queue(void *data); 47static void handle_wds_oper_queue(void *data);
48static void prism2_send_mgmt(struct net_device *dev, 48static void prism2_send_mgmt(struct net_device *dev,
49 int type, int subtype, char *body, 49 u16 type_subtype, char *body,
50 int body_len, u8 *addr, u16 tx_cb_idx); 50 int body_len, u8 *addr, u16 tx_cb_idx);
51#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 51#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
52 52
@@ -237,12 +237,12 @@ static void ap_handle_timer(unsigned long data)
237 } else if (sta->timeout_next == STA_NULLFUNC) { 237 } else if (sta->timeout_next == STA_NULLFUNC) {
238 /* send data frame to poll STA and check whether this frame 238 /* send data frame to poll STA and check whether this frame
239 * is ACKed */ 239 * is ACKed */
240 /* FIX: WLAN_FC_STYPE_NULLFUNC would be more appropriate, but 240 /* FIX: IEEE80211_STYPE_NULLFUNC would be more appropriate, but
241 * it is apparently not retried so TX Exc events are not 241 * it is apparently not retried so TX Exc events are not
242 * received for it */ 242 * received for it */
243 sta->flags |= WLAN_STA_PENDING_POLL; 243 sta->flags |= WLAN_STA_PENDING_POLL;
244 prism2_send_mgmt(local->dev, WLAN_FC_TYPE_DATA, 244 prism2_send_mgmt(local->dev, IEEE80211_FTYPE_DATA |
245 WLAN_FC_STYPE_DATA, NULL, 0, 245 IEEE80211_STYPE_DATA, NULL, 0,
246 sta->addr, ap->tx_callback_poll); 246 sta->addr, ap->tx_callback_poll);
247 } else { 247 } else {
248 int deauth = sta->timeout_next == STA_DEAUTH; 248 int deauth = sta->timeout_next == STA_DEAUTH;
@@ -255,9 +255,9 @@ static void ap_handle_timer(unsigned long data)
255 255
256 resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID : 256 resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID :
257 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); 257 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
258 prism2_send_mgmt(local->dev, WLAN_FC_TYPE_MGMT, 258 prism2_send_mgmt(local->dev, IEEE80211_FTYPE_MGMT |
259 (deauth ? WLAN_FC_STYPE_DEAUTH : 259 (deauth ? IEEE80211_STYPE_DEAUTH :
260 WLAN_FC_STYPE_DISASSOC), 260 IEEE80211_STYPE_DISASSOC),
261 (char *) &resp, 2, sta->addr, 0); 261 (char *) &resp, 2, sta->addr, 0);
262 } 262 }
263 263
@@ -300,7 +300,8 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap,
300 * else we can do at this point since the driver is going to be shut 300 * else we can do at this point since the driver is going to be shut
301 * down */ 301 * down */
302 for (i = 0; i < 5; i++) { 302 for (i = 0; i < 5; i++) {
303 prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_DEAUTH, 303 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
304 IEEE80211_STYPE_DEAUTH,
304 (char *) &resp, 2, addr, 0); 305 (char *) &resp, 2, addr, 0);
305 306
306 if (!resend || ap->num_sta <= 0) 307 if (!resend || ap->num_sta <= 0)
@@ -471,7 +472,7 @@ static int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev,
471 return -EINVAL; 472 return -EINVAL;
472 473
473 resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); 474 resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
474 prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_DEAUTH, 475 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH,
475 (char *) &resp, 2, sta->addr, 0); 476 (char *) &resp, 2, sta->addr, 0);
476 477
477 if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap) 478 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)
634 635
635 hdr = (struct ieee80211_hdr *) skb->data; 636 hdr = (struct ieee80211_hdr *) skb->data;
636 fc = le16_to_cpu(hdr->frame_ctl); 637 fc = le16_to_cpu(hdr->frame_ctl);
637 if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT || 638 if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT ||
638 HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_AUTH || 639 WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH ||
639 skb->len < IEEE80211_MGMT_HDR_LEN + 6) { 640 skb->len < IEEE80211_MGMT_HDR_LEN + 6) {
640 printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid " 641 printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid "
641 "frame\n", dev->name); 642 "frame\n", dev->name);
@@ -703,9 +704,9 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
703 704
704 hdr = (struct ieee80211_hdr *) skb->data; 705 hdr = (struct ieee80211_hdr *) skb->data;
705 fc = le16_to_cpu(hdr->frame_ctl); 706 fc = le16_to_cpu(hdr->frame_ctl);
706 if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT || 707 if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT ||
707 (HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ASSOC_RESP && 708 (WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP &&
708 HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_REASSOC_RESP) || 709 WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_REASSOC_RESP) ||
709 skb->len < IEEE80211_MGMT_HDR_LEN + 4) { 710 skb->len < IEEE80211_MGMT_HDR_LEN + 4) {
710 printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid " 711 printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid "
711 "frame\n", dev->name); 712 "frame\n", dev->name);
@@ -912,7 +913,7 @@ static struct sta_info* ap_get_sta(struct ap_data *ap, u8 *sta)
912 913
913/* Called from timer handler and from scheduled AP queue handlers */ 914/* Called from timer handler and from scheduled AP queue handlers */
914static void prism2_send_mgmt(struct net_device *dev, 915static void prism2_send_mgmt(struct net_device *dev,
915 int type, int subtype, char *body, 916 u16 type_subtype, char *body,
916 int body_len, u8 *addr, u16 tx_cb_idx) 917 int body_len, u8 *addr, u16 tx_cb_idx)
917{ 918{
918 struct hostap_interface *iface; 919 struct hostap_interface *iface;
@@ -941,7 +942,7 @@ static void prism2_send_mgmt(struct net_device *dev,
941 return; 942 return;
942 } 943 }
943 944
944 fc = (type << 2) | (subtype << 4); 945 fc = type_subtype;
945 hdrlen = hostap_80211_get_hdrlen(fc); 946 hdrlen = hostap_80211_get_hdrlen(fc);
946 hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen); 947 hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen);
947 if (body) 948 if (body)
@@ -954,11 +955,11 @@ static void prism2_send_mgmt(struct net_device *dev,
954 955
955 956
956 memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */ 957 memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */
957 if (type == WLAN_FC_TYPE_DATA) { 958 if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) {
958 fc |= WLAN_FC_FROMDS; 959 fc |= WLAN_FC_FROMDS;
959 memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */ 960 memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */
960 memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ 961 memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */
961 } else if (type == WLAN_FC_TYPE_CTRL) { 962 } else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) {
962 /* control:ACK does not have addr2 or addr3 */ 963 /* control:ACK does not have addr2 or addr3 */
963 memset(hdr->addr2, 0, ETH_ALEN); 964 memset(hdr->addr2, 0, ETH_ALEN);
964 memset(hdr->addr3, 0, ETH_ALEN); 965 memset(hdr->addr3, 0, ETH_ALEN);
@@ -1475,7 +1476,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1475 olen += 2 + WLAN_AUTH_CHALLENGE_LEN; 1476 olen += 2 + WLAN_AUTH_CHALLENGE_LEN;
1476 } 1477 }
1477 1478
1478 prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_AUTH, 1479 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH,
1479 body, olen, hdr->addr2, ap->tx_callback_auth); 1480 body, olen, hdr->addr2, ap->tx_callback_auth);
1480 1481
1481 if (sta) { 1482 if (sta) {
@@ -1673,10 +1674,10 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1673 pos = (u16 *) p; 1674 pos = (u16 *) p;
1674 } 1675 }
1675 1676
1676 prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, 1677 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
1677 (send_deauth ? WLAN_FC_STYPE_DEAUTH : 1678 (send_deauth ? IEEE80211_STYPE_DEAUTH :
1678 (reassoc ? WLAN_FC_STYPE_REASSOC_RESP : 1679 (reassoc ? IEEE80211_STYPE_REASSOC_RESP :
1679 WLAN_FC_STYPE_ASSOC_RESP)), 1680 IEEE80211_STYPE_ASSOC_RESP)),
1680 body, (u8 *) pos - (u8 *) body, 1681 body, (u8 *) pos - (u8 *) body,
1681 hdr->addr2, 1682 hdr->addr2,
1682 send_deauth ? 0 : local->ap->tx_callback_assoc); 1683 send_deauth ? 0 : local->ap->tx_callback_assoc);
@@ -1793,7 +1794,7 @@ static void ap_handle_data_nullfunc(local_info_t *local,
1793 * send control::ACK for the data::nullfunc */ 1794 * send control::ACK for the data::nullfunc */
1794 1795
1795 printk(KERN_DEBUG "Sending control::ACK for data::nullfunc\n"); 1796 printk(KERN_DEBUG "Sending control::ACK for data::nullfunc\n");
1796 prism2_send_mgmt(dev, WLAN_FC_TYPE_CTRL, WLAN_FC_STYPE_ACK, 1797 prism2_send_mgmt(dev, IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK,
1797 NULL, 0, hdr->addr2, 0); 1798 NULL, 0, hdr->addr2, 0);
1798} 1799}
1799 1800
@@ -1820,9 +1821,9 @@ static void ap_handle_dropped_data(local_info_t *local,
1820 1821
1821 reason = __constant_cpu_to_le16( 1822 reason = __constant_cpu_to_le16(
1822 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); 1823 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
1823 prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, 1824 prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT |
1824 ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ? 1825 ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ?
1825 WLAN_FC_STYPE_DEAUTH : WLAN_FC_STYPE_DISASSOC), 1826 IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC),
1826 (char *) &reason, sizeof(reason), hdr->addr2, 0); 1827 (char *) &reason, sizeof(reason), hdr->addr2, 0);
1827 1828
1828 if (sta) 1829 if (sta)
@@ -2142,15 +2143,15 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2142 * buffer is long enough */ 2143 * buffer is long enough */
2143 hdr = (struct ieee80211_hdr *) skb->data; 2144 hdr = (struct ieee80211_hdr *) skb->data;
2144 fc = le16_to_cpu(hdr->frame_ctl); 2145 fc = le16_to_cpu(hdr->frame_ctl);
2145 type = HOSTAP_FC_GET_TYPE(fc); 2146 type = WLAN_FC_GET_TYPE(fc);
2146 stype = HOSTAP_FC_GET_STYPE(fc); 2147 stype = WLAN_FC_GET_STYPE(fc);
2147 2148
2148#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 2149#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
2149 if (!local->hostapd && type == WLAN_FC_TYPE_DATA) { 2150 if (!local->hostapd && type == IEEE80211_FTYPE_DATA) {
2150 PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n"); 2151 PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n");
2151 2152
2152 if (!(fc & WLAN_FC_TODS) || (fc & WLAN_FC_FROMDS)) { 2153 if (!(fc & WLAN_FC_TODS) || (fc & WLAN_FC_FROMDS)) {
2153 if (stype == WLAN_FC_STYPE_NULLFUNC) { 2154 if (stype == IEEE80211_STYPE_NULLFUNC) {
2154 /* no ToDS nullfunc seems to be used to check 2155 /* no ToDS nullfunc seems to be used to check
2155 * AP association; so send reject message to 2156 * AP association; so send reject message to
2156 * speed up re-association */ 2157 * speed up re-association */
@@ -2169,20 +2170,21 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2169 goto done; 2170 goto done;
2170 } 2171 }
2171 2172
2172 if (local->ap->nullfunc_ack && stype == WLAN_FC_STYPE_NULLFUNC) 2173 if (local->ap->nullfunc_ack &&
2174 stype == IEEE80211_STYPE_NULLFUNC)
2173 ap_handle_data_nullfunc(local, hdr); 2175 ap_handle_data_nullfunc(local, hdr);
2174 else 2176 else
2175 ap_handle_dropped_data(local, hdr); 2177 ap_handle_dropped_data(local, hdr);
2176 goto done; 2178 goto done;
2177 } 2179 }
2178 2180
2179 if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_BEACON) { 2181 if (type == IEEE80211_FTYPE_MGMT && stype == IEEE80211_STYPE_BEACON) {
2180 handle_beacon(local, skb, rx_stats); 2182 handle_beacon(local, skb, rx_stats);
2181 goto done; 2183 goto done;
2182 } 2184 }
2183#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2185#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
2184 2186
2185 if (type == WLAN_FC_TYPE_CTRL && stype == WLAN_FC_STYPE_PSPOLL) { 2187 if (type == IEEE80211_FTYPE_CTL && stype == IEEE80211_STYPE_PSPOLL) {
2186 handle_pspoll(local, hdr, rx_stats); 2188 handle_pspoll(local, hdr, rx_stats);
2187 goto done; 2189 goto done;
2188 } 2190 }
@@ -2194,7 +2196,7 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2194 } 2196 }
2195 2197
2196#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 2198#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
2197 if (type != WLAN_FC_TYPE_MGMT) { 2199 if (type != IEEE80211_FTYPE_MGMT) {
2198 PDEBUG(DEBUG_AP, "handle_ap_item - not a management frame?\n"); 2200 PDEBUG(DEBUG_AP, "handle_ap_item - not a management frame?\n");
2199 goto done; 2201 goto done;
2200 } 2202 }
@@ -2212,32 +2214,33 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2212 } 2214 }
2213 2215
2214 switch (stype) { 2216 switch (stype) {
2215 case WLAN_FC_STYPE_ASSOC_REQ: 2217 case IEEE80211_STYPE_ASSOC_REQ:
2216 handle_assoc(local, skb, rx_stats, 0); 2218 handle_assoc(local, skb, rx_stats, 0);
2217 break; 2219 break;
2218 case WLAN_FC_STYPE_ASSOC_RESP: 2220 case IEEE80211_STYPE_ASSOC_RESP:
2219 PDEBUG(DEBUG_AP, "==> ASSOC RESP (ignored)\n"); 2221 PDEBUG(DEBUG_AP, "==> ASSOC RESP (ignored)\n");
2220 break; 2222 break;
2221 case WLAN_FC_STYPE_REASSOC_REQ: 2223 case IEEE80211_STYPE_REASSOC_REQ:
2222 handle_assoc(local, skb, rx_stats, 1); 2224 handle_assoc(local, skb, rx_stats, 1);
2223 break; 2225 break;
2224 case WLAN_FC_STYPE_REASSOC_RESP: 2226 case IEEE80211_STYPE_REASSOC_RESP:
2225 PDEBUG(DEBUG_AP, "==> REASSOC RESP (ignored)\n"); 2227 PDEBUG(DEBUG_AP, "==> REASSOC RESP (ignored)\n");
2226 break; 2228 break;
2227 case WLAN_FC_STYPE_ATIM: 2229 case IEEE80211_STYPE_ATIM:
2228 PDEBUG(DEBUG_AP, "==> ATIM (ignored)\n"); 2230 PDEBUG(DEBUG_AP, "==> ATIM (ignored)\n");
2229 break; 2231 break;
2230 case WLAN_FC_STYPE_DISASSOC: 2232 case IEEE80211_STYPE_DISASSOC:
2231 handle_disassoc(local, skb, rx_stats); 2233 handle_disassoc(local, skb, rx_stats);
2232 break; 2234 break;
2233 case WLAN_FC_STYPE_AUTH: 2235 case IEEE80211_STYPE_AUTH:
2234 handle_authen(local, skb, rx_stats); 2236 handle_authen(local, skb, rx_stats);
2235 break; 2237 break;
2236 case WLAN_FC_STYPE_DEAUTH: 2238 case IEEE80211_STYPE_DEAUTH:
2237 handle_deauth(local, skb, rx_stats); 2239 handle_deauth(local, skb, rx_stats);
2238 break; 2240 break;
2239 default: 2241 default:
2240 PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n", stype); 2242 PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n",
2243 stype >> 4);
2241 break; 2244 break;
2242 } 2245 }
2243#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2246#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
@@ -2268,8 +2271,8 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
2268 fc = le16_to_cpu(hdr->frame_ctl); 2271 fc = le16_to_cpu(hdr->frame_ctl);
2269 2272
2270 if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && 2273 if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL &&
2271 HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT && 2274 WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT &&
2272 HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON) 2275 WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_BEACON)
2273 goto drop; 2276 goto drop;
2274 2277
2275 skb->protocol = __constant_htons(ETH_P_HOSTAP); 2278 skb->protocol = __constant_htons(ETH_P_HOSTAP);
@@ -2302,7 +2305,7 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
2302 2305
2303 /* Generate a fake pspoll frame to start packet delivery */ 2306 /* Generate a fake pspoll frame to start packet delivery */
2304 hdr->frame_ctl = __constant_cpu_to_le16( 2307 hdr->frame_ctl = __constant_cpu_to_le16(
2305 (WLAN_FC_TYPE_CTRL << 2) | (WLAN_FC_STYPE_PSPOLL << 4)); 2308 IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
2306 memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN); 2309 memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN);
2307 memcpy(hdr->addr2, sta->addr, ETH_ALEN); 2310 memcpy(hdr->addr2, sta->addr, ETH_ALEN);
2308 hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14)); 2311 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,
2872 sta->flags |= WLAN_STA_PS; 2875 sta->flags |= WLAN_STA_PS;
2873 PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to use PS " 2876 PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to use PS "
2874 "mode (type=0x%02X, stype=0x%02X)\n", 2877 "mode (type=0x%02X, stype=0x%02X)\n",
2875 MAC2STR(sta->addr), type, stype); 2878 MAC2STR(sta->addr), type >> 2, stype >> 4);
2876 } else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) { 2879 } else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) {
2877 sta->flags &= ~WLAN_STA_PS; 2880 sta->flags &= ~WLAN_STA_PS;
2878 PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to not use " 2881 PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to not use "
2879 "PS mode (type=0x%02X, stype=0x%02X)\n", 2882 "PS mode (type=0x%02X, stype=0x%02X)\n",
2880 MAC2STR(sta->addr), type, stype); 2883 MAC2STR(sta->addr), type >> 2, stype >> 4);
2881 if (type != WLAN_FC_TYPE_CTRL || stype != WLAN_FC_STYPE_PSPOLL) 2884 if (type != IEEE80211_FTYPE_CTL ||
2885 stype != IEEE80211_STYPE_PSPOLL)
2882 schedule_packet_send(local, sta); 2886 schedule_packet_send(local, sta);
2883 } 2887 }
2884} 2888}
@@ -2902,7 +2906,7 @@ int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr)
2902 2906
2903 fc = le16_to_cpu(hdr->frame_ctl); 2907 fc = le16_to_cpu(hdr->frame_ctl);
2904 hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, 2908 hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT,
2905 HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc)); 2909 WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc));
2906 2910
2907 atomic_dec(&sta->users); 2911 atomic_dec(&sta->users);
2908 return 0; 2912 return 0;
@@ -2927,8 +2931,8 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2927 hdr = (struct ieee80211_hdr *) skb->data; 2931 hdr = (struct ieee80211_hdr *) skb->data;
2928 2932
2929 fc = le16_to_cpu(hdr->frame_ctl); 2933 fc = le16_to_cpu(hdr->frame_ctl);
2930 type = HOSTAP_FC_GET_TYPE(fc); 2934 type = WLAN_FC_GET_TYPE(fc);
2931 stype = HOSTAP_FC_GET_STYPE(fc); 2935 stype = WLAN_FC_GET_STYPE(fc);
2932 2936
2933 spin_lock(&local->ap->sta_table_lock); 2937 spin_lock(&local->ap->sta_table_lock);
2934 sta = ap_get_sta(local->ap, hdr->addr2); 2938 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,
2952 printk(KERN_DEBUG "%s: dropped received packet" 2956 printk(KERN_DEBUG "%s: dropped received packet"
2953 " from non-associated STA " MACSTR 2957 " from non-associated STA " MACSTR
2954 " (type=0x%02x, subtype=0x%02x)\n", 2958 " (type=0x%02x, subtype=0x%02x)\n",
2955 dev->name, MAC2STR(hdr->addr2), type, 2959 dev->name, MAC2STR(hdr->addr2),
2956 stype); 2960 type >> 2, stype >> 4);
2957 hostap_rx(dev, skb, rx_stats); 2961 hostap_rx(dev, skb, rx_stats);
2958#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2962#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
2959 } 2963 }
@@ -2972,7 +2976,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2972 ret = AP_RX_DROP; 2976 ret = AP_RX_DROP;
2973 goto out; 2977 goto out;
2974 } 2978 }
2975 } else if (stype == WLAN_FC_STYPE_NULLFUNC && sta == NULL && 2979 } else if (stype == IEEE80211_STYPE_NULLFUNC && sta == NULL &&
2976 memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { 2980 memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
2977 2981
2978 if (local->hostapd) { 2982 if (local->hostapd) {
@@ -2994,7 +2998,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2994 } 2998 }
2995 ret = AP_RX_EXIT; 2999 ret = AP_RX_EXIT;
2996 goto out; 3000 goto out;
2997 } else if (stype == WLAN_FC_STYPE_NULLFUNC) { 3001 } else if (stype == IEEE80211_STYPE_NULLFUNC) {
2998 /* At least Lucent cards seem to send periodic nullfunc 3002 /* At least Lucent cards seem to send periodic nullfunc
2999 * frames with ToDS. Let these through to update SQ 3003 * frames with ToDS. Let these through to update SQ
3000 * stats and PS state. Nullfunc frames do not contain 3004 * 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,
3007 printk(KERN_DEBUG "%s: dropped received packet from " 3011 printk(KERN_DEBUG "%s: dropped received packet from "
3008 MACSTR " with no ToDS flag (type=0x%02x, " 3012 MACSTR " with no ToDS flag (type=0x%02x, "
3009 "subtype=0x%02x)\n", dev->name, 3013 "subtype=0x%02x)\n", dev->name,
3010 MAC2STR(hdr->addr2), type, stype); 3014 MAC2STR(hdr->addr2), type >> 2, stype >> 4);
3011 hostap_dump_rx_80211(dev->name, skb, rx_stats); 3015 hostap_dump_rx_80211(dev->name, skb, rx_stats);
3012 } 3016 }
3013 ret = AP_RX_DROP; 3017 ret = AP_RX_DROP;
@@ -3023,7 +3027,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3023 sta->last_rx = jiffies; 3027 sta->last_rx = jiffies;
3024 } 3028 }
3025 3029
3026 if (local->ap->nullfunc_ack && stype == WLAN_FC_STYPE_NULLFUNC && 3030 if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC &&
3027 fc & WLAN_FC_TODS) { 3031 fc & WLAN_FC_TODS) {
3028 if (local->hostapd) { 3032 if (local->hostapd) {
3029 prism2_rx_80211(local->apdev, skb, rx_stats, 3033 prism2_rx_80211(local->apdev, skb, rx_stats,