mac80211 : Fixes the status message for iwconfig
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>
Fri, 23 May 2008 17:15:26 +0000 (10:15 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 28 May 2008 20:43:46 +0000 (16:43 -0400)
iwconfig was showing incorrect status messages when disassociated.
Patch fixes this by always checking for association status in
ioctl calls for getting ap address.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/wext.c

index 457ebf9e85ae6dcfd9bf40313a888c882feebee5..8311bb24f9f34adf35c08db9937c648097f2980a 100644 (file)
@@ -489,9 +489,14 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
            sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
-               ap_addr->sa_family = ARPHRD_ETHER;
-               memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
-               return 0;
+               if (sdata->u.sta.state == IEEE80211_ASSOCIATED) {
+                       ap_addr->sa_family = ARPHRD_ETHER;
+                       memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
+                       return 0;
+               } else {
+                       memset(&ap_addr->sa_data, 0, ETH_ALEN);
+                       return 0;
+               }
        } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) {
                ap_addr->sa_family = ARPHRD_ETHER;
                memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);