]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - net/mac80211/mlme.c
cfg80211: assimilate and export ieee80211_bss_get_ie
[mv-sheeva.git] / net / mac80211 / mlme.c
index d779c57a82203b23194772565d4e6ba2ed172406..5748cda659c238d349919ec9416f784c7779139e 100644 (file)
@@ -46,26 +46,6 @@ static int ecw2cw(int ecw)
        return (1 << ecw) - 1;
 }
 
-static u8 *ieee80211_bss_get_ie(struct ieee80211_bss *bss, u8 ie)
-{
-       u8 *end, *pos;
-
-       pos = bss->cbss.information_elements;
-       if (pos == NULL)
-               return NULL;
-       end = pos + bss->cbss.len_information_elements;
-
-       while (pos + 1 < end) {
-               if (pos + 2 + pos[1] > end)
-                       break;
-               if (pos[0] == ie)
-                       return pos;
-               pos += 2 + pos[1];
-       }
-
-       return NULL;
-}
-
 static int ieee80211_compatible_rates(struct ieee80211_bss *bss,
                                      struct ieee80211_supported_band *sband,
                                      u32 *rates)
@@ -181,7 +161,8 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
        struct ieee80211_local *local = sdata->local;
        struct sk_buff *skb;
        struct ieee80211_mgmt *mgmt;
-       u8 *pos, *ies, *ht_ie;
+       u8 *pos;
+       const u8 *ies, *ht_ie;
        int i, len, count, rates_len, supp_rates_len;
        u16 capab;
        struct ieee80211_bss *bss;
@@ -345,9 +326,9 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
         */
        if (wmm && (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) &&
            sband->ht_cap.ht_supported &&
-           (ht_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_INFORMATION)) &&
+           (ht_ie = ieee80211_bss_get_ie(&bss->cbss, WLAN_EID_HT_INFORMATION)) &&
            ht_ie[1] >= sizeof(struct ieee80211_ht_info) &&
-           (!(ifmgd->flags & IEEE80211_STA_TKIP_WEP_USED))) {
+           (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N))) {
                struct ieee80211_ht_info *ht_info =
                        (struct ieee80211_ht_info *)(ht_ie + 2);
                u16 cap = sband->ht_cap.cap;
@@ -419,9 +400,11 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
        mgmt->u.deauth.reason_code = cpu_to_le16(reason);
 
        if (stype == IEEE80211_STYPE_DEAUTH)
-               cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, skb->len);
+               cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, skb->len,
+                                    GFP_KERNEL);
        else
-               cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, skb->len);
+               cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, skb->len,
+                                      GFP_KERNEL);
        ieee80211_tx_skb(sdata, skb, ifmgd->flags & IEEE80211_STA_MFP_ENABLED);
 }
 
@@ -868,70 +851,6 @@ static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
        return changed;
 }
 
