aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/bss.c
diff options
context:
space:
mode:
authorAmar Singhal <asinghal@qca.qualcomm.com>2013-02-07 10:27:52 (GMT)
committerJouni Malinen <j@w1.fi>2013-02-07 10:27:52 (GMT)
commit9f42d49c55f233bf536e3a06dbe9a4e5ef0249aa (patch)
treeb2f583ba27f982f6c88b024fbd4598b13e5d155e /wpa_supplicant/bss.c
parentcc03d0fef3bf5913f8e11b7e998c10bf36a3c07f (diff)
downloadhostap-9f42d49c55f233bf536e3a06dbe9a4e5ef0249aa.zip
hostap-9f42d49c55f233bf536e3a06dbe9a4e5ef0249aa.tar.gz
hostap-9f42d49c55f233bf536e3a06dbe9a4e5ef0249aa.tar.bz2
Fix BSS RANGE command for no exact id match cases
The RANGE=N1-N2 command did not return any entries in some cases where N1 does not match with any BSS entry. Fix this by allow entries to be fetched even without knowing the exact id values. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/bss.c')
-rw-r--r--wpa_supplicant/bss.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
index 87b7db8..9dc0be2 100644
--- a/wpa_supplicant/bss.c
+++ b/wpa_supplicant/bss.c
@@ -865,6 +865,29 @@ struct wpa_bss * wpa_bss_get_id(struct wpa_supplicant *wpa_s, unsigned int id)
/**
+ * wpa_bss_get_id_range - Fetch a BSS table entry based on identifier range
+ * @wpa_s: Pointer to wpa_supplicant data
+ * @idf: Smallest allowed identifier assigned for the entry
+ * @idf: Largest allowed identifier assigned for the entry
+ * Returns: Pointer to the BSS entry or %NULL if not found
+ *
+ * This function is similar to wpa_bss_get_id() but allows a BSS entry with the
+ * smallest id value to be fetched within the specified range without the
+ * caller having to know the exact id.
+ */
+struct wpa_bss * wpa_bss_get_id_range(struct wpa_supplicant *wpa_s,
+ unsigned int idf, unsigned int idl)
+{
+ struct wpa_bss *bss;
+ dl_list_for_each(bss, &wpa_s->bss_id, struct wpa_bss, list_id) {
+ if (bss->id >= idf && bss->id <= idl)
+ return bss;
+ }
+ return NULL;
+}
+
+
+/**
* wpa_bss_get_ie - Fetch a specified information element from a BSS entry
* @bss: BSS table entry
* @ie: Information element identitifier (WLAN_EID_*)