OSDN Git Service

Merge branch 'for-john' of git://git.sipsolutions.net/mac80211-next
authorJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Jul 2012 20:34:39 +0000 (16:34 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Jul 2012 20:34:39 +0000 (16:34 -0400)
1  2 
net/mac80211/mlme.c

diff --combined net/mac80211/mlme.c
@@@ -541,6 -541,8 +541,8 @@@ static void ieee80211_send_assoc(struc
                memcpy(pos, assoc_data->ie + offset, noffset - offset);
        }
  
+       drv_mgd_prepare_tx(local, sdata);
        IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
        ieee80211_tx_skb(sdata, skb);
  }
@@@ -580,6 -582,9 +582,9 @@@ static void ieee80211_send_deauth_disas
                if (!(ifmgd->flags & IEEE80211_STA_MFP_ENABLED))
                        IEEE80211_SKB_CB(skb)->flags |=
                                IEEE80211_TX_INTFL_DONT_ENCRYPT;
+               drv_mgd_prepare_tx(local, sdata);
                ieee80211_tx_skb(sdata, skb);
        }
  }
@@@ -902,9 -907,6 +907,6 @@@ static bool ieee80211_powersave_allowed
        if (!mgd->associated)
                return false;
  
-       if (!mgd->associated->beacon_ies)
-               return false;
        if (mgd->flags & (IEEE80211_STA_BEACON_POLL |
                          IEEE80211_STA_CONNECTION_POLL))
                return false;
@@@ -1324,6 -1326,7 +1326,6 @@@ static void ieee80211_set_disassoc(stru
        struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
        u32 changed = 0;
 -      u8 bssid[ETH_ALEN];
  
        ASSERT_MGD_MTX(ifmgd);
  
  
        ieee80211_stop_poll(sdata);
  
 -      memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
 -
        ifmgd->associated = NULL;
 -      memset(ifmgd->bssid, 0, ETH_ALEN);
  
        /*
         * we need to commit the associated = NULL change because the
        netif_carrier_off(sdata->dev);
  
        mutex_lock(&local->sta_mtx);
 -      sta = sta_info_get(sdata, bssid);
 +      sta = sta_info_get(sdata, ifmgd->bssid);
        if (sta) {
                set_sta_flag(sta, WLAN_STA_BLOCK_BA);
                ieee80211_sta_tear_down_BA_sessions(sta, tx);
        }
        mutex_unlock(&local->sta_mtx);
  
+       /* flush out any pending frame (e.g. DELBA) before deauth/disassoc */
+       if (tx)
+               drv_flush(local, false);
        /* deauthenticate/disassociate now */
        if (tx || frame_buf)
 -              ieee80211_send_deauth_disassoc(sdata, bssid, stype, reason,
 -                                             tx, frame_buf);
 +              ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, stype,
 +                                             reason, tx, frame_buf);
  
        /* flush out frame */
        if (tx)
                drv_flush(local, false);
  
 +      /* clear bssid only after building the needed mgmt frames */
 +      memset(ifmgd->bssid, 0, ETH_ALEN);
 +
        /* remove AP and TDLS peers */
        sta_info_flush(local, sdata);
  
@@@ -1610,6 -1617,7 +1616,7 @@@ struct sk_buff *ieee80211_ap_probereq_g
  {
        struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+       struct cfg80211_bss *cbss;
        struct sk_buff *skb;
        const u8 *ssid;
        int ssid_len;
  
        ASSERT_MGD_MTX(ifmgd);
  
-       if (!ifmgd->associated)
+       if (ifmgd->associated)
+               cbss = ifmgd->associated;
+       else if (ifmgd->auth_data)
+               cbss = ifmgd->auth_data->bss;
+       else if (ifmgd->assoc_data)
+               cbss = ifmgd->assoc_data->bss;
+       else
                return NULL;
  
-       ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID);
+       ssid = ieee80211_bss_get_ie(cbss, WLAN_EID_SSID);
        if (WARN_ON_ONCE(ssid == NULL))
                ssid_len = 0;
        else
                ssid_len = ssid[1];
  
-       skb = ieee80211_build_probe_req(sdata, ifmgd->associated->bssid,
+       skb = ieee80211_build_probe_req(sdata, cbss->bssid,
                                        (u32) -1, ssid + 2, ssid_len,
                                        NULL, 0, true);
  
@@@ -1747,6 -1761,7 +1760,7 @@@ static void ieee80211_auth_challenge(st
        if (!elems.challenge)
                return;
        auth_data->expected_transaction = 4;
+       drv_mgd_prepare_tx(sdata->local, sdata);
        ieee80211_send_auth(sdata, 3, auth_data->algorithm,
                            elems.challenge - 2, elems.challenge_len + 2,
                            auth_data->bss->bssid, auth_data->bss->bssid,
@@@ -2152,13 -2167,15 +2166,13 @@@ ieee80211_rx_mgmt_assoc_resp(struct iee
                           mgmt->sa, status_code);
                ieee80211_destroy_assoc_data(sdata, false);
        } else {
 -              sdata_info(sdata, "associated\n");
 -
                if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
                        /* oops -- internal error -- send timeout for now */
 -                      ieee80211_destroy_assoc_data(sdata, true);
 -                      sta_info_destroy_addr(sdata, mgmt->bssid);
 +                      ieee80211_destroy_assoc_data(sdata, false);
                        cfg80211_put_bss(*bss);
                        return RX_MGMT_CFG80211_ASSOC_TIMEOUT;
                }
 +              sdata_info(sdata, "associated\n");
  
                /*
                 * destroy assoc_data afterwards, as otherwise an idle
@@@ -2630,6 -2647,8 +2644,8 @@@ static int ieee80211_probe_auth(struct 
                return -ETIMEDOUT;
        }
  
+       drv_mgd_prepare_tx(local, sdata);
        if (auth_data->bss->proberesp_ies) {
                sdata_info(sdata, "send auth to %pM (try %d/%d)\n",
                           auth_data->bss->bssid, auth_data->tries,