linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] mac80211: fix rx monitor filter refcounters
@ 2010-09-28 16:36 Christian Lamparter
  2010-09-29  7:10 ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Lamparter @ 2010-09-28 16:36 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg

This patch fixes a refcounter & commit bug when monitor
rx flags are changed by:
	iw dev moni set monitor [new flags]

while interface is up.

---
Is there a sane way to do that?

Introduced by: 8cc9a73914 - Jan 31 19:48:23 2008 
"mac80211: Use monitor configuration flags"
---
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index c981604..c156936 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -68,8 +68,47 @@ 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 = sdata->u.mntr_flags ^ *flags;
+
 		sdata->u.mntr_flags = *flags;
+		if (changed_flags & MONITOR_FLAG_FCSFAIL) {
+			if (*flags & MONITOR_FLAG_FCSFAIL)
+				local->fif_fcsfail++;
+			else
+				local->fif_fcsfail--;
+		}
+		if (changed_flags & MONITOR_FLAG_PLCPFAIL) {
+			if (*flags & MONITOR_FLAG_PLCPFAIL)
+				local->fif_plcpfail++;
+			else
+				local->fif_plcpfail--;
+		}
+		if (changed_flags & MONITOR_FLAG_COOK_FRAMES) {
+			if (*flags & MONITOR_FLAG_COOK_FRAMES)
+				local->cooked_mntrs++;
+			else
+				local->cooked_mntrs--;
+		}
+		if (changed_flags & MONITOR_FLAG_OTHER_BSS) {
+			if (*flags & MONITOR_FLAG_OTHER_BSS)
+				local->fif_other_bss++;
+			else
+				local->fif_other_bss--;
+		}
+		if (changed_flags & MONITOR_FLAG_CONTROL) {
+			if (*flags & MONITOR_FLAG_CONTROL) {
+				local->fif_pspoll++;
+				local->fif_control++;
+			} else {
+				local->fif_pspoll--;
+				local->fif_control--;
+			}
+		}
+
+		ieee80211_configure_filter(local);
+	}
 
 	return 0;
 }

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

end of thread, other threads:[~2010-10-02 11:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2010-10-01 21:53       ` [PATCH] " Christian Lamparter
2010-10-02  8:46         ` Johannes Berg
2010-10-02 11:17           ` [PATCH v2] " Christian Lamparter

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