2012-11-02 18:46:34

by George Nychis

[permalink] [raw]
Subject: bug in compat-wireless 3.6, rt2x00 iftype is wrong

I'm still trying to track down the cause for this, but starting in
compat-wireless-3.6 (including early RCs and the most recent 3.6.2),
rt2x00 devices register with the wrong iftype. They register as
NL80211_IFTYPE_MONITOR instead of NL80211_IFTYPE_STATION, for example.
I checked cw-3.5, 3.4, 3.2, and 3.1 and none of these versions have
this bug.

This breaks the ability to set channels, etc. Hoping to track down
the bug, but wanted to report it in the meantime and see if anyone
else has run in to it.

- George


2012-11-02 19:57:03

by George Nychis

[permalink] [raw]
Subject: Re: bug in compat-wireless 3.6, rt2x00 iftype is wrong

The issue seems to be that in all of these drivers, wdev is NULL when
you hit set_channel() in the older and newer driver. In the old
driver, cfg8011_set_freq() is called with wdev has NULL and it still
calls rdev->ops->set_channel(....) which succeeds.

However, in the new driver cfg80211_set_monitor_channel() is called
since wdev was NULL, but now instead of still calling
rdev->ops->set_channel() or rdev->ops->set_monitor_channel() it
returns -EBUSY because if(!cfg80211_has_monitors_only(rdev)) returns
true. Is this really the expected behavior, or is meant to only
return -EBUSY if there are only monitors, rather? (i.e.,
if(cfg80211_has_monitors_only(rdev)) )


On Fri, Nov 2, 2012 at 2:46 PM, George Nychis <[email protected]> wrote:
> I'm still trying to track down the cause for this, but starting in
> compat-wireless-3.6 (including early RCs and the most recent 3.6.2),
> rt2x00 devices register with the wrong iftype. They register as
> NL80211_IFTYPE_MONITOR instead of NL80211_IFTYPE_STATION, for example.
> I checked cw-3.5, 3.4, 3.2, and 3.1 and none of these versions have
> this bug.
>
> This breaks the ability to set channels, etc. Hoping to track down
> the bug, but wanted to report it in the meantime and see if anyone
> else has run in to it.
>
> - George

2012-11-03 22:09:07

by George Nychis

[permalink] [raw]
Subject: Re: bug in compat-wireless 3.6, rt2x00 iftype is wrong

Fair enough, this is just behavior that was newly enforced without
comments that I could find. For the several years that I've been
working with compat-wireless, I've been able to change the channel of
an unassociated Managed interface with a coupled monitoring interface
using iwconfig or iw on either. Then, that behavior broke. I see the
logic behind the behavior.

On Sat, Nov 3, 2012 at 7:14 AM, Johannes Berg <[email protected]> wrote:
> On Fri, 2012-11-02 at 15:57 -0400, George Nychis wrote:
>> The issue seems to be that in all of these drivers, wdev is NULL when
>> you hit set_channel() in the older and newer driver. In the old
>> driver, cfg8011_set_freq() is called with wdev has NULL and it still
>> calls rdev->ops->set_channel(....) which succeeds.
>>
>> However, in the new driver cfg80211_set_monitor_channel() is called
>> since wdev was NULL, but now instead of still calling
>> rdev->ops->set_channel() or rdev->ops->set_monitor_channel() it
>> returns -EBUSY because if(!cfg80211_has_monitors_only(rdev)) returns
>> true. Is this really the expected behavior, or is meant to only
>> return -EBUSY if there are only monitors, rather? (i.e.,
>> if(cfg80211_has_monitors_only(rdev)) )
>
> No, this is the correct behaviour, if you have non-monitor interfaces
> you can't set the channel since the channel setting would be done with
> other actions, e.g. associating a managed mode interface.
>
> I don't really understand your original complaint though, the iftype you
> set will be the one the interface is in ...
>
> johannes
>

2012-11-02 19:59:03

by George Nychis

[permalink] [raw]
Subject: Re: bug in compat-wireless 3.6, rt2x00 iftype is wrong

in the compat-wireless-3.6.-rc7-1 source code, I'm talking about line
88 in net/wireless/chan.c which returns -EBUSY. Note that I have a
single interface which is in station mode, not monitoring mode. There
is no interface in true monitoring mode.

