linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix handling of 4-address-mode in ieee80211_change_iface
@ 2010-04-26 17:54 Felix Fietkau
  2010-04-26 21:50 ` Pavel Roskin
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Fietkau @ 2010-04-26 17:54 UTC (permalink / raw)
  To: linux-wireless; +Cc: John W. Linville, Johannes Berg

A misplaced interface type check bails out too early if the interface
is not in monitor mode. This patch moves it to the right place, so that
it only covers changes to the monitor flags.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
---
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -97,9 +97,6 @@ static int ieee80211_change_iface(struct
 					    params->mesh_id_len,
 					    params->mesh_id);

-	if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
-		return 0;
-
 	if (type == NL80211_IFTYPE_AP_VLAN &&
 	    params && params->use_4addr == 0)
 		rcu_assign_pointer(sdata->u.vlan.sta, NULL);
@@ -107,6 +104,9 @@ static int ieee80211_change_iface(struct
 		 params && params->use_4addr >= 0)
 		sdata->u.mgd.use_4addr = params->use_4addr;

+	if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
+		return 0;
+
 	sdata->u.mntr_flags = *flags;
 	return 0;
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: fix handling of 4-address-mode in ieee80211_change_iface
  2010-04-26 17:54 [PATCH] mac80211: fix handling of 4-address-mode in ieee80211_change_iface Felix Fietkau
@ 2010-04-26 21:50 ` Pavel Roskin
  2010-04-26 22:26   ` [PATCH v2] " Felix Fietkau
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Roskin @ 2010-04-26 21:50 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, John W. Linville, Johannes Berg

On Mon, 2010-04-26 at 19:54 +0200, Felix Fietkau wrote:
> A misplaced interface type check bails out too early if the interface
> is not in monitor mode. This patch moves it to the right place, so that
> it only covers changes to the monitor flags.
...
> +	if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
> +		return 0;
> +
>  	sdata->u.mntr_flags = *flags;
>  	return 0;
>  }

Perhaps you could write it in a more readable way:

       if (sdata->vif.type == NL80211_IFTYPE_MONITOR && flags)
               sdata->u.mntr_flags = *flags;

       return 0;

Just an idea, not an objection.

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] mac80211: fix handling of 4-address-mode in ieee80211_change_iface
  2010-04-26 21:50 ` Pavel Roskin
@ 2010-04-26 22:26   ` Felix Fietkau
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Fietkau @ 2010-04-26 22:26 UTC (permalink / raw)
  To: linux-wireless; +Cc: Pavel Roskin, John W. Linville, Johannes Berg

A misplaced interface type check bails out too early if the interface
is not in monitor mode. This patch moves it to the right place, so that
it only covers changes to the monitor flags.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
---
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -97,9 +97,6 @@ static int ieee80211_change_iface(struct
 					    params->mesh_id_len,
 					    params->mesh_id);
 
-	if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
-		return 0;
-
 	if (type == NL80211_IFTYPE_AP_VLAN &&
 	    params && params->use_4addr == 0)
 		rcu_assign_pointer(sdata->u.vlan.sta, NULL);
@@ -107,7 +104,9 @@ static int ieee80211_change_iface(struct
 		 params && params->use_4addr >= 0)
 		sdata->u.mgd.use_4addr = params->use_4addr;
 
-	sdata->u.mntr_flags = *flags;
+	if (sdata->vif.type == NL80211_IFTYPE_MONITOR && flags)
+		sdata->u.mntr_flags = *flags;
+
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-26 22:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-26 17:54 [PATCH] mac80211: fix handling of 4-address-mode in ieee80211_change_iface Felix Fietkau
2010-04-26 21:50 ` Pavel Roskin
2010-04-26 22:26   ` [PATCH v2] " Felix Fietkau

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).