diff options
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_80211_tx.c')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_80211_tx.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c index 078a010f39a0..6693423f63fe 100644 --- a/drivers/net/wireless/hostap/hostap_80211_tx.c +++ b/drivers/net/wireless/hostap/hostap_80211_tx.c | |||
@@ -15,10 +15,10 @@ static unsigned char bridge_tunnel_header[] = | |||
15 | 15 | ||
16 | void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) | 16 | void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) |
17 | { | 17 | { |
18 | struct ieee80211_hdr_4addr *hdr; | 18 | struct ieee80211_hdr *hdr; |
19 | u16 fc; | 19 | u16 fc; |
20 | 20 | ||
21 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 21 | hdr = (struct ieee80211_hdr *) skb->data; |
22 | 22 | ||
23 | printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n", | 23 | printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n", |
24 | name, skb->len, jiffies); | 24 | name, skb->len, jiffies); |
@@ -26,9 +26,10 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) | |||
26 | if (skb->len < 2) | 26 | if (skb->len < 2) |
27 | return; | 27 | return; |
28 | 28 | ||
29 | fc = le16_to_cpu(hdr->frame_ctl); | 29 | fc = le16_to_cpu(hdr->frame_control); |
30 | printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", | 30 | printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", |
31 | fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, | 31 | fc, (fc & IEEE80211_FCTL_FTYPE) >> 2, |
32 | (fc & IEEE80211_FCTL_STYPE) >> 4, | ||
32 | fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", | 33 | fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", |
33 | fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); | 34 | fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); |
34 | 35 | ||
@@ -38,7 +39,7 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) | |||
38 | } | 39 | } |
39 | 40 | ||
40 | printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), | 41 | printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), |
41 | le16_to_cpu(hdr->seq_ctl)); | 42 | le16_to_cpu(hdr->seq_ctrl)); |
42 | 43 | ||
43 | printk(KERN_DEBUG " A1=%pM", hdr->addr1); | 44 | printk(KERN_DEBUG " A1=%pM", hdr->addr1); |
44 | printk(" A2=%pM", hdr->addr2); | 45 | printk(" A2=%pM", hdr->addr2); |
@@ -57,7 +58,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
57 | struct hostap_interface *iface; | 58 | struct hostap_interface *iface; |
58 | local_info_t *local; | 59 | local_info_t *local; |
59 | int need_headroom, need_tailroom = 0; | 60 | int need_headroom, need_tailroom = 0; |
60 | struct ieee80211_hdr_4addr hdr; | 61 | struct ieee80211_hdr hdr; |
61 | u16 fc, ethertype = 0; | 62 | u16 fc, ethertype = 0; |
62 | enum { | 63 | enum { |
63 | WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME | 64 | WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME |
@@ -201,7 +202,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
201 | memcpy(&hdr.addr3, local->bssid, ETH_ALEN); | 202 | memcpy(&hdr.addr3, local->bssid, ETH_ALEN); |
202 | } | 203 | } |
203 | 204 | ||
204 | hdr.frame_ctl = cpu_to_le16(fc); | 205 | hdr.frame_control = cpu_to_le16(fc); |
205 | 206 | ||
206 | skb_pull(skb, skip_header_bytes); | 207 | skb_pull(skb, skip_header_bytes); |
207 | need_headroom = local->func->need_tx_headroom + hdr_len + encaps_len; | 208 | need_headroom = local->func->need_tx_headroom + hdr_len + encaps_len; |
@@ -265,7 +266,7 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
265 | struct hostap_interface *iface; | 266 | struct hostap_interface *iface; |
266 | local_info_t *local; | 267 | local_info_t *local; |
267 | struct hostap_skb_tx_data *meta; | 268 | struct hostap_skb_tx_data *meta; |
268 | struct ieee80211_hdr_4addr *hdr; | 269 | struct ieee80211_hdr *hdr; |
269 | u16 fc; | 270 | u16 fc; |
270 | 271 | ||
271 | iface = netdev_priv(dev); | 272 | iface = netdev_priv(dev); |
@@ -287,10 +288,10 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
287 | meta->iface = iface; | 288 | meta->iface = iface; |
288 | 289 | ||
289 | if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { | 290 | if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { |
290 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 291 | hdr = (struct ieee80211_hdr *) skb->data; |
291 | fc = le16_to_cpu(hdr->frame_ctl); | 292 | fc = le16_to_cpu(hdr->frame_control); |
292 | if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && | 293 | if (ieee80211_is_data(hdr->frame_control) && |
293 | WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) { | 294 | (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_DATA) { |
294 | u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN + | 295 | u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN + |
295 | sizeof(rfc1042_header)]; | 296 | sizeof(rfc1042_header)]; |
296 | meta->ethertype = (pos[0] << 8) | pos[1]; | 297 | meta->ethertype = (pos[0] << 8) | pos[1]; |
@@ -310,8 +311,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
310 | { | 311 | { |
311 | struct hostap_interface *iface; | 312 | struct hostap_interface *iface; |
312 | local_info_t *local; | 313 | local_info_t *local; |
313 | struct ieee80211_hdr_4addr *hdr; | 314 | struct ieee80211_hdr *hdr; |
314 | u16 fc; | ||
315 | int prefix_len, postfix_len, hdr_len, res; | 315 | int prefix_len, postfix_len, hdr_len, res; |
316 | 316 | ||
317 | iface = netdev_priv(skb->dev); | 317 | iface = netdev_priv(skb->dev); |
@@ -324,7 +324,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
324 | 324 | ||
325 | if (local->tkip_countermeasures && | 325 | if (local->tkip_countermeasures && |
326 | strcmp(crypt->ops->name, "TKIP") == 0) { | 326 | strcmp(crypt->ops->name, "TKIP") == 0) { |
327 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 327 | hdr = (struct ieee80211_hdr *) skb->data; |
328 | if (net_ratelimit()) { | 328 | if (net_ratelimit()) { |
329 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " | 329 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " |
330 | "TX packet to %pM\n", | 330 | "TX packet to %pM\n", |
@@ -349,9 +349,8 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
349 | return NULL; | 349 | return NULL; |
350 | } | 350 | } |
351 | 351 | ||
352 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 352 | hdr = (struct ieee80211_hdr *) skb->data; |
353 | fc = le16_to_cpu(hdr->frame_ctl); | 353 | hdr_len = hostap_80211_get_hdrlen(hdr->frame_control); |
354 | hdr_len = hostap_80211_get_hdrlen(fc); | ||
355 | 354 | ||
356 | /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so | 355 | /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so |
357 | * call both MSDU and MPDU encryption functions from here. */ | 356 | * call both MSDU and MPDU encryption functions from here. */ |
@@ -384,7 +383,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
384 | ap_tx_ret tx_ret; | 383 | ap_tx_ret tx_ret; |
385 | struct hostap_skb_tx_data *meta; | 384 | struct hostap_skb_tx_data *meta; |
386 | int no_encrypt = 0; | 385 | int no_encrypt = 0; |
387 | struct ieee80211_hdr_4addr *hdr; | 386 | struct ieee80211_hdr *hdr; |
388 | 387 | ||
389 | iface = netdev_priv(dev); | 388 | iface = netdev_priv(dev); |
390 | local = iface->local; | 389 | local = iface->local; |
@@ -427,14 +426,14 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
427 | tx_ret = hostap_handle_sta_tx(local, &tx); | 426 | tx_ret = hostap_handle_sta_tx(local, &tx); |
428 | skb = tx.skb; | 427 | skb = tx.skb; |
429 | meta = (struct hostap_skb_tx_data *) skb->cb; | 428 | meta = (struct hostap_skb_tx_data *) skb->cb; |
430 | hdr = (struct ieee80211_hdr_4addr *) skb->data; | 429 | hdr = (struct ieee80211_hdr *) skb->data; |
431 | fc = le16_to_cpu(hdr->frame_ctl); | 430 | fc = le16_to_cpu(hdr->frame_control); |
432 | switch (tx_ret) { | 431 | switch (tx_ret) { |
433 | case AP_TX_CONTINUE: | 432 | case AP_TX_CONTINUE: |
434 | break; | 433 | break; |
435 | case AP_TX_CONTINUE_NOT_AUTHORIZED: | 434 | case AP_TX_CONTINUE_NOT_AUTHORIZED: |
436 | if (local->ieee_802_1x && | 435 | if (local->ieee_802_1x && |
437 | WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && | 436 | ieee80211_is_data(hdr->frame_control) && |
438 | meta->ethertype != ETH_P_PAE && | 437 | meta->ethertype != ETH_P_PAE && |
439 | !(meta->flags & HOSTAP_TX_FLAGS_WDS)) { | 438 | !(meta->flags & HOSTAP_TX_FLAGS_WDS)) { |
440 | printk(KERN_DEBUG "%s: dropped frame to unauthorized " | 439 | printk(KERN_DEBUG "%s: dropped frame to unauthorized " |
@@ -469,10 +468,10 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
469 | 468 | ||
470 | /* remove special version from the frame header */ | 469 | /* remove special version from the frame header */ |
471 | fc &= ~IEEE80211_FCTL_VERS; | 470 | fc &= ~IEEE80211_FCTL_VERS; |
472 | hdr->frame_ctl = cpu_to_le16(fc); | 471 | hdr->frame_control = cpu_to_le16(fc); |
473 | } | 472 | } |
474 | 473 | ||
475 | if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_DATA) { | 474 | if (!ieee80211_is_data(hdr->frame_control)) { |
476 | no_encrypt = 1; | 475 | no_encrypt = 1; |
477 | tx.crypt = NULL; | 476 | tx.crypt = NULL; |
478 | } | 477 | } |
@@ -493,9 +492,9 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
493 | /* Add ISWEP flag both for firmware and host based encryption | 492 | /* Add ISWEP flag both for firmware and host based encryption |
494 | */ | 493 | */ |
495 | fc |= IEEE80211_FCTL_PROTECTED; | 494 | fc |= IEEE80211_FCTL_PROTECTED; |
496 | hdr->frame_ctl = cpu_to_le16(fc); | 495 | hdr->frame_control = cpu_to_le16(fc); |
497 | } else if (local->drop_unencrypted && | 496 | } else if (local->drop_unencrypted && |
498 | WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && | 497 | ieee80211_is_data(hdr->frame_control) && |
499 | meta->ethertype != ETH_P_PAE) { | 498 | meta->ethertype != ETH_P_PAE) { |
500 | if (net_ratelimit()) { | 499 | if (net_ratelimit()) { |
501 | printk(KERN_DEBUG "%s: dropped unencrypted TX data " | 500 | printk(KERN_DEBUG "%s: dropped unencrypted TX data " |