All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/7] ie: fix ie_parse_data_rates to handle NULL
@ 2021-05-07 20:26 James Prestwood
  2021-05-07 20:26 ` [PATCH v2 2/7] scan: rework BSS ranking James Prestwood
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: James Prestwood @ 2021-05-07 20:26 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]

The code was partially there to handle NULL IEs but not
quite. If NULL IEs are passed in base the data rate totally
on the basic rate RSSI table.
---
 src/ie.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/ie.c b/src/ie.c
index 0f430b98..0b471f1b 100644
--- a/src/ie.c
+++ b/src/ie.c
@@ -1688,14 +1688,16 @@ static int ie_parse_supported_rates(struct ie_tlv_iter *supp_rates_iter,
 		max_rate = map->rate;
 	}
 
-	/* Find highest rate in Supported Rates IE */
-	rates = ie_tlv_iter_get_data(supp_rates_iter);
+	if (supp_rates_iter) {
+		/* Find highest rate in Supported Rates IE */
+		rates = ie_tlv_iter_get_data(supp_rates_iter);
 
-	for (i = 0; i < len; i++) {
-		uint8_t r = rates[i] & 0x7f;
+		for (i = 0; i < len; i++) {
+			uint8_t r = rates[i] & 0x7f;
 
-		if (r <= max_rate && r > highest)
-			highest = r;
+			if (r <= max_rate && r > highest)
+				highest = r;
+		}
 	}
 
 	/* Find highest rate in Extended Supported Rates IE */
@@ -1711,7 +1713,10 @@ static int ie_parse_supported_rates(struct ie_tlv_iter *supp_rates_iter,
 		}
 	}
 
-	*data_rate = (highest / 2) * 1000000;
+	if (highest)
+		*data_rate = (highest / 2) * 1000000;
+	else
+		*data_rate = (max_rate / 2) * 1000000;
 
 	return 0;
 }
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-19 15:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 20:26 [PATCH v2 1/7] ie: fix ie_parse_data_rates to handle NULL James Prestwood
2021-05-07 20:26 ` [PATCH v2 2/7] scan: rework BSS ranking James Prestwood
2021-05-19 15:00   ` Denis Kenzior
2021-05-07 20:26 ` [PATCH v2 3/7] network: use WPA version and privacy for ranking James Prestwood
2021-05-07 20:26 ` [PATCH v2 4/7] station: autoconnect based on network, not BSS James Prestwood
2021-05-07 20:26 ` [PATCH v2 5/7] netdev: introduce [General].RoamThreshold5G James Prestwood
2021-05-07 20:26 ` [PATCH v2 6/7] doc: document [General].RoamThreshold5G James Prestwood
2021-05-10 15:13   ` Denis Kenzior
2021-05-07 20:26 ` [PATCH v2 7/7] test-runner: remove stale file after test James Prestwood
2021-05-10 15:09 ` [PATCH v2 1/7] ie: fix ie_parse_data_rates to handle NULL Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.