-static void ieee80211_sta_send_apinfo(struct ieee80211_sub_if_data *sdata)
-{
-       union iwreq_data wrqu;
-
-       memset(&wrqu, 0, sizeof(wrqu));
-       if (sdata->u.mgd.flags & IEEE80211_STA_ASSOCIATED)
-               memcpy(wrqu.ap_addr.sa_data, sdata->u.mgd.bssid, ETH_ALEN);
-       wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-       wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL);
-}
-
-static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata)
-{
-       struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-       char *buf;
-       size_t len;
-       int i;
-       union iwreq_data wrqu;
-
-       if (!ifmgd->assocreq_ies && !ifmgd->assocresp_ies)
-               return;
-
-       buf = kmalloc(50 + 2 * (ifmgd->assocreq_ies_len +
-                               ifmgd->assocresp_ies_len), GFP_KERNEL);
-       if (!buf)
-               return;
-
-       len = sprintf(buf, "ASSOCINFO(");
-       if (ifmgd->assocreq_ies) {
-               len += sprintf(buf + len, "ReqIEs=");
-               for (i = 0; i < ifmgd->assocreq_ies_len; i++) {
-                       len += sprintf(buf + len, "%02x",
-                                      ifmgd->assocreq_ies[i]);
-               }
-       }
-       if (ifmgd->assocresp_ies) {
-               if (ifmgd->assocreq_ies)
-                       len += sprintf(buf + len, " ");
-               len += sprintf(buf + len, "RespIEs=");
-               for (i = 0; i < ifmgd->assocresp_ies_len; i++) {
-                       len += sprintf(buf + len, "%02x",
-                                      ifmgd->assocresp_ies[i]);
-               }
-       }
-       len += sprintf(buf + len, ")");
-
-       if (len > IW_CUSTOM_MAX) {
-               len = sprintf(buf, "ASSOCRESPIE=");
-               for (i = 0; i < ifmgd->assocresp_ies_len; i++) {
-                       len += sprintf(buf + len, "%02x",
-                                      ifmgd->assocresp_ies[i]);
-               }
-       }
-
-       if (len <= IW_CUSTOM_MAX) {
-               memset(&wrqu, 0, sizeof(wrqu));
-               wrqu.data.length = len;
-               wireless_send_event(sdata->dev, IWEVCUSTOM, &wrqu, buf);
-       }
-
-       kfree(buf);
-}
-
-
 static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
                                     u32 bss_info_changed)
 {
@@ -964,7 +883,6 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
 
        ifmgd->flags |= IEEE80211_STA_PREV_BSSID_SET;
        memcpy(ifmgd->prev_bssid, sdata->u.mgd.bssid, ETH_ALEN);
-       ieee80211_sta_send_associnfo(sdata);
 
        ifmgd->last_probe = jiffies;
        ieee80211_led_assoc(local, 1);
@@ -991,8 +909,6 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
 
        netif_tx_start_all_queues(sdata->dev);
        netif_carrier_on(sdata->dev);
-
-       ieee80211_sta_send_apinfo(sdata);
 }
 
 static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata)
@@ -1006,7 +922,8 @@ static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata)
                       sdata->dev->name, ifmgd->bssid);
                ifmgd->state = IEEE80211_STA_MLME_DISABLED;
                ieee80211_recalc_idle(local);
