aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/wext-compat.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-10 10:54:07 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:11 -0400
commitc56c5714f12808e3f702817e72a78dd12f1704eb (patch)
tree0dc886563fa77128535d4c8db90779ae01f2a15a /net/wireless/wext-compat.c
parentca3dbc20d47ae43c201c215259d078e227bfcf01 (diff)
cfg80211: fix wext stats
Instead of using the wext BSSID which may be NULL if you haven't explicitly set one, we should instead use the current_bss pointer -- if that's NULL we aren't connected anyway. Fixes missing signal quality output reported to me internally at Intel. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/wext-compat.c')
-rw-r--r--net/wireless/wext-compat.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 5d0176338539..aa80c0c4efd4 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -1209,7 +1209,7 @@ struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
1209 /* we are under RTNL - globally locked - so can use static structs */ 1209 /* we are under RTNL - globally locked - so can use static structs */
1210 static struct iw_statistics wstats; 1210 static struct iw_statistics wstats;
1211 static struct station_info sinfo; 1211 static struct station_info sinfo;
1212 u8 *addr; 1212 u8 bssid[ETH_ALEN];
1213 1213
1214 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) 1214 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION)
1215 return NULL; 1215 return NULL;
@@ -1217,11 +1217,16 @@ struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
1217 if (!rdev->ops->get_station) 1217 if (!rdev->ops->get_station)
1218 return NULL; 1218 return NULL;
1219 1219
1220 addr = wdev->wext.connect.bssid; 1220 /* Grab BSSID of current BSS, if any */
1221 if (!addr) 1221 wdev_lock(wdev);
1222 if (!wdev->current_bss) {
1223 wdev_unlock(wdev);
1222 return NULL; 1224 return NULL;
1225 }
1226 memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
1227 wdev_unlock(wdev);
1223 1228
1224 if (rdev->ops->get_station(&rdev->wiphy, dev, addr, &sinfo)) 1229 if (rdev->ops->get_station(&rdev->wiphy, dev, bssid, &sinfo))
1225 return NULL; 1230 return NULL;
1226 1231
1227 memset(&wstats, 0, sizeof(wstats)); 1232 memset(&wstats, 0, sizeof(wstats));