cfg80211: check for current_bss from giwrate
authorSamuel Ortiz <samuel.ortiz@intel.com>
Fri, 3 Jul 2009 00:00:48 +0000 (02:00 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 10 Jul 2009 19:02:27 +0000 (15:02 -0400)
When connecting to an ESSID manually, we may not set the BSSID, and thus
wdev->wext.connect.bssid will be NULL.
wdev->current_bss is always updated when a connection is established so we
should check it first.

Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/wext-compat.c

index d39688ca7fe5113a815a17812bf85419daccdd2f..2c33cd83cfe987f52f88854a1aa240e799bd9344 100644 (file)
@@ -1136,8 +1136,11 @@ int cfg80211_wext_giwrate(struct net_device *dev,
        if (!rdev->ops->get_station)
                return -EOPNOTSUPP;
 
-       addr = wdev->wext.connect.bssid;
-       if (!addr)
+       if (wdev->current_bss)
+               addr = wdev->current_bss->pub.bssid;
+       else if (wdev->wext.connect.bssid)
+               addr = wdev->wext.connect.bssid;
+       else
                return -EOPNOTSUPP;
 
        err = rdev->ops->get_station(&rdev->wiphy, dev, addr, &sinfo);