-               cfg80211_send_auth_timeout(sdata->dev, ifmgd->bssid);
+               cfg80211_send_auth_timeout(sdata->dev, ifmgd->bssid,
+                                          GFP_KERNEL);
 
                /*
                 * Most likely AP is not in the range so remove the
@@ -1045,8 +962,6 @@ static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata)
 {
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
        struct ieee80211_local *local = sdata->local;
-       u8 *ies;
-       size_t ies_len;
 
        ifmgd->auth_tries++;
        if (ifmgd->auth_tries > IEEE80211_AUTH_MAX_TRIES) {
@@ -1055,7 +970,8 @@ static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata)
                       sdata->dev->name, ifmgd->bssid);
                ifmgd->state = IEEE80211_STA_MLME_DISABLED;
                ieee80211_recalc_idle(local);
-               cfg80211_send_auth_timeout(sdata->dev, ifmgd->bssid);
+               cfg80211_send_auth_timeout(sdata->dev, ifmgd->bssid,
+                                          GFP_KERNEL);
                ieee80211_rx_bss_remove(sdata, ifmgd->bssid,
                                sdata->local->hw.conf.channel->center_freq,
                                ifmgd->ssid, ifmgd->ssid_len);
@@ -1073,15 +989,8 @@ static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata)
        printk(KERN_DEBUG "%s: authenticate with AP %pM\n",
               sdata->dev->name, ifmgd->bssid);
 
-       if (ifmgd->flags & IEEE80211_STA_EXT_SME) {
-               ies = ifmgd->sme_auth_ie;
-               ies_len = ifmgd->sme_auth_ie_len;
-       } else {
-               ies = NULL;
-               ies_len = 0;
-       }
-       ieee80211_send_auth(sdata, 1, ifmgd->auth_alg, ies, ies_len,
-                           ifmgd->bssid, 0);
+       ieee80211_send_auth(sdata, 1, ifmgd->auth_alg, ifmgd->sme_auth_ie,
+                           ifmgd->sme_auth_ie_len, ifmgd->bssid, 0);
        ifmgd->auth_transaction = 2;
 
        mod_timer(&ifmgd->timer, jiffies + IEEE80211_AUTH_TIMEOUT);
@@ -1102,14 +1011,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
        struct sta_info *sta;
        u32 changed = 0, config_changed = 0;
 
-       rcu_read_lock();
-
-       sta = sta_info_get(local, ifmgd->bssid);
-       if (!sta) {
-               rcu_read_unlock();
-               return;
-       }
-
        if (deauth) {
                ifmgd->direct_probe_tries = 0;
                ifmgd->auth_tries = 0;
@@ -1120,7 +1021,11 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
        netif_tx_stop_all_queues(sdata->dev);
        netif_carrier_off(sdata->dev);
 
-       ieee80211_sta_tear_down_BA_sessions(sta);
+       rcu_read_lock();
+       sta = sta_info_get(local, ifmgd->bssid);
+       if (sta)
+               ieee80211_sta_tear_down_BA_sessions(sta);
+       rcu_read_unlock();
 
        bss = ieee80211_rx_bss_get(local, ifmgd->bssid,
                                   conf->channel->center_freq,
@@ -1147,8 +1052,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
        changed |= BSS_CHANGED_ASSOC;
        sdata->vif.bss_conf.assoc = false;
 
-       ieee80211_sta_send_apinfo(sdata);
-
        if (self_disconnected || reason == WLAN_REASON_DISASSOC_STA_HAS_LEFT) {
                ifmgd->state = IEEE80211_STA_MLME_DISABLED;
                ieee80211_rx_bss_remove(sdata, ifmgd->bssid,
@@ -1156,8 +1059,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
                                ifmgd->ssid, ifmgd->ssid_len);
        }
 
-       rcu_read_unlock();
-
        ieee80211_set_wmm_default(sdata);
 
        ieee80211_recalc_idle(local);
@@ -1199,44 +1100,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
        sta_info_destroy(sta);
 }
 
-static int ieee80211_sta_wep_configured(struct ieee80211_sub_if_data *sdata)
-{
-       if (!sdata || !sdata->default_key ||
-           sdata->default_key->conf.alg != ALG_WEP)
-               return 0;
-       return 1;
-}
-
-static int ieee80211_privacy_mismatch(struct ieee80211_sub_if_data *sdata)
-{
-       struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-       struct ieee80211_local *local = sdata->local;
-       struct ieee80211_bss *bss;
-       int bss_privacy;
-       int wep_privacy;
-       int privacy_invoked;
-
-       if (!ifmgd || (ifmgd->flags & IEEE80211_STA_EXT_SME))
-               return 0;
-
-       bss = ieee80211_rx_bss_get(local, ifmgd->bssid,
-                                  local->hw.conf.channel->center_freq,
-                                  ifmgd->ssid, ifmgd->ssid_len);
-       if (!bss)
-               return 0;
-
-       bss_privacy = !!(bss->cbss.capability & WLAN_CAPABILITY_PRIVACY);
-       wep_privacy = !!ieee80211_sta_wep_configured(sdata);
-       privacy_invoked = !!(ifmgd->flags & IEEE80211_STA_PRIVACY_INVOKED);
-
-       ieee80211_rx_bss_put(local, bss);
-
-       if ((bss_privacy == wep_privacy) || (bss_privacy == privacy_invoked))
-               return 0;
-
-       return 1;
-}
-
 static void ieee80211_associate(struct ieee80211_sub_if_data *sdata)
 {
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
@@ -1249,7 +1112,8 @@ static void ieee80211_associate(struct ieee80211_sub_if_data *sdata)
                       sdata->dev->name, ifmgd->bssid);
                ifmgd->state = IEEE80211_STA_MLME_DISABLED;
                ieee80211_recalc_idle(local);
-               cfg80211_send_assoc_timeout(sdata->dev, ifmgd->bssid);
+               cfg80211_send_assoc_timeout(sdata->dev, ifmgd->bssid,
+                                           GFP_KERNEL);
                ieee80211_rx_bss_remove(sdata, ifmgd->bssid,
                                sdata->local->hw.conf.channel->center_freq,
                                ifmgd->ssid, ifmgd->ssid_len);
@@ -1265,14 +1129,6 @@ static void ieee80211_associate(struct ieee80211_sub_if_data *sdata)
        ifmgd->state = IEEE80211_STA_MLME_ASSOCIATE;
        printk(KERN_DEBUG "%s: associate with AP %pM\n",
               sdata->dev->name, ifmgd->bssid);
-       if (ieee80211_privacy_mismatch(sdata)) {
-               printk(KERN_DEBUG "%s: mismatch in privacy configuration and "
-                      "mixed-cell disabled - abort association\n", sdata->dev->name);
-               ifmgd->state = IEEE80211_STA_MLME_DISABLED;
-               ieee80211_recalc_idle(local);
-               return;
-       }
-
        ieee80211_send_assoc(sdata);
 
        mod_timer(&ifmgd->timer, jiffies + IEEE80211_ASSOC_TIMEOUT);
@@ -1430,12 +1286,9 @@ static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata)
 
        printk(KERN_DEBUG "%s: authenticated\n", sdata->dev->name);
        ifmgd->flags |= IEEE80211_STA_AUTHENTICATED;
-       if (ifmgd->flags & IEEE80211_STA_EXT_SME) {
-               /* Wait for SME to request association */
-               ifmgd->state = IEEE80211_STA_MLME_DISABLED;
-               ieee80211_recalc_idle(sdata->local);
-       } else
-               ieee80211_associate(sdata);
+       /* Wait for SME to request association */
+       ifmgd->state = IEEE80211_STA_MLME_DISABLED;
+       ieee80211_recalc_idle(sdata->local);
 }
 
 
