aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/mlme.c47
1 files changed, 11 insertions, 36 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e917e1b72631..62357a208851 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -416,17 +416,18 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
416} 416}
417 417
418 418
419static void ieee80211_send_deauth(struct ieee80211_sub_if_data *sdata, 419static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
420 struct ieee80211_if_sta *ifsta, u16 reason) 420 u16 stype, u16 reason)
421{ 421{
422 struct ieee80211_local *local = sdata->local; 422 struct ieee80211_local *local = sdata->local;
423 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
423 struct sk_buff *skb; 424 struct sk_buff *skb;
424 struct ieee80211_mgmt *mgmt; 425 struct ieee80211_mgmt *mgmt;
425 426
426 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); 427 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt));
427 if (!skb) { 428 if (!skb) {
428 printk(KERN_DEBUG "%s: failed to allocate buffer for deauth " 429 printk(KERN_DEBUG "%s: failed to allocate buffer for "
429 "frame\n", sdata->dev->name); 430 "deauth/disassoc frame\n", sdata->dev->name);
430 return; 431 return;
431 } 432 }
432 skb_reserve(skb, local->hw.extra_tx_headroom); 433 skb_reserve(skb, local->hw.extra_tx_headroom);
@@ -436,42 +437,14 @@ static void ieee80211_send_deauth(struct ieee80211_sub_if_data *sdata,
436 memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); 437 memcpy(mgmt->da, ifsta->bssid, ETH_ALEN);
437 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); 438 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
438 memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); 439 memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
439 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 440 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype);
440 IEEE80211_STYPE_DEAUTH);
441 skb_put(skb, 2); 441 skb_put(skb, 2);
442 /* u.deauth.reason_code == u.disassoc.reason_code */
442 mgmt->u.deauth.reason_code = cpu_to_le16(reason); 443 mgmt->u.deauth.reason_code = cpu_to_le16(reason);
443 444
444 ieee80211_sta_tx(sdata, skb, 0); 445 ieee80211_sta_tx(sdata, skb, 0);
445} 446}
446 447
447static void ieee80211_send_disassoc(struct ieee80211_sub_if_data *sdata,
448 struct ieee80211_if_sta *ifsta, u16 reason)
449{
450 struct ieee80211_local *local = sdata->local;
451 struct sk_buff *skb;
452 struct ieee80211_mgmt *mgmt;
453
454 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt));
455 if (!skb) {
456 printk(KERN_DEBUG "%s: failed to allocate buffer for disassoc "
457 "frame\n", sdata->dev->name);
458 return;
459 }
460 skb_reserve(skb, local->hw.extra_tx_headroom);
461
462 mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
463 memset(mgmt, 0, 24);
464 memcpy(mgmt->da, ifsta->bssid, ETH_ALEN);
465 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
466 memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
467 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
468 IEEE80211_STYPE_DISASSOC);
469 skb_put(skb, 2);
470 mgmt->u.disassoc.reason_code = cpu_to_le16(reason);
471
472 ieee80211_sta_tx(sdata, skb, 0);
473}
474
475static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *da, u16 tid, 448static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *da, u16 tid,
476 u8 dialog_token, u16 status, u16 policy, 449 u8 dialog_token, u16 status, u16 policy,
477 u16 buf_size, u16 timeout) 450 u16 buf_size, u16 timeout)
@@ -919,9 +892,11 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
919 892
920 if (self_disconnected) { 893 if (self_disconnected) {
921 if (deauth) 894 if (deauth)
922 ieee80211_send_deauth(sdata, ifsta, reason); 895 ieee80211_send_deauth_disassoc(sdata,
896 IEEE80211_STYPE_DEAUTH, reason);
923 else 897 else
924 ieee80211_send_disassoc(sdata, ifsta, reason); 898 ieee80211_send_deauth_disassoc(sdata,
899 IEEE80211_STYPE_DISASSOC, reason);
925 } 900 }
926 901
927 ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; 902 ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;