On Fri, Nov 2, 2012 at 3:57 PM, George Nychis <[email protected]> wrote:
> The issue seems to be that in all of these drivers, wdev is NULL when
> you hit set_channel() in the older and newer driver. In the old
> driver, cfg8011_set_freq() is called with wdev has NULL and it still
> calls rdev->ops->set_channel(....) which succeeds.
>
> However, in the new driver cfg80211_set_monitor_channel() is called
> since wdev was NULL, but now instead of still calling
> rdev->ops->set_channel() or rdev->ops->set_monitor_channel() it
> returns -EBUSY because if(!cfg80211_has_monitors_only(rdev)) returns
> true. Is this really the expected behavior, or is meant to only
> return -EBUSY if there are only monitors, rather? (i.e.,
> if(cfg80211_has_monitors_only(rdev)) )
>
>
> On Fri, Nov 2, 2012 at 2:46 PM, George Nychis <[email protected]> wrote:
>> I'm still trying to track down the cause for this, but starting in
>> compat-wireless-3.6 (including early RCs and the most recent 3.6.2),
>> rt2x00 devices register with the wrong iftype. They register as
>> NL80211_IFTYPE_MONITOR instead of NL80211_IFTYPE_STATION, for example.
>> I checked cw-3.5, 3.4, 3.2, and 3.1 and none of these versions have
>> this bug.
>>
>> This breaks the ability to set channels, etc. Hoping to track down
>> the bug, but wanted to report it in the meantime and see if anyone
>> else has run in to it.
>>
>> - George

2012-11-03 11:13:43

by Johannes Berg

[permalink] [raw]
Subject: Re: bug in compat-wireless 3.6, rt2x00 iftype is wrong

On Fri, 2012-11-02 at 15:57 -0400, George Nychis wrote:
> The issue seems to be that in all of these drivers, wdev is NULL when
> you hit set_channel() in the older and newer driver. In the old
> driver, cfg8011_set_freq() is called with wdev has NULL and it still
> calls rdev->ops->set_channel(....) which succeeds.
>
> However, in the new driver cfg80211_set_monitor_channel() is called
> since wdev was NULL, but now instead of still calling
> rdev->ops->set_channel() or rdev->ops->set_monitor_channel() it
> returns -EBUSY because if(!cfg80211_has_monitors_only(rdev)) returns
> true. Is this really the expected behavior, or is meant to only
> return -EBUSY if there are only monitors, rather? (i.e.,
> if(cfg80211_has_monitors_only(rdev)) )

No, this is the correct behaviour, if you have non-monitor interfaces
you can't set the channel since the channel setting would be done with
other actions, e.g. associating a managed mode interface.

I don't really understand your original complaint though, the iftype you
set will be the one the interface is in ...

johannes


2012-11-02 20:33:56

by George Nychis

[permalink] [raw]
Subject: Re: bug in compat-wireless 3.6, rt2x00 iftype is wrong

This fixes my issue, but I don't know if it's the ideal patch.

On Fri, Nov 2, 2012 at 3:59 PM, George Nychis <[email protected]> wrote:
> in the compat-wireless-3.6.-rc7-1 source code, I'm talking about line
> 88 in net/wireless/chan.c which returns -EBUSY. Note that I have a
> single interface which is in station mode, not monitoring mode. There
> is no interface in true monitoring mode.
>
> On Fri, Nov 2, 2012 at 3:57 PM, George Nychis <[email protected]> wrote:
>> The issue seems to be that in all of these drivers, wdev is NULL when
>> you hit set_channel() in the older and newer driver. In the old
>> driver, cfg8011_set_freq() is called with wdev has NULL and it still
>> calls rdev->ops->set_channel(....) which succeeds.
>>
>> However, in the new driver cfg80211_set_monitor_channel() is called
>> since wdev was NULL, but now instead of still calling
>> rdev->ops->set_channel() or rdev->ops->set_monitor_channel() it
>> returns -EBUSY because if(!cfg80211_has_monitors_only(rdev)) returns
>> true. Is this really the expected behavior, or is meant to only
>> return -EBUSY if there are only monitors, rather? (i.e.,
>> if(cfg80211_has_monitors_only(rdev)) )
>>
>>
>> On Fri, Nov 2, 2012 at 2:46 PM, George Nychis <[email protected]> wrote:
>>> I'm still trying to track down the cause for this, but starting in
>>> compat-wireless-3.6 (including early RCs and the most recent 3.6.2),
>>> rt2x00 devices register with the wrong iftype. They register as
>>> NL80211_IFTYPE_MONITOR instead of NL80211_IFTYPE_STATION, for example.
>>> I checked cw-3.5, 3.4, 3.2, and 3.1 and none of these versions have
>>> this bug.
>>>
>>> This breaks the ability to set channels, etc. Hoping to track down
>>> the bug, but wanted to report it in the meantime and see if anyone
>>> else has run in to it.
>>>
>>> - George


Attachments:
rt2x00_setchan_fix.patch (548.00 B)