Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Felix Fietkau <nbd@openwrt.org>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 2/3] mac80211: support active monitor interfaces
Date: Mon, 27 May 2013 10:50:17 +0200	[thread overview]
Message-ID: <1369644617.8229.9.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1369577107-87931-2-git-send-email-nbd@openwrt.org>

On Sun, 2013-05-26 at 16:05 +0200, Felix Fietkau wrote:

>  	if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
>  		    (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
> -		     !(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF))))
> +		     !(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF) &&
> +			 !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE))))
>  		return -EINVAL;

bad indentation

> +++ b/net/mac80211/iface.c
> @@ -209,9 +209,11 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
>  	if (ieee80211_sdata_running(sdata))
>  		return -EBUSY;
>  
> -	ret = ieee80211_verify_mac(sdata->local, sa->sa_data);
> -	if (ret)
> -		return ret;
> +	if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
> +		ret = ieee80211_verify_mac(sdata->local, sa->sa_data);
> +		if (ret)
> +			return ret;
> +	}

I'm not convinced this makes sense, why would you want to have a monitor
with an invalid address? I'd rather not allow that, having e.g. a
multicast address that is ACK'ing frames would be very very strange.
 
> @@ -479,9 +481,13 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
>  	case NL80211_IFTYPE_AP:
>  		sdata->bss = &sdata->u.ap;
>  		break;
> +	case NL80211_IFTYPE_MONITOR:
> +		if ((sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE) &&
> +		    !(local->hw.flags & IEEE80211_HW_SUPPORTS_ACTIVE_MONITOR))
> +			return -EOPNOTSUPP;

How can you even get here? Shouldn't you just disallow setting the flag
unless it's supported?

> -		if (local->monitors == 0 && local->open_count == 0) {
> +		if (sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE) {
> +			res = drv_add_interface(local, sdata);
> +			if (res)
> +				goto err_stop;
> +
> +			local->active_mntrs++;

Did I miss something, or don't you use the counter?

johannes


  parent reply	other threads:[~2013-05-27  8:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-26 14:05 [PATCH 1/3] cfg80211: support an active monitor interface flag Felix Fietkau
2013-05-26 14:05 ` [PATCH 2/3] mac80211: support active monitor interfaces Felix Fietkau
2013-05-27  8:42   ` Johannes Berg
2013-05-27  8:50   ` Johannes Berg [this message]
2013-05-26 14:05 ` [PATCH 3/3] ath9k: advertise support for " Felix Fietkau
2013-05-27  8:42 ` [PATCH 1/3] cfg80211: support an active monitor interface flag 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=1369644617.8229.9.camel@jlt4.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@openwrt.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