@@ -1484,37 +1337,10 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
                return;
 
        if (status_code != WLAN_STATUS_SUCCESS) {
-               if (status_code == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) {
-                       u8 algs[3];
-                       const int num_algs = ARRAY_SIZE(algs);
-                       int i, pos;
-                       algs[0] = algs[1] = algs[2] = 0xff;
-                       if (ifmgd->auth_algs & IEEE80211_AUTH_ALG_OPEN)
-                               algs[0] = WLAN_AUTH_OPEN;
-                       if (ifmgd->auth_algs & IEEE80211_AUTH_ALG_SHARED_KEY)
-                               algs[1] = WLAN_AUTH_SHARED_KEY;
-                       if (ifmgd->auth_algs & IEEE80211_AUTH_ALG_LEAP)
-                               algs[2] = WLAN_AUTH_LEAP;
-                       if (ifmgd->auth_alg == WLAN_AUTH_OPEN)
-                               pos = 0;
-                       else if (ifmgd->auth_alg == WLAN_AUTH_SHARED_KEY)
-                               pos = 1;
-                       else
-                               pos = 2;
-                       for (i = 0; i < num_algs; i++) {
-                               pos++;
-                               if (pos >= num_algs)
-                                       pos = 0;
-                               if (algs[pos] == ifmgd->auth_alg ||
-                                   algs[pos] == 0xff)
-                                       continue;
-                               if (algs[pos] == WLAN_AUTH_SHARED_KEY &&
-                                   !ieee80211_sta_wep_configured(sdata))
-                                       continue;
-                               ifmgd->auth_alg = algs[pos];
-                               break;
-                       }
-               }
+               cfg80211_send_rx_auth(sdata->dev, (u8 *) mgmt, len,
+                                     GFP_KERNEL);
+               ifmgd->state = IEEE80211_STA_MLME_DISABLED;
+               ieee80211_recalc_idle(sdata->local);
                return;
        }
 
@@ -1523,12 +1349,14 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
        case WLAN_AUTH_LEAP:
        case WLAN_AUTH_FT:
                ieee80211_auth_completed(sdata);
-               cfg80211_send_rx_auth(sdata->dev, (u8 *) mgmt, len);
+               cfg80211_send_rx_auth(sdata->dev, (u8 *) mgmt, len,
+                                     GFP_KERNEL);
                break;
        case WLAN_AUTH_SHARED_KEY:
                if (ifmgd->auth_transaction == 4) {
                        ieee80211_auth_completed(sdata);
-                       cfg80211_send_rx_auth(sdata->dev, (u8 *) mgmt, len);
+                       cfg80211_send_rx_auth(sdata->dev, (u8 *) mgmt, len,
+                                             GFP_KERNEL);
                } else
                        ieee80211_auth_challenge(sdata, mgmt, len);
                break;
