Skip to contentSkip to conversation

cfg80211: fix giwrange

PATCH Superseded Johannes Berg 2 participants 4 messages Jul 5, 2009 – Jul 6, 2009 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 cfg80211: fix giwrange

commit c4c496e49ddbf022e51adbd25cedd071329280db

Author: David Kilroy <[email protected]>
Date:   Thu Jun 18 23:21:14 2009 +0100

cfg80211: Advertise ciphers via WE according to driver capability

unfortunately broke iwrange -- it used the variable c that needs to be 0 for the channel list.

---
 net/wireless/wext-compat.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
net/wireless/wext-compat.c +2 -3
@@ -154,7 +154,7 @@ int cfg80211_wext_giwrange(struct net_de
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
 	struct iw_range *range = (struct iw_range *) extra;
 	enum ieee80211_band band;
-	int c = 0;
+	int i, c = 0;
 
 	if (!wdev)
 		return -EOPNOTSUPP;
@@ -201,7 +201,7 @@ int cfg80211_wext_giwrange(struct net_de
 	range->avg_qual.noise = range->max_qual.noise / 2;
 	range->avg_qual.updated = range->max_qual.updated;
 
-	for (c = 0; c < wdev->wiphy->n_cipher_suites; c++) {
+	for (i = 0; i < wdev->wiphy->n_cipher_suites; i++) {
 		switch (wdev->wiphy->cipher_suites[c]) {
 		case WLAN_CIPHER_SUITE_TKIP:
 			range->enc_capa |= (IW_ENC_CAPA_CIPHER_TKIP |
@@ -226,7 +226,6 @@ int cfg80211_wext_giwrange(struct net_de
 	}
 
 	for (band = 0; band < IEEE80211_NUM_BANDS; band ++) {
-		int i;
 		struct ieee80211_supported_band *sband;
 
 		sband = wdev->wiphy->bands[band];
#1 lore raw
Quoted 8 lines · Johannes Berg

commit c4c496e49ddbf022e51adbd25cedd071329280db

Author: David Kilroy <[email protected]>
Date:   Thu Jun 18 23:21:14 2009 +0100

cfg80211: Advertise ciphers via WE according to driver capability

unfortunately broke iwrange -- it used the variable c that needs to be 0 for the channel list.

Doh! I distinctly recall wonderring whether I should use a separate variable. Must've got side-tracked. Sorry :(

Just one thing about the fix though...

net/wireless/wext-compat.c int cfg80211_wext_giwrange(struct net_de · line 205

Quoted 7 lines
net/wireless/wext-compat.c +1 -1
@@ -201,7 +201,7 @@ int cfg80211_wext_giwrange(struct net_de
 	range->avg_qual.noise = range->max_qual.noise / 2;
 	range->avg_qual.updated = range->max_qual.updated;
 
-	for (c = 0; c < wdev->wiphy->n_cipher_suites; c++) {
+	for (i = 0; i < wdev->wiphy->n_cipher_suites; i++) {
 		switch (wdev->wiphy->cipher_suites[c]) {

^ needs to be i

Dave.

author maintainer
#2 lore raw
Quoted 5 lines · Dave
Quoted 4 lines · Johannes Berg

commit c4c496e49ddbf022e51adbd25cedd071329280db

Author: David Kilroy <[email protected]>
Date:   Thu Jun 18 23:21:14 2009 +0100
Quoted 7 lines
Quoted 4 lines

cfg80211: Advertise ciphers via WE according to driver capability

unfortunately broke iwrange -- it used the variable c that needs to be 0 for the channel list.

Doh! I distinctly recall wonderring whether I should use a separate variable. Must've got side-tracked. Sorry :(

No worries.

Quoted 10 lines

Just one thing about the fix though...

net/wireless/wext-compat.c int cfg80211_wext_giwrange(struct net_de · line 205

Quoted 7 lines
net/wireless/wext-compat.c +1 -1
@@ -201,7 +201,7 @@ int cfg80211_wext_giwrange(struct net_de
 	range->avg_qual.noise = range->max_qual.noise / 2;
 	range->avg_qual.updated = range->max_qual.updated;
 
-	for (c = 0; c < wdev->wiphy->n_cipher_suites; c++) {
+	for (i = 0; i < wdev->wiphy->n_cipher_suites; i++) {
 		switch (wdev->wiphy->cipher_suites[c]) {

^ needs to be i

Ouch! Thanks, good catch.

johannes

author maintainer
#3 lore raw

PATCH v2 1/1 cfg80211: fix giwrange

In reply to Dave

commit c4c496e49ddbf022e51adbd25cedd071329280db

Author: David Kilroy <[email protected]>
Date:   Thu Jun 18 23:21:14 2009 +0100

cfg80211: Advertise ciphers via WE according to driver capability

unfortunately broke iwrange -- it used the variable c that needs to be 0 for the channel list.

---
v2: fix bug pointed out by dave

 net/wireless/wext-compat.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
net/wireless/wext-compat.c +3 -4
@@ -154,7 +154,7 @@ int cfg80211_wext_giwrange(struct net_de
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
 	struct iw_range *range = (struct iw_range *) extra;
 	enum ieee80211_band band;
-	int c = 0;
+	int i, c = 0;
 
 	if (!wdev)
 		return -EOPNOTSUPP;
@@ -201,8 +201,8 @@ int cfg80211_wext_giwrange(struct net_de
 	range->avg_qual.noise = range->max_qual.noise / 2;
 	range->avg_qual.updated = range->max_qual.updated;
 
-	for (c = 0; c < wdev->wiphy->n_cipher_suites; c++) {
-		switch (wdev->wiphy->cipher_suites[c]) {
+	for (i = 0; i < wdev->wiphy->n_cipher_suites; i++) {
+		switch (wdev->wiphy->cipher_suites[i]) {
 		case WLAN_CIPHER_SUITE_TKIP:
 			range->enc_capa |= (IW_ENC_CAPA_CIPHER_TKIP |
 					    IW_ENC_CAPA_WPA);
@@ -226,7 +226,6 @@ int cfg80211_wext_giwrange(struct net_de
 	}
 
 	for (band = 0; band < IEEE80211_NUM_BANDS; band ++) {
-		int i;
 		struct ieee80211_supported_band *sband;
 
 		sband = wdev->wiphy->bands[band];