cfg80211: remove enum ieee80211_band
[cascardo/linux.git] / net / wireless / sme.c
index 5445581..e22e5b8 100644 (file)
@@ -81,7 +81,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
                return -ENOMEM;
 
        if (wdev->conn->params.channel) {
-               enum ieee80211_band band = wdev->conn->params.channel->band;
+               enum nl80211_band band = wdev->conn->params.channel->band;
                struct ieee80211_supported_band *sband =
                        wdev->wiphy->bands[band];
 
@@ -93,11 +93,11 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
                request->rates[band] = (1 << sband->n_bitrates) - 1;
        } else {
                int i = 0, j;
-               enum ieee80211_band band;
+               enum nl80211_band band;
                struct ieee80211_supported_band *bands;
                struct ieee80211_channel *channel;
 
-               for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               for (band = 0; band < NUM_NL80211_BANDS; band++) {
                        bands = wdev->wiphy->bands[band];
                        if (!bands)
                                continue;
@@ -119,6 +119,8 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
                wdev->conn->params.ssid_len);
        request->ssids[0].ssid_len = wdev->conn->params.ssid_len;
 
+       eth_broadcast_addr(request->bssid);
+
        request->wdev = wdev;
        request->wiphy = &rdev->wiphy;
        request->scan_start = jiffies;
@@ -490,8 +492,18 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev,
        if (!rdev->ops->auth || !rdev->ops->assoc)
                return -EOPNOTSUPP;
 
-       if (wdev->current_bss)
-               return -EALREADY;
+       if (wdev->current_bss) {
+               if (!prev_bssid)
+                       return -EALREADY;
+               if (prev_bssid &&
+                   !ether_addr_equal(prev_bssid, wdev->current_bss->pub.bssid))
+                       return -ENOTCONN;
+               cfg80211_unhold_bss(wdev->current_bss);
+               cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub);
+               wdev->current_bss = NULL;
+
+               cfg80211_sme_free(wdev);
+       }
 
        if (WARN_ON(wdev->conn))
                return -EINPROGRESS;