@@ -1555,18 +1383,9 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
                printk(KERN_DEBUG "%s: deauthenticated (Reason: %u)\n",
                                sdata->dev->name, reason_code);
 
-       if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) &&
-           (ifmgd->state == IEEE80211_STA_MLME_AUTHENTICATE ||
-            ifmgd->state == IEEE80211_STA_MLME_ASSOCIATE ||
-            ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED)) {
-               ifmgd->state = IEEE80211_STA_MLME_DIRECT_PROBE;
-               mod_timer(&ifmgd->timer, jiffies +
-                                     IEEE80211_RETRY_AUTH_INTERVAL);
-       }
-
        ieee80211_set_disassoc(sdata, true, false, 0);
        ifmgd->flags &= ~IEEE80211_STA_AUTHENTICATED;
-       cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, len);
+       cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, len, GFP_KERNEL);
 }
 
 
@@ -1589,15 +1408,8 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
                printk(KERN_DEBUG "%s: disassociated (Reason: %u)\n",
                                sdata->dev->name, reason_code);
 
-       if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) &&
-           ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED) {
-               ifmgd->state = IEEE80211_STA_MLME_ASSOCIATE;
-               mod_timer(&ifmgd->timer, jiffies +
-                                     IEEE80211_RETRY_AUTH_INTERVAL);
-       }
-
        ieee80211_set_disassoc(sdata, false, false, reason_code);
-       cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, len);
+       cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, len, GFP_KERNEL);
 }
 
 
@@ -1666,12 +1478,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
                 * association next time. This works around some broken APs
                 * which do not correctly reject reassociation requests. */
                ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
-               cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, len);
-               if (ifmgd->flags & IEEE80211_STA_EXT_SME) {
-                       /* Wait for SME to decide what to do next */
-                       ifmgd->state = IEEE80211_STA_MLME_DISABLED;
-                       ieee80211_recalc_idle(local);
-               }
+               cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, len,
+                                      GFP_KERNEL);
+               /* Wait for SME to decide what to do next */
+               ifmgd->state = IEEE80211_STA_MLME_DISABLED;
+               ieee80211_recalc_idle(local);
                return;
        }
 
@@ -1777,8 +1588,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
        else
                sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
 
-       /* If TKIP/WEP is used, no need to parse AP's HT capabilities */
-       if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_TKIP_WEP_USED))
+       if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_11N))
                ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
                                elems.ht_cap_elem, &sta->sta.ht_cap);
 
@@ -1812,7 +1622,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
 
        if (elems.ht_info_elem && elems.wmm_param &&
            (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) &&
-           !(ifmgd->flags & IEEE80211_STA_TKIP_WEP_USED))
+           !(ifmgd->flags & IEEE80211_STA_DISABLE_11N))
                changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem,
                                               ap_ht_cap_flags);
 
@@ -1829,7 +1639,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
        ifmgd->last_beacon = jiffies;
 
        ieee80211_associated(sdata);
-       cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, len);
+       cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, len, GFP_KERNEL);
 }
 
 
@@ -2025,7 +1835,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 
 
        if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param &&
-           !(ifmgd->flags & IEEE80211_STA_TKIP_WEP_USED)) {
+           !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) {
                struct sta_info *sta;
                struct ieee80211_supported_band *sband;
                u16 ap_ht_cap_flags;
@@ -2069,8 +1879,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 }
 
 ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata,
-                                         struct sk_buff *skb,
-                                         struct ieee80211_rx_status *rx_status)
+                                         struct sk_buff *skb)
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_mgmt *mgmt;
@@ -2086,7 +1895,6 @@ ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata,
        case IEEE80211_STYPE_PROBE_REQ:
        case IEEE80211_STYPE_PROBE_RESP:
        case IEEE80211_STYPE_BEACON:
