Skip to contentSkip to conversation

mac80211 : Fixes the status message for iwconfig

PATCH In review Abhijeet Kolekar 2 participants 4 messages May 23, 2008 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211 : Fixes the status message for iwconfig

iwconfig was showing incorrect status messages when disassociated. Patch fixes this by always checking for association status in ioctl calls for getting ap address.

---
 net/mac80211/wext.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
net/mac80211/wext.c +8 -3
index c2e2378..1a35562 100644
@@ -501,9 +501,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);
Signature · 1 line
1.5.2.5
#1 lore raw
Quoted 5 lines · Abhijeet Kolekar

iwconfig was showing incorrect status messages when disassociated. Patch fixes this by always checking for association status in ioctl calls for getting ap address.

I may not remember correctly, but I think you need to also report the BSSID being associated with during assoc & auth stages with WEXT. So the right check here is to return nothing if _disassocated_, but otherwise return the BSSID that's currently pending or associated with.

Dan

Quoted 26 lines
---
 net/mac80211/wext.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
net/mac80211/wext.c +8 -3
index c2e2378..1a35562 100644
@@ -501,9 +501,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);
#2 lore raw
Quoted 5 lines · Dan Williams
Quoted 4 lines · Abhijeet Kolekar

iwconfig was showing incorrect status messages when disassociated. Patch fixes this by always checking for association status in ioctl calls for getting ap address.

Quoted 8 lines
Quoted 1 line

I may not remember correctly, but I think you need to also report the BSSID being associated with during assoc & auth stages with WEXT. So the right check here is to return nothing if _disassocated_, but otherwise return the BSSID that's currently pending or associated with.

Dan

One question though, Do we need to report similar things with essid or WEXT will always return the essid regardless of the state.

Quoted 28 lines
Quoted 27 lines
---
 net/mac80211/wext.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
net/mac80211/wext.c +8 -3
index c2e2378..1a35562 100644
@@ -501,9 +501,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);
Acked-by
#3 lore raw
Quoted 8 lines · Abhijeet Kolekar
Quoted 7 lines · Dan Williams
Quoted 5 lines · Abhijeet Kolekar

iwconfig was showing incorrect status messages when disassociated. Patch fixes this by always checking for association status in ioctl calls for getting ap address.

Quoted 8 lines
Quoted 6 lines

I may not remember correctly, but I think you need to also report the BSSID being associated with during assoc & auth stages with WEXT. So the right check here is to return nothing if _disassocated_, but otherwise return the BSSID that's currently pending or associated with.

Dan

One question though, Do we need to report similar things with essid or WEXT will always return the essid regardless of the state.

I lied; ignore me. Patch is good.

Quoted 32 lines
Quoted 19 lines
Quoted 19 lines
---
 net/mac80211/wext.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
net/mac80211/wext.c +3 -3
index c2e2378..1a35562 100644
@@ -501,9 +501,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);
Quoted 9 lines

net/mac80211/wext.c static int ieee80211_ioctl_giwap(struct net_device *dev, · line 514

Quoted 8 lines
net/mac80211/wext.c +5 -0
+			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);

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html