Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb601ffa authored by Felix Fietkau's avatar Felix Fietkau Committed by Johannes Berg
Browse files

mac80211: fix monitor mode channel reporting



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

Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent b759f4dd
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -3285,15 +3285,21 @@ 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();
	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();

	return ret;