rt2x00: claim RSN IBSS support
authorStanislaw Gruszka <sgruszka@redhat.com>
Mon, 28 May 2012 09:53:11 +0000 (11:53 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 6 Jun 2012 19:18:18 +0000 (15:18 -0400)
Similar like other drivers, do not configure group keys to the hardware
(on Ad-Hoc mode) to make IBSS RSN work.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00mac.c

index e5404e5..a6b88bd 100644 (file)
@@ -1161,6 +1161,8 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
                    BIT(NL80211_IFTYPE_MESH_POINT) |
                    BIT(NL80211_IFTYPE_WDS);
 
+       rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
+
        /*
         * Initialize work.
         */
index dd24b26..4ff26c2 100644 (file)
@@ -506,9 +506,19 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
        if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
                return 0;
-       else if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags))
+
+       if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags))
+               return -EOPNOTSUPP;
+
+       /*
+        * To support IBSS RSN, don't program group keys in IBSS, the
+        * hardware will then not attempt to decrypt the frames.
+        */
+       if (vif->type == NL80211_IFTYPE_ADHOC &&
+           !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
                return -EOPNOTSUPP;
-       else if (key->keylen > 32)
+
+       if (key->keylen > 32)
                return -ENOSPC;
 
        memset(&crypto, 0, sizeof(crypto));