-               memcpy(skb->cb, rx_status, sizeof(*rx_status));
        case IEEE80211_STYPE_AUTH:
        case IEEE80211_STYPE_ASSOC_RESP:
        case IEEE80211_STYPE_REASSOC_RESP:
@@ -2165,18 +1973,6 @@ static void ieee80211_sta_reset_auth(struct ieee80211_sub_if_data *sdata)
        drv_reset_tsf(local);
 
        ifmgd->wmm_last_param_set = -1; /* allow any WMM update */
-
-
-       if (ifmgd->auth_algs & IEEE80211_AUTH_ALG_OPEN)
-               ifmgd->auth_alg = WLAN_AUTH_OPEN;
-       else if (ifmgd->auth_algs & IEEE80211_AUTH_ALG_SHARED_KEY)
-               ifmgd->auth_alg = WLAN_AUTH_SHARED_KEY;
-       else if (ifmgd->auth_algs & IEEE80211_AUTH_ALG_LEAP)
-               ifmgd->auth_alg = WLAN_AUTH_LEAP;
-       else if (ifmgd->auth_algs & IEEE80211_AUTH_ALG_FT)
-               ifmgd->auth_alg = WLAN_AUTH_FT;
-       else
-               ifmgd->auth_alg = WLAN_AUTH_OPEN;
        ifmgd->auth_transaction = -1;
        ifmgd->flags &= ~IEEE80211_STA_ASSOCIATED;
        ifmgd->assoc_scan_tries = 0;
@@ -2198,36 +1994,15 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata)
        u16 capa_val = WLAN_CAPABILITY_ESS;
        struct ieee80211_channel *chan = local->oper_channel;
 
-       if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) &&
-           ifmgd->flags & (IEEE80211_STA_AUTO_SSID_SEL |
-                           IEEE80211_STA_AUTO_BSSID_SEL |
-                           IEEE80211_STA_AUTO_CHANNEL_SEL)) {
-               capa_mask |= WLAN_CAPABILITY_PRIVACY;
-               if (sdata->default_key)
-                       capa_val |= WLAN_CAPABILITY_PRIVACY;
-       }
-
-       if (ifmgd->flags & IEEE80211_STA_AUTO_CHANNEL_SEL)
-               chan = NULL;
-
-       if (ifmgd->flags & IEEE80211_STA_AUTO_BSSID_SEL)
-               bssid = NULL;
-
-       if (ifmgd->flags & IEEE80211_STA_AUTO_SSID_SEL) {
-               ssid = NULL;
-               ssid_len = 0;
-       }
-
        bss = (void *)cfg80211_get_bss(local->hw.wiphy, chan,
                                       bssid, ssid, ssid_len,
                                       capa_mask, capa_val);
 
        if (bss) {
-               ieee80211_set_freq(sdata, bss->cbss.channel->center_freq);
-               if (!(ifmgd->flags & IEEE80211_STA_SSID_SET))
-                       ieee80211_sta_set_ssid(sdata, bss->ssid,
-                                              bss->ssid_len);
-               ieee80211_sta_set_bssid(sdata, bss->cbss.bssid);
+               local->oper_channel = bss->cbss.channel;
+               local->oper_channel_type = NL80211_CHAN_NO_HT;
+               ieee80211_hw_config(local, 0);
+
                ieee80211_sta_def_wmm_params(sdata, bss->supp_rates_len,
                                                    bss->supp_rates);
                if (sdata->u.mgd.mfp == IEEE80211_MFP_REQUIRED)
@@ -2337,14 +2112,6 @@ static void ieee80211_sta_work(struct work_struct *work)
                WARN_ON(1);
                break;
        }
-
-       if (ieee80211_privacy_mismatch(sdata)) {
-               printk(KERN_DEBUG "%s: privacy configuration mismatch and "
-                      "mixed-cell disabled - disassociate\n", sdata->dev->name);
-
-               ieee80211_set_disassoc(sdata, false, true,
-                                       WLAN_REASON_UNSPECIFIED);
-       }
 }
 
 static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
@@ -2411,20 +2178,11 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
        skb_queue_head_init(&ifmgd->skb_queue);
 
        ifmgd->capab = WLAN_CAPABILITY_ESS;
