How to enable Monitor mode?
Hi all,
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.
Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20081218/72a6df2e/attachment.htm
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
@@ -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
Johannes Berg
maintainerQuoted 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@@ -699,7 +699,8 @@ int ieee80211_if_change_type(structieee80211_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_IBSSmeans 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
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