Skip to contentSkip to conversation

mac80211: choose first enabled channel for monitor

PATCH New Karthikeyan Kathirvel 1 participant 1 message Mar 11, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mac80211: choose first enabled channel for monitor

Though the first channel from sband channel list is invalid or disabled still mac80211 is choosing this disabled channel as a default channel for monitor interface. This will end-up in choosing wrong channel.

Fixed by assigning the first available valid or enabled channel to the respective radios.

---

v2:
Addressed review comments on changing the subject

 net/mac80211/main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
net/mac80211/main.c +8 -1
index 4f3f8bb..1f8a5eb 100644
@@ -973,8 +973,15 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 			continue;
 
 		if (!dflt_chandef.chan) {
+			/*
+			 * Assigning the first enabled channel to dflt_chandef from the
+			 * list of channels available specific to country
+			 */
+			for (i = 0; i < sband->n_channels; i++)
+				if (!(sband->channels[i].flags & IEEE80211_CHAN_DISABLED))
+					break;
 			cfg80211_chandef_create(&dflt_chandef,
-						&sband->channels[0],
+						&sband->channels[i == sband->n_channels ? 0 : i],
 						NL80211_CHAN_NO_HT);
 			/* init channel we're on */
 			if (!local->use_chanctx && !local->_oper_chandef.chan) {
Signature · 7 lines
2.7.4


-- 
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k