Skip to contentSkip to conversation

cfg80211: have consistent checks for adding new entries in scan list

RFC New Mohammed Shafi Shajakhan 1 participant 1 message Apr 10, 2012 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

RFC 1/1 cfg80211: have consistent checks for adding new entries in scan list

From: Mohammed Shafi Shajakhan <[email protected]>

*decide to traverse the RB tree in right
- if the center frequency of new scan list entry is greater than the already available entries
- if the IE length of new scan list entry is greater than the already available entries

this is in consistent with checks for BSSID, IE information checks

not sure if this done specifically for some other reason

---
 net/wireless/scan.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
net/wireless/scan.c +3 -3
index 70faadf..fda4eef 100644
@@ -271,7 +271,7 @@ static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2)
 
 	/* sort by length first, then by contents */
 	if (ie1[1] != ie2[1])
-		return ie2[1] - ie1[1];
+		return ie1[1] - ie2[1];
 	return memcmp(ie1 + 2, ie2 + 2, ie1[1]);
 }
 
@@ -361,7 +361,7 @@ static int cmp_bss_core(struct cfg80211_bss *a,
 	int r;
 
 	if (a->channel != b->channel)
-		return b->channel->center_freq - a->channel->center_freq;
+		return a->channel->center_freq - b->channel->center_freq;
 
 	if (is_mesh_bss(a) && is_mesh_bss(b)) {
 		r = cmp_ies(WLAN_EID_MESH_ID,
@@ -433,7 +433,7 @@ static int cmp_hidden_bss(struct cfg80211_bss *a,
 
 	/* sort by length first, then by contents */
 	if (ie1[1] != ie2[1])
-		return ie2[1] - ie1[1];
+		return ie1[1] - ie2[1];
 
 	/* zeroed SSID ie is another indication of a hidden bss */
 	for (i = 0; i < ie2[1]; i++)
Signature · 1 line
1.7.0.4