]> Pileus Git - ~andy/linux/blobdiff - net/wireless/mlme.c
Merge tag 'firmware-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[~andy/linux] / net / wireless / mlme.c
index 5a97ce6d283b75d191ee1c220e965b6981f1dd27..0c7b7dd855f650f6bb9f6ba4e8ecbc479e8637d1 100644 (file)
@@ -343,27 +343,38 @@ void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
                p1[i] &= p2[i];
 }
 
+/*  Do a logical ht_capa &= ht_capa_mask.  */
+void cfg80211_oper_and_vht_capa(struct ieee80211_vht_cap *vht_capa,
+                               const struct ieee80211_vht_cap *vht_capa_mask)
+{
+       int i;
+       u8 *p1, *p2;
+       if (!vht_capa_mask) {
+               memset(vht_capa, 0, sizeof(*vht_capa));
+               return;
+       }
+
+       p1 = (u8*)(vht_capa);
+       p2 = (u8*)(vht_capa_mask);
+       for (i = 0; i < sizeof(*vht_capa); i++)
+               p1[i] &= p2[i];
+}
+
 int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
                          struct net_device *dev,
                          struct ieee80211_channel *chan,
-                         const u8 *bssid, const u8 *prev_bssid,
+                         const u8 *bssid,
                          const u8 *ssid, int ssid_len,
-                         const u8 *ie, int ie_len, bool use_mfp,
-                         struct cfg80211_crypto_settings *crypt,
-                         u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
-                         struct ieee80211_ht_cap *ht_capa_mask)
+                         struct cfg80211_assoc_request *req)
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
-       struct cfg80211_assoc_request req;
        int err;
        bool was_connected = false;
 
        ASSERT_WDEV_LOCK(wdev);
 
-       memset(&req, 0, sizeof(req));
-
-       if (wdev->current_bss && prev_bssid &&
-           ether_addr_equal(wdev->current_bss->pub.bssid, prev_bssid)) {
+       if (wdev->current_bss && req->prev_bssid &&
+           ether_addr_equal(wdev->current_bss->pub.bssid, req->prev_bssid)) {
                /*
                 * Trying to reassociate: Allow this to proceed and let the old
                 * association to be dropped when the new one is completed.
@@ -375,40 +386,30 @@ int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
        } else if (wdev->current_bss)
                return -EALREADY;
 
-       req.ie = ie;
-       req.ie_len = ie_len;
-       memcpy(&req.crypto, crypt, sizeof(req.crypto));
-       req.use_mfp = use_mfp;
-       req.prev_bssid = prev_bssid;
-       req.flags = assoc_flags;
-       if (ht_capa)
-               memcpy(&req.ht_capa, ht_capa, sizeof(req.ht_capa));
-       if (ht_capa_mask)
-               memcpy(&req.ht_capa_mask, ht_capa_mask,
-                      sizeof(req.ht_capa_mask));
-       cfg80211_oper_and_ht_capa(&req.ht_capa_mask,
+       cfg80211_oper_and_ht_capa(&req->ht_capa_mask,
                                  rdev->wiphy.ht_capa_mod_mask);
+       cfg80211_oper_and_vht_capa(&req->vht_capa_mask,
+                                  rdev->wiphy.vht_capa_mod_mask);
 
-       req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
-                                  WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
-       if (!req.bss) {
+       req->bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
+                                   WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
+       if (!req->bss) {
                if (was_connected)
                        wdev->sme_state = CFG80211_SME_CONNECTED;
                return -ENOENT;
        }
 
-       err = cfg80211_can_use_chan(rdev, wdev, req.bss->channel,
-                                   CHAN_MODE_SHARED);
+       err = cfg80211_can_use_chan(rdev, wdev, chan, CHAN_MODE_SHARED);
        if (err)
                goto out;
 
-       err = rdev_assoc(rdev, dev, &req);
+       err = rdev_assoc(rdev, dev, req);
 
 out:
        if (err) {
                if (was_connected)
                        wdev->sme_state = CFG80211_SME_CONNECTED;
-               cfg80211_put_bss(&rdev->wiphy, req.bss);
+               cfg80211_put_bss(&rdev->wiphy, req->bss);
        }
 
        return err;
@@ -417,21 +418,17 @@ out:
 int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
                        struct net_device *dev,
                        struct ieee80211_channel *chan,
-                       const u8 *bssid, const u8 *prev_bssid,
+                       const u8 *bssid,
                        const u8 *ssid, int ssid_len,
-                       const u8 *ie, int ie_len, bool use_mfp,
-                       struct cfg80211_crypto_settings *crypt,
-                       u32 assoc_flags, struct ieee80211_ht_cap *ht_capa,
-                       struct ieee80211_ht_cap *ht_capa_mask)
+                       struct cfg80211_assoc_request *req)
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
        int err;
 
        mutex_lock(&rdev->devlist_mtx);
        wdev_lock(wdev);
-       err = __cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid,
-                                   ssid, ssid_len, ie, ie_len, use_mfp, crypt,
-                                   assoc_flags, ht_capa, ht_capa_mask);
+       err = __cfg80211_mlme_assoc(rdev, dev, chan, bssid,
+                                   ssid, ssid_len, req);
        wdev_unlock(wdev);
        mutex_unlock(&rdev->devlist_mtx);
 
@@ -651,6 +648,11 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid)
 
        spin_unlock_bh(&wdev->mgmt_registrations_lock);
 
+       if (nlportid && rdev->crit_proto_nlportid == nlportid) {
+               rdev->crit_proto_nlportid = 0;
+               rdev_crit_proto_stop(rdev, wdev);
+       }
+
        if (nlportid == wdev->ap_unexpected_nlportid)
                wdev->ap_unexpected_nlportid = 0;
 }