diff mbox

chan.c: fix chan.c to return channel number when in monitor mode and on a fixed channel.

Message ID BANLkTimfrcrqVxNXj_5qDYYJoz6Exnzw+w@mail.gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Nicholas Hockey June 23, 2011, 8:49 p.m. UTC
(sorry if this is not right, its been nearly 10 years since i
submitted a kernel patch)

Fixes: When monitoring a fixed channel, chan.c does not report what
channel it is on.

Signed-off-by: Nicholas Hockey <nhockey@gmail.com>
---

@@ -131,5 +133,8 @@ int cfg80211_set_freq(struct
cfg80211_registered_device *rdev,
        if (wdev)
                wdev->channel = chan;

+    if (mon_dev)
+        mon_dev->channel = chan;
+
        return 0;
 }
--
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

Comments

Johannes Berg June 25, 2011, 1:38 p.m. UTC | #1
On Thu, 2011-06-23 at 16:49 -0400, Nicholas Hockey wrote:
> (sorry if this is not right, its been nearly 10 years since i
> submitted a kernel patch)

Listing cfg80211 isntead of "chan.c" would have been useful :-)

> Fixes: When monitoring a fixed channel, chan.c does not report what
> channel it is on.
> 
> Signed-off-by: Nicholas Hockey <nhockey@gmail.com>
> ---
> diff --git a/net/wireless/chan.c b/net/wireless/chan.c
> index 17cd0c0..261ee32 100644
> --- a/net/wireless/chan.c
> +++ b/net/wireless/chan.c
> @@ -82,10 +82,12 @@ int cfg80211_set_freq(struct
> cfg80211_registered_device *rdev,
>  {
>         struct ieee80211_channel *chan;
>         int result;
> +    struct wireless_dev *mon_dev = NULL;
> 
> -       if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
> +       if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) {
> +        mon_dev = wdev;
>                 wdev = NULL;
> -
> +    }
>         if (wdev) {
>                 ASSERT_WDEV_LOCK(wdev);
> 
> @@ -131,5 +133,8 @@ int cfg80211_set_freq(struct
> cfg80211_registered_device *rdev,
>         if (wdev)
>                 wdev->channel = chan;
> 
> +    if (mon_dev)
> +        mon_dev->channel = chan;
> +

This has been discussed numerous times, this change still isn't right
because monitors are slaved to others.

johannes

--
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
Nicholas Hockey June 28, 2011, 4:12 p.m. UTC | #2
If this has been discussed before, could you please point me to a
resource? if this solution is not correct, then id like to read why
its not correct, and formulate another solution for the problem. i am
an amateur radio tech and i have to apply this patch every single
build in order to use some custom software i have developed over the
years.

On Sat, Jun 25, 2011 at 9:38 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Thu, 2011-06-23 at 16:49 -0400, Nicholas Hockey wrote:
>> (sorry if this is not right, its been nearly 10 years since i
>> submitted a kernel patch)
>
> Listing cfg80211 isntead of "chan.c" would have been useful :-)
>
>> Fixes: When monitoring a fixed channel, chan.c does not report what
>> channel it is on.
>>
>> Signed-off-by: Nicholas Hockey <nhockey@gmail.com>
>> ---
>> diff --git a/net/wireless/chan.c b/net/wireless/chan.c
>> index 17cd0c0..261ee32 100644
>> --- a/net/wireless/chan.c
>> +++ b/net/wireless/chan.c
>> @@ -82,10 +82,12 @@ int cfg80211_set_freq(struct
>> cfg80211_registered_device *rdev,
>>  {
>>         struct ieee80211_channel *chan;
>>         int result;
>> +    struct wireless_dev *mon_dev = NULL;
>>
>> -       if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
>> +       if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) {
>> +        mon_dev = wdev;
>>                 wdev = NULL;
>> -
>> +    }
>>         if (wdev) {
>>                 ASSERT_WDEV_LOCK(wdev);
>>
>> @@ -131,5 +133,8 @@ int cfg80211_set_freq(struct
>> cfg80211_registered_device *rdev,
>>         if (wdev)
>>                 wdev->channel = chan;
>>
>> +    if (mon_dev)
>> +        mon_dev->channel = chan;
>> +
>
> This has been discussed numerous times, this change still isn't right
> because monitors are slaved to others.
>
> johannes
>
>
Adrian Chadd June 29, 2011, 2:53 a.m. UTC | #3
Take a look at how monitor mode is used by other bits of software, eg
I think hostapd in Linux uses a monitor mode interface.

If I understand the Linux wifi stack use of monitor mode correctly,
it's not designed like the "classic" monitor mode from days gone by
(eg madwifi) (And this is what BSD still does..); it's a slave device
to a currently configured, non-monitor interface. The normal interface
gets the 'normal' traffic; the slave monitor mode interface sees the
management traffic so hostapd can do MLME, etc.

So you likely need to look at what hostapd does and create/use a
monitor mode interface in the same way. Ie, as a slave to a normal
interface, rather than a stand-alone interface.

Adrian

On 29 June 2011 00:12, Nicholas Hockey <nhockey@gmail.com> wrote:
> If this has been discussed before, could you please point me to a
> resource? if this solution is not correct, then id like to read why
> its not correct, and formulate another solution for the problem. i am
> an amateur radio tech and i have to apply this patch every single
> build in order to use some custom software i have developed over the
> years.
>
> On Sat, Jun 25, 2011 at 9:38 AM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
>> On Thu, 2011-06-23 at 16:49 -0400, Nicholas Hockey wrote:
>>> (sorry if this is not right, its been nearly 10 years since i
>>> submitted a kernel patch)
>>
>> Listing cfg80211 isntead of "chan.c" would have been useful :-)
>>
>>> Fixes: When monitoring a fixed channel, chan.c does not report what
>>> channel it is on.
>>>
>>> Signed-off-by: Nicholas Hockey <nhockey@gmail.com>
>>> ---
>>> diff --git a/net/wireless/chan.c b/net/wireless/chan.c
>>> index 17cd0c0..261ee32 100644
>>> --- a/net/wireless/chan.c
>>> +++ b/net/wireless/chan.c
>>> @@ -82,10 +82,12 @@ int cfg80211_set_freq(struct
>>> cfg80211_registered_device *rdev,
>>>  {
>>>         struct ieee80211_channel *chan;
>>>         int result;
>>> +    struct wireless_dev *mon_dev = NULL;
>>>
>>> -       if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
>>> +       if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) {
>>> +        mon_dev = wdev;
>>>                 wdev = NULL;
>>> -
>>> +    }
>>>         if (wdev) {
>>>                 ASSERT_WDEV_LOCK(wdev);
>>>
>>> @@ -131,5 +133,8 @@ int cfg80211_set_freq(struct
>>> cfg80211_registered_device *rdev,
>>>         if (wdev)
>>>                 wdev->channel = chan;
>>>
>>> +    if (mon_dev)
>>> +        mon_dev->channel = chan;
>>> +
>>
>> This has been discussed numerous times, this change still isn't right
>> because monitors are slaved to others.
>>
>> johannes
>>
>>
>
>
>
> --
> Nicholas (Tilt) Hockey
> --
> 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
>
--
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
Nicholas Hockey June 29, 2011, 3:37 a.m. UTC | #4
thank you very much, that is very helpful information. im sure it will
be a resource for not only me, but a host of others frustrated by the
current state. in order that they will/should be able to research and
modify their software accordingly. i originally wrote my software in
the madwifi days, and didnt pay enough attention to the changes, all i
knew was that the patch i posted solved my problem. i still dont see
whats wrong with my method, but im hoping the direction you have
pointed me in will help answer that,

On Tue, Jun 28, 2011 at 10:53 PM, Adrian Chadd <adrian@freebsd.org> wrote:
> Take a look at how monitor mode is used by other bits of software, eg
> I think hostapd in Linux uses a monitor mode interface.
>
> If I understand the Linux wifi stack use of monitor mode correctly,
> it's not designed like the "classic" monitor mode from days gone by
> (eg madwifi) (And this is what BSD still does..); it's a slave device
> to a currently configured, non-monitor interface. The normal interface
> gets the 'normal' traffic; the slave monitor mode interface sees the
> management traffic so hostapd can do MLME, etc.
>
> So you likely need to look at what hostapd does and create/use a
> monitor mode interface in the same way. Ie, as a slave to a normal
> interface, rather than a stand-alone interface.
>
> Adrian
>
> On 29 June 2011 00:12, Nicholas Hockey <nhockey@gmail.com> wrote:
>> If this has been discussed before, could you please point me to a
>> resource? if this solution is not correct, then id like to read why
>> its not correct, and formulate another solution for the problem. i am
>> an amateur radio tech and i have to apply this patch every single
>> build in order to use some custom software i have developed over the
>> years.
>>
>> On Sat, Jun 25, 2011 at 9:38 AM, Johannes Berg
>> <johannes@sipsolutions.net> wrote:
>>> On Thu, 2011-06-23 at 16:49 -0400, Nicholas Hockey wrote:
>>>> (sorry if this is not right, its been nearly 10 years since i
>>>> submitted a kernel patch)
>>>
>>> Listing cfg80211 isntead of "chan.c" would have been useful :-)
>>>
>>>> Fixes: When monitoring a fixed channel, chan.c does not report what
>>>> channel it is on.
>>>>
>>>> Signed-off-by: Nicholas Hockey <nhockey@gmail.com>
>>>> ---
>>>> diff --git a/net/wireless/chan.c b/net/wireless/chan.c
>>>> index 17cd0c0..261ee32 100644
>>>> --- a/net/wireless/chan.c
>>>> +++ b/net/wireless/chan.c
>>>> @@ -82,10 +82,12 @@ int cfg80211_set_freq(struct
>>>> cfg80211_registered_device *rdev,
>>>>  {
>>>>         struct ieee80211_channel *chan;
>>>>         int result;
>>>> +    struct wireless_dev *mon_dev = NULL;
>>>>
>>>> -       if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
>>>> +       if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) {
>>>> +        mon_dev = wdev;
>>>>                 wdev = NULL;
>>>> -
>>>> +    }
>>>>         if (wdev) {
>>>>                 ASSERT_WDEV_LOCK(wdev);
>>>>
>>>> @@ -131,5 +133,8 @@ int cfg80211_set_freq(struct
>>>> cfg80211_registered_device *rdev,
>>>>         if (wdev)
>>>>                 wdev->channel = chan;
>>>>
>>>> +    if (mon_dev)
>>>> +        mon_dev->channel = chan;
>>>> +
>>>
>>> This has been discussed numerous times, this change still isn't right
>>> because monitors are slaved to others.
>>>
>>> johannes
>>>
>>>
>>
>>
>>
>> --
>> Nicholas (Tilt) Hockey
>> --
>> 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
>>
>
diff mbox

Patch

diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 17cd0c0..261ee32 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -82,10 +82,12 @@  int cfg80211_set_freq(struct
cfg80211_registered_device *rdev,
 {
        struct ieee80211_channel *chan;
        int result;
+    struct wireless_dev *mon_dev = NULL;

-       if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
+       if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) {
+        mon_dev = wdev;
                wdev = NULL;
-
+    }
        if (wdev) {
                ASSERT_WDEV_LOCK(wdev);