linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Christian Lamparter <chunkeey@googlemail.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [RFC v2] mac80211: fix rx monitor filter refcounters
Date: Wed, 29 Sep 2010 22:00:39 +0200	[thread overview]
Message-ID: <1285790439.3756.35.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <201009292157.04141.chunkeey@googlemail.com>

On Wed, 2010-09-29 at 21:57 +0200, Christian Lamparter wrote:

> > > Is there a sane way to do that?
> > 
> > Is this not sane enough? Looks OK to me, even if it adds a bit of code.
> > 
> 
> It's about MONITOR_FLAG_COOK_FRAMES. This flag gives me headaches.
> I wish we could make this flag "const" and don't allow it be changed
> by iw dev wlanX set monitor. 

Ah. Then you can only specify it when creating an interface, right? Fine
with me, really.

> Another alternative would be to move
> the "sdata->u.mntr_flag -> fif_* processing" into
> ieee80211_configure_filter. 
> 
> or: 
> ---
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index c981604..1ffe266 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -68,9 +68,61 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
>  		 params && params->use_4addr >= 0)
>  		sdata->u.mgd.use_4addr = params->use_4addr;
>  
> -	if (sdata->vif.type == NL80211_IFTYPE_MONITOR && flags)
> +	if (sdata->vif.type == NL80211_IFTYPE_MONITOR && flags) {
> +		struct ieee80211_local *local = sdata->local;
> +		u32 changed_flags;
> +		u32 old_flags;
> +		u32 hw_reconf_flags = 0;
> +
> +		old_flags = sdata->u.mntr_flags;
> +		changed_flags = old_flags ^ *flags;
> +		if (!(old_flags & MONITOR_FLAG_COOK_FRAMES))
> +			ieee80211_adjust_monitor_flags(sdata, -1);
> +
> +		if (changed_flags & MONITOR_FLAG_COOK_FRAMES) {
> +			if (*flags & MONITOR_FLAG_COOK_FRAMES) {
> +				local->cooked_mntrs++;
> +				local->monitors--;

Yeah, that's kinda ugly. I'm fine with not allowing the cook flag to
change, seems like a pretty special case anyway. Or, we can allow it to
change, but only while the interface is down, right?

johannes


  reply	other threads:[~2010-09-29 20:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28 16:36 [RFC] mac80211: fix rx monitor filter refcounters Christian Lamparter
2010-09-29  7:10 ` Johannes Berg
2010-09-29 19:57   ` [RFC v2] " Christian Lamparter
2010-09-29 20:00     ` Johannes Berg [this message]
2010-10-01 21:53       ` [PATCH] " Christian Lamparter
2010-10-02  8:46         ` Johannes Berg
2010-10-02 11:17           ` [PATCH v2] " Christian Lamparter

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=1285790439.3756.35.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=chunkeey@googlemail.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).