-       ifmgd->auth_algs = IEEE80211_AUTH_ALG_OPEN |
-               IEEE80211_AUTH_ALG_SHARED_KEY;
-       ifmgd->flags |= IEEE80211_STA_CREATE_IBSS |
-               IEEE80211_STA_AUTO_BSSID_SEL |
-               IEEE80211_STA_AUTO_CHANNEL_SEL;
+       ifmgd->flags = 0;
        if (sdata->local->hw.queues >= 4)
                ifmgd->flags |= IEEE80211_STA_WMM_ENABLED;
 
        hw_flags = sdata->local->hw.flags;
-
-       if (hw_flags & IEEE80211_HW_SUPPORTS_PS) {
-               ifmgd->powersave = CONFIG_MAC80211_DEFAULT_PS_VALUE;
-               sdata->local->hw.conf.dynamic_ps_timeout = 500;
-       }
 }
 
 /* configuration hooks */
@@ -2436,79 +2194,20 @@ void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata)
        if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION))
                return;
 
-       if ((ifmgd->flags & (IEEE80211_STA_BSSID_SET |
-                            IEEE80211_STA_AUTO_BSSID_SEL)) &&
-           (ifmgd->flags & (IEEE80211_STA_SSID_SET |
-                            IEEE80211_STA_AUTO_SSID_SEL))) {
-
-               if (ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED)
-                       ieee80211_set_disassoc(sdata, true, true,
-                                              WLAN_REASON_DEAUTH_LEAVING);
-
-               if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) ||
-                   ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE)
-                       set_bit(IEEE80211_STA_REQ_AUTH, &ifmgd->request);
-               else if (ifmgd->flags & IEEE80211_STA_EXT_SME)
-                       set_bit(IEEE80211_STA_REQ_RUN, &ifmgd->request);
-               queue_work(local->hw.workqueue, &ifmgd->work);
-       }
-}
-
-int ieee80211_sta_commit(struct ieee80211_sub_if_data *sdata)
-{
-       struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-
-       if (ifmgd->ssid_len)
-               ifmgd->flags |= IEEE80211_STA_SSID_SET;
-       else
-               ifmgd->flags &= ~IEEE80211_STA_SSID_SET;
-
-       return 0;
-}
-
-int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len)
-{
-       struct ieee80211_if_managed *ifmgd;
-
-       if (len > IEEE80211_MAX_SSID_LEN)
-               return -EINVAL;
-
-       ifmgd = &sdata->u.mgd;
+       if (WARN_ON(ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED))
+               ieee80211_set_disassoc(sdata, true, true,
+                                      WLAN_REASON_DEAUTH_LEAVING);
 
-       if (ifmgd->ssid_len != len || memcmp(ifmgd->ssid, ssid, len) != 0) {
+       if (WARN_ON(ifmgd->ssid_len == 0)) {
                /*
-                * Do not use reassociation if SSID is changed (different ESS).
+                * Only allow association to be started if a valid SSID
+                * is configured.
                 */
-               ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
-               memset(ifmgd->ssid, 0, sizeof(ifmgd->ssid));
-               memcpy(ifmgd->ssid, ssid, len);
-               ifmgd->ssid_len = len;
-       }
-
-       return ieee80211_sta_commit(sdata);
-}
-
-int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len)
-{
-       struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-       memcpy(ssid, ifmgd->ssid, ifmgd->ssid_len);
-       *len = ifmgd->ssid_len;
-       return 0;
-}
-
-int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
-{
-       struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-
-       if (is_valid_ether_addr(bssid)) {
-               memcpy(ifmgd->bssid, bssid, ETH_ALEN);
-               ifmgd->flags |= IEEE80211_STA_BSSID_SET;
-       } else {
-               memset(ifmgd->bssid, 0, ETH_ALEN);
-               ifmgd->flags &= ~IEEE80211_STA_BSSID_SET;
+               return;
        }
 
-       return ieee80211_sta_commit(sdata);
+       set_bit(IEEE80211_STA_REQ_RUN, &ifmgd->request);
+       queue_work(local->hw.workqueue, &ifmgd->work);
 }
 
 int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata,