linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Eliad Peller <eliad@wizery.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] cfg80211: fix set_monitor_enabled
Date: Thu, 12 Jul 2012 18:31:02 +0200	[thread overview]
Message-ID: <1342110662.4531.42.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <CAB3XZEc0nk5xj10WadANvHaUxMYaZ9k26aCUnDbMDLGbTGEzPw@mail.gmail.com> (sfid-20120712_182615_622530_0365C4FD)

On Thu, 2012-07-12 at 19:26 +0300, Eliad Peller wrote:

> >> why not always do it only on IFACE_UP?
> >
> > Yeah .. thought so too at first, but it doesn't work, say you have this
> > situation:
> >
> >  * up moni0 (monitor)
> >  * up wlan0 (managed)
> >
> > Then the set_monitor_enabled(false) should happen before wlan0 is
> > brought up, otherwise mac80211/the driver will correctly reject wlan0
> > being brought up.
> >
> but you don't call set_monitor_enabled(false) on pre_up in your
> patch...

It does, this is what happens when wlan0 is brought up:

> 	rdev->num_running_ifaces += num;
>         if (iftype == NL80211_IFTYPE_MONITOR)
>                 rdev->num_running_monitor_ifaces += num;

will inc num_running_ifaces by one

>         monitors_only = cfg80211_has_monitors_only(rdev);

will be false, while it was previously true

> 	if (monitors_only && rdev->monitor_only_enabled)
>                 return;

doesn't return, since monitors_only == false

> 	if (!monitors_only && !rdev->monitor_only_enabled)
>                 return;

doesn't return since monitor_only_enabled == true


> 	if (monitors_only) {

no, we'll go into else

> 	} else {
>                 rdev->monitor_channel = NULL;
>                 rdev->monitor_channel_type = NL80211_CHAN_NO_HT;
>                 if (rdev->ops->set_monitor_enabled)
>                         rdev->ops->set_monitor_enabled(&rdev->wiphy, false);
>         }

and call set_monitor_enabled(false)

> so i guess the driver will still get its add_interface
> callback while the monitor is enabled?

add_interface is a long time ago. I'm talking about bringing it up, and
PRE_UP happens before the ndo_open() is called for the interface.

> afaict, the only effect of pre_up is updating
> rdev->num_running_ifaces/rdev->num_running_monitor_ifaces, which don't
> seem to matter much...

No :-)

johannes


  reply	other threads:[~2012-07-12 16:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 15:15 [PATCH] cfg80211: fix set_monitor_enabled Johannes Berg
2012-07-12 16:00 ` Eliad Peller
2012-07-12 16:03   ` Johannes Berg
2012-07-12 16:26     ` Eliad Peller
2012-07-12 16:31       ` Johannes Berg [this message]
2012-07-12 16:37         ` Eliad Peller
2012-07-12 17:07           ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342110662.4531.42.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=eliad@wizery.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).