Skip to contentSkip to conversation

How to enable Monitor mode?

ath9k-devel hwang 3 participants 4 messages Dec 19, 2008 – Dec 22, 2008 mac80211

lore
Share & tools
lore
#1 lore raw

Quoting hwang <[email protected]>:

Quoted 4 lines

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 [email protected] to [email protected], 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:

net/mac80211/iface.c +0 -0
index 5abbc3f..b907482 100644
@@ -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.

Signature · 2 lines
Regards,
Pavel Roskin
maintainer
#2 lore raw
Quoted 41 lines · Pavel Roskin

Quoting hwang <[email protected]>:

Quoted 4 lines

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 [email protected] to [email protected], 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:

net/mac80211/iface.c +2 -1
index 5abbc3f..b907482 100644
@@ -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;
 

/*

Quoted 4 lines

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

#3 lore raw
Quoted 2 lines · Johannes Berg

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

Signature · 2 lines
Regards,
Pavel Roskin