Skip to content

Commit

Permalink
cfg80211: fix wext stats
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Jul 24, 2009
1 parent ca3dbc2 commit c56c571
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions net/wireless/wext-compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1209,19 +1209,24 @@ struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
/* we are under RTNL - globally locked - so can use static structs */
static struct iw_statistics wstats;
static struct station_info sinfo;
u8 *addr;
u8 bssid[ETH_ALEN];

if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION)
return NULL;

if (!rdev->ops->get_station)
return NULL;

addr = wdev->wext.connect.bssid;
if (!addr)
/* Grab BSSID of current BSS, if any */
wdev_lock(wdev);
if (!wdev->current_bss) {
wdev_unlock(wdev);
return NULL;
}
memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
wdev_unlock(wdev);

if (rdev->ops->get_station(&rdev->wiphy, dev, addr, &sinfo))
if (rdev->ops->get_station(&rdev->wiphy, dev, bssid, &sinfo))
return NULL;

memset(&wstats, 0, sizeof(wstats));
Expand Down

0 comments on commit c56c571

Please sign in to comment.