linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211 : Fixes the status message for iwconfig
@ 2008-05-23 17:15 Abhijeet Kolekar
  2008-05-23 17:39 ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Abhijeet Kolekar @ 2008-05-23 17:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: 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.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
---
 net/mac80211/wext.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index c2e2378..1a35562 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -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);
-- 
1.5.2.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mac80211 : Fixes the status message for iwconfig
  2008-05-23 17:15 [PATCH] mac80211 : Fixes the status message for iwconfig Abhijeet Kolekar
@ 2008-05-23 17:39 ` Dan Williams
  2008-05-23 17:44   ` Abhijeet Kolekar
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2008-05-23 17:39 UTC (permalink / raw)
  To: Abhijeet Kolekar; +Cc: linux-wireless

On Fri, 2008-05-23 at 10:15 -0700, Abhijeet Kolekar wrote:
> 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>

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

> ---
>  net/mac80211/wext.c |   11 ++++++++---
>  1 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
> index c2e2378..1a35562 100644
> --- a/net/mac80211/wext.c
> +++ b/net/mac80211/wext.c
> @@ -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);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mac80211 : Fixes the status message for iwconfig
  2008-05-23 17:39 ` Dan Williams
@ 2008-05-23 17:44   ` Abhijeet Kolekar
  2008-05-23 18:11     ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Abhijeet Kolekar @ 2008-05-23 17:44 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-wireless

On Fri, 2008-23-05 at 13:39 -0400, Dan Williams wrote:
> On Fri, 2008-05-23 at 10:15 -0700, Abhijeet Kolekar wrote:
> > 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>
> 
> 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.
> 
> > ---
> >  net/mac80211/wext.c |   11 ++++++++---
> >  1 files changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
> > index c2e2378..1a35562 100644
> > --- a/net/mac80211/wext.c
> > +++ b/net/mac80211/wext.c
> > @@ -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);
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mac80211 : Fixes the status message for iwconfig
  2008-05-23 17:44   ` Abhijeet Kolekar
@ 2008-05-23 18:11     ` Dan Williams
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Williams @ 2008-05-23 18:11 UTC (permalink / raw)
  To: abhijeet.kolekar; +Cc: linux-wireless

On Fri, 2008-05-23 at 10:44 -0700, Abhijeet Kolekar wrote:
> On Fri, 2008-23-05 at 13:39 -0400, Dan Williams wrote:
> > On Fri, 2008-05-23 at 10:15 -0700, Abhijeet Kolekar wrote:
> > > 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>
> > 
> > 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.

Acked-by: Dan Williams <dcbw@redhat.com>

> > 
> > > ---
> > >  net/mac80211/wext.c |   11 ++++++++---
> > >  1 files changed, 8 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
> > > index c2e2378..1a35562 100644
> > > --- a/net/mac80211/wext.c
> > > +++ b/net/mac80211/wext.c
> > > @@ -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);
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-23 18:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-23 17:15 [PATCH] mac80211 : Fixes the status message for iwconfig Abhijeet Kolekar
2008-05-23 17:39 ` Dan Williams
2008-05-23 17:44   ` Abhijeet Kolekar
2008-05-23 18:11     ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).