cfg80211: always set IBSS basic rates
authorJohannes Berg <johannes.berg@intel.com>
Tue, 28 Sep 2010 10:53:14 +0000 (12:53 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 28 Sep 2010 19:47:58 +0000 (15:47 -0400)
IBSS started from wireless extensions is currently
missing basic rate configuration, fix this by moving
the code to generate the default to the common code
that gets invoked for both nl80211 and wext.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/ibss.c
net/wireless/nl80211.c

index 27a8ce9343c3e6d7a3bfdd6f801a7e852504a9c3..8cb6e08373b989b7cb880315afff64221d33810f 100644 (file)
@@ -88,6 +88,25 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
        if (wdev->ssid_len)
                return -EALREADY;
 
+       if (!params->basic_rates) {
+               /*
+               * If no rates were explicitly configured,
+               * use the mandatory rate set for 11b or
+               * 11a for maximum compatibility.
+               */
+               struct ieee80211_supported_band *sband =
+                       rdev->wiphy.bands[params->channel->band];
+               int j;
+               u32 flag = params->channel->band == IEEE80211_BAND_5GHZ ?
+                       IEEE80211_RATE_MANDATORY_A :
+                       IEEE80211_RATE_MANDATORY_B;
+
+               for (j = 0; j < sband->n_bitrates; j++) {
+                       if (sband->bitrates[j].flags & flag)
+                               params->basic_rates |= BIT(j);
+               }
+       }
+
        if (WARN_ON(wdev->connect_keys))
                kfree(wdev->connect_keys);
        wdev->connect_keys = connkeys;
index 4ff827e8c362c51d8d2927b7160f5b0b741f27ac..9c84825803ceb13de075a1e763e0c72fd4217b66 100644 (file)
@@ -4119,23 +4119,6 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
                                goto out;
                        }
                }
-       } else {
-               /*
-               * If no rates were explicitly configured,
-               * use the mandatory rate set for 11b or
-               * 11a for maximum compatibility.
-               */
-               struct ieee80211_supported_band *sband =
-                       wiphy->bands[ibss.channel->band];
-               int j;
-               u32 flag = ibss.channel->band == IEEE80211_BAND_5GHZ ?
-                       IEEE80211_RATE_MANDATORY_A :
-                       IEEE80211_RATE_MANDATORY_B;
-
-               for (j = 0; j < sband->n_bitrates; j++) {
-                       if (sband->bitrates[j].flags & flag)
-                               ibss.basic_rates |= BIT(j);
-               }
        }
 
        err = cfg80211_join_ibss(rdev, dev, &ibss, connkeys);