Skip to contentSkip to conversation

mac80211: fix monitor mode channel reporting

PATCH In review Felix Fietkau 2 participants 2 messages Feb 23, 2013 – Feb 26, 2013 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix monitor mode channel reporting

When not using channel contexts with only monitor mode interfaces being active, report local->monitor_chandef to userspace.

---
 net/mac80211/cfg.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
net/mac80211/cfg.c +9 -3
index 09d96a8..808f5fc 100644
@@ -3285,13 +3285,19 @@ static int ieee80211_cfg_get_channel(struct wiphy *wiphy,
 				     struct cfg80211_chan_def *chandef)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+	struct ieee80211_local *local = wiphy_priv(wiphy);
 	struct ieee80211_chanctx_conf *chanctx_conf;
 	int ret = -ENODATA;
 
 	rcu_read_lock();
-	chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
-	if (chanctx_conf) {
-		*chandef = chanctx_conf->def;
+	if (local->use_chanctx) {
+		chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
+		if (chanctx_conf) {
+			*chandef = chanctx_conf->def;
+			ret = 0;
+		}
+	} else if (local->open_count == local->monitors) {
+		*chandef = local->monitor_chandef;
 		ret = 0;
 	}
 	rcu_read_unlock();
Signature · 1 line
1.8.0.2
maintainer
#1 lore raw
Quoted 2 lines · Felix Fietkau

When not using channel contexts with only monitor mode interfaces being active, report local->monitor_chandef to userspace.

Makes sense, applied.

johannes