Skip to contentSkip to conversation

cfg80211: fix ibss wext chandef creation

PATCH In review Simon Wunderlich 3 participants 5 messages Oct 22, 2013 – Oct 28, 2013 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfg80211: fix ibss wext chandef creation

The wext internal chandefs for ibss should be created using the cfg80211_chandef_create() functions. Otherwise the center_freq1 field will not be set and cfg80211_chandef_valid() will spit a warning and report the chandef as invalid when it should be used.

---
 net/wireless/ibss.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
net/wireless/ibss.c +9 -6
index 39bff7d..a710019 100644
@@ -246,7 +246,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
 
 	/* try to find an IBSS channel if none requested ... */
 	if (!wdev->wext.ibss.chandef.chan) {
-		wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
+		struct ieee80211_channel *new_chan = NULL;
 
 		for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
 			struct ieee80211_supported_band *sband;
@@ -262,16 +262,19 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
 					continue;
 				if (chan->flags & IEEE80211_CHAN_DISABLED)
 					continue;
-				wdev->wext.ibss.chandef.chan = chan;
+				new_chan = chan;
 				break;
 			}
 
-			if (wdev->wext.ibss.chandef.chan)
+			if (new_chan)
 				break;
 		}
 
-		if (!wdev->wext.ibss.chandef.chan)
+		if (!new_chan)
 			return -EINVAL;
+
+		cfg80211_chandef_create(&wdev->wext.ibss.chandef, new_chan,
+					NL80211_CHAN_NO_HT);
 	}
 
 	/* don't join -- SSID is not there */
@@ -345,8 +348,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
 		return err;
 
 	if (chan) {
-		wdev->wext.ibss.chandef.chan = chan;
-		wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
+		cfg80211_chandef_create(&wdev->wext.ibss.chandef, chan,
+					NL80211_CHAN_NO_HT);
 		wdev->wext.ibss.channel_fixed = true;
 	} else {
 		/* cfg80211_ibss_wext_join will pick one if needed */
Signature · 1 line
1.7.10.4
Tested-by on v1 1/1
#1 lore raw
Quoted 4 lines · Simon Wunderlich

The wext internal chandefs for ibss should be created using the cfg80211_chandef_create() functions. Otherwise the center_freq1 field will not be set and cfg80211_chandef_valid() will spit a warning and report the chandef as invalid when it should be used.

Thanks a lot, Simon, I don't see anymore traces here.

Quoted 54 lines
---
 net/wireless/ibss.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
net/wireless/ibss.c +9 -6
index 39bff7d..a710019 100644
@@ -246,7 +246,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
 
 	/* try to find an IBSS channel if none requested ... */
 	if (!wdev->wext.ibss.chandef.chan) {
-		wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
+		struct ieee80211_channel *new_chan = NULL;
 
 		for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
 			struct ieee80211_supported_band *sband;
@@ -262,16 +262,19 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
 					continue;
 				if (chan->flags & IEEE80211_CHAN_DISABLED)
 					continue;
-				wdev->wext.ibss.chandef.chan = chan;
+				new_chan = chan;
 				break;
 			}
 
-			if (wdev->wext.ibss.chandef.chan)
+			if (new_chan)
 				break;
 		}
 
-		if (!wdev->wext.ibss.chandef.chan)
+		if (!new_chan)
 			return -EINVAL;
+
+		cfg80211_chandef_create(&wdev->wext.ibss.chandef, new_chan,
+					NL80211_CHAN_NO_HT);
 	}
 
 	/* don't join -- SSID is not there */
@@ -345,8 +348,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
 		return err;
 
 	if (chan) {
-		wdev->wext.ibss.chandef.chan = chan;
-		wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
+		cfg80211_chandef_create(&wdev->wext.ibss.chandef, chan,
+					NL80211_CHAN_NO_HT);
 		wdev->wext.ibss.channel_fixed = true;
 	} else {
 		/* cfg80211_ibss_wext_join will pick one if needed */
maintainer
#2 lore raw
In reply to Simon Wunderlich
Quoted 4 lines · Simon Wunderlich

The wext internal chandefs for ibss should be created using the cfg80211_chandef_create() functions. Otherwise the center_freq1 field will not be set and cfg80211_chandef_valid() will spit a warning and report the chandef as invalid when it should be used.

I think

commit f478f33a93f9353dcd1fe55445343d76b1c3f84a

Author: Bruno Randolf <[email protected]>
Date:   Thu Sep 26 16:55:28 2013 +0100

cfg80211: fix warning when using WEXT for IBSS

already fixed this. Your patch doesn't apply, but feel free to send me a new one (for -next) converting to the creation helpers.

johannes

#3 lore raw
Quoted 9 lines · Johannes Berg
Quoted 4 lines · Simon Wunderlich

The wext internal chandefs for ibss should be created using the cfg80211_chandef_create() functions. Otherwise the center_freq1 field will not be set and cfg80211_chandef_valid() will spit a warning and report the chandef as invalid when it should be used.

I think

commit f478f33a93f9353dcd1fe55445343d76b1c3f84a

Quoted 8 lines
Author: Bruno Randolf <[email protected]>
Date:   Thu Sep 26 16:55:28 2013 +0100

cfg80211: fix warning when using WEXT for IBSS

already fixed this. Your patch doesn't apply, but feel free to send me a new one (for -next) converting to the creation helpers.

I tested the above commit and it also fixes the problems I noticed here.

Dirk

#4 lore raw
In reply to Johannes Berg
Quoted 9 lines · Johannes Berg
Quoted 4 lines · Simon Wunderlich

The wext internal chandefs for ibss should be created using the cfg80211_chandef_create() functions. Otherwise the center_freq1 field will not be set and cfg80211_chandef_valid() will spit a warning and report the chandef as invalid when it should be used.

I think

commit f478f33a93f9353dcd1fe55445343d76b1c3f84a

Quoted 8 lines
Author: Bruno Randolf <[email protected]>
Date:   Thu Sep 26 16:55:28 2013 +0100

cfg80211: fix warning when using WEXT for IBSS

already fixed this. Your patch doesn't apply, but feel free to send me a new one (for -next) converting to the creation helpers.

I tested the above commit and it also fixes the problems I noticed here.

Best regards,

Dirk