linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [ath9k-devel] How to enable Monitor mode?
       [not found] <690453.5943.qm@web80505.mail.mud.yahoo.com>
@ 2008-12-22 17:16 ` Pavel Roskin
  2008-12-22 17:18   ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Roskin @ 2008-12-22 17:16 UTC (permalink / raw)
  To: yyhymmh; +Cc: linux-wireless

Quoting hwang <yyhymmh@yahoo.com>:

> I am first time use ath9k driver. I like to change the card to   
> Monitor mode. Can anyone tell which command does it?
>
> I tried to use iwconfig, but failed.

Moving discussion from ath9k-devel@lists.ath9k.org to  
linux-wireless@vger.kernel.org, as it's a common problem for all  
mac80211 based drivers.

Following code in net/mac80211/iface.c, ieee80211_if_change_type()  
prevents setting monitor mode:

         /* Setting ad-hoc mode on non-IBSS channel is not supported. */
         if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS)
                 return -EOPNOTSUPP;

The effect of the code exceeds the effect described by the comment, so  
something must be wrong.  I'm not running crda, so I guess I'm in the  
"world" domain that doesn't prermit IBSS.  But it should not disable  
monitor mode.

A simple fix would be:

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 5abbc3f..b907482 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -699,7 +699,8 @@ int ieee80211_if_change_type(struct  
ieee80211_sub_if_data *sdata,
  		return 0;

  	/* Setting ad-hoc mode on non-IBSS channel is not supported. */
-	if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS)
+	if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS &&
+	    type == NL80211_IFTYPE_ADHOC)
  		return -EOPNOTSUPP;

  	/*

I've tested it, and it actually enables monitor mode.  I remember Luis  
mentioning that IEEE80211_CHAN_NO_IBSS means no beacons, so maybe  
other modes need to be disabled (AP, maybe mesh), but there are no  
beacons sent in the monitor mode.

-- 
Regards,
Pavel Roskin

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

* Re: [ath9k-devel] How to enable Monitor mode?
  2008-12-22 17:16 ` [ath9k-devel] How to enable Monitor mode? Pavel Roskin
@ 2008-12-22 17:18   ` Johannes Berg
  2008-12-22 21:41     ` Pavel Roskin
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2008-12-22 17:18 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: yyhymmh, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1985 bytes --]

On Mon, 2008-12-22 at 12:16 -0500, Pavel Roskin wrote:
> Quoting hwang <yyhymmh@yahoo.com>:
> 
> > I am first time use ath9k driver. I like to change the card to   
> > Monitor mode. Can anyone tell which command does it?
> >
> > I tried to use iwconfig, but failed.
> 
> Moving discussion from ath9k-devel@lists.ath9k.org to  
> linux-wireless@vger.kernel.org, as it's a common problem for all  
> mac80211 based drivers.
> 
> Following code in net/mac80211/iface.c, ieee80211_if_change_type()  
> prevents setting monitor mode:
> 
>          /* Setting ad-hoc mode on non-IBSS channel is not supported. */
>          if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS)
>                  return -EOPNOTSUPP;
> 
> The effect of the code exceeds the effect described by the comment, so  
> something must be wrong.  I'm not running crda, so I guess I'm in the  
> "world" domain that doesn't prermit IBSS.  But it should not disable  
> monitor mode.
> 
> A simple fix would be:
> 
> diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
> index 5abbc3f..b907482 100644
> --- a/net/mac80211/iface.c
> +++ b/net/mac80211/iface.c
> @@ -699,7 +699,8 @@ int ieee80211_if_change_type(struct  
> ieee80211_sub_if_data *sdata,
>   		return 0;
> 
>   	/* Setting ad-hoc mode on non-IBSS channel is not supported. */
> -	if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS)
> +	if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS &&
> +	    type == NL80211_IFTYPE_ADHOC)
>   		return -EOPNOTSUPP;
> 
>   	/*
> 
> I've tested it, and it actually enables monitor mode.  I remember Luis  
> mentioning that IEEE80211_CHAN_NO_IBSS means no beacons, so maybe  
> other modes need to be disabled (AP, maybe mesh), but there are no  
> beacons sent in the monitor mode.

I haven't gotten around, but that patch is correct. That's how it was
before I moved that code, when I accidentally lost the check.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [ath9k-devel] How to enable Monitor mode?
  2008-12-22 17:18   ` Johannes Berg
@ 2008-12-22 21:41     ` Pavel Roskin
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Roskin @ 2008-12-22 21:41 UTC (permalink / raw)
  To: Johannes Berg; +Cc: yyhymmh, linux-wireless

On Mon, 2008-12-22 at 18:18 +0100, Johannes Berg wrote:

> I haven't gotten around, but that patch is correct. That's how it was
> before I moved that code, when I accidentally lost the check.

Indeed.  I've sent the patch "officially".

-- 
Regards,
Pavel Roskin

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

end of thread, other threads:[~2008-12-22 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <690453.5943.qm@web80505.mail.mud.yahoo.com>
2008-12-22 17:16 ` [ath9k-devel] How to enable Monitor mode? Pavel Roskin
2008-12-22 17:18   ` Johannes Berg
2008-12-22 21:41     ` Pavel Roskin

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).