]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
BSS: Add wpa_bss_get_ie_ext() wrapper
authorJouni Malinen <jouni@codeaurora.org>
Mon, 16 Nov 2020 14:00:21 +0000 (16:00 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 16 Nov 2020 14:00:21 +0000 (16:00 +0200)
This removes need from the callers to know the struct wpa_bss details
for the location of the memory area for storing the IEs.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/bss.c
wpa_supplicant/bss.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/wpa_supplicant.c

index 7e420485fe8b737f6a1521b337b31f16cad46ac6..c64ddbcedd7c2bf6195e59b8dc2c7ee00673be26 100644 (file)
@@ -1143,6 +1143,21 @@ const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie)
 }
 
 
+/**
+ * wpa_bss_get_ie_ext - Fetch a specified extended IE from a BSS entry
+ * @bss: BSS table entry
+ * @ext: Information element extension identifier (WLAN_EID_EXT_*)
+ * Returns: Pointer to the information element (id field) or %NULL if not found
+ *
+ * This function returns the first matching information element in the BSS
+ * entry.
+ */
+const u8 * wpa_bss_get_ie_ext(const struct wpa_bss *bss, u8 ext)
+{
+       return get_ie_ext((const u8 *) (bss + 1), bss->ie_len, ext);
+}
+
+
 /**
  * wpa_bss_get_vendor_ie - Fetch a vendor information element from a BSS entry
  * @bss: BSS table entry
index e49858d193df7166c7c0be573b3ab3ace533138d..b3d574eeecd84e4265cf5ab07a04d632d92816f1 100644 (file)
@@ -137,6 +137,7 @@ struct wpa_bss * wpa_bss_get_id(struct wpa_supplicant *wpa_s, unsigned int id);
 struct wpa_bss * wpa_bss_get_id_range(struct wpa_supplicant *wpa_s,
                                      unsigned int idf, unsigned int idl);
 const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie);
+const u8 * wpa_bss_get_ie_ext(const struct wpa_bss *bss, u8 ext);
 const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type);
 const u8 * wpa_bss_get_vendor_ie_beacon(const struct wpa_bss *bss,
                                        u32 vendor_type);
index aeea5ddbc0168c31bf4caa57d509e23399fdf1c1..fcae260b9bedd238ac874a29575c72433a402e57 100644 (file)
@@ -3030,8 +3030,7 @@ static int wpa_supplicant_ctrl_iface_scan_result(
        if (bss_is_dmg(bss)) {
                const char *s;
 
-               if (get_ie_ext((const u8 *) (bss + 1), bss->ie_len,
-                              WLAN_EID_EXT_EDMG_OPERATION)) {
+               if (wpa_bss_get_ie_ext(bss, WLAN_EID_EXT_EDMG_OPERATION)) {
                        ret = os_snprintf(pos, end - pos, "[EDMG]");
                        if (os_snprintf_error(end - pos, ret))
                                return -1;
index ba7c23fa9f3c47a4269b9c4cc0f1c6645fe47cbd..b51e31785745676337ac2c64b2637050504fe67e 100644 (file)
@@ -3640,8 +3640,8 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
        }
 
        if (bss && ssid->enable_edmg)
-               edmg_ie_oper = get_ie_ext((const u8 *) (bss + 1), bss->ie_len,
-                                         WLAN_EID_EXT_EDMG_OPERATION);
+               edmg_ie_oper = wpa_bss_get_ie_ext(bss,
+                                                 WLAN_EID_EXT_EDMG_OPERATION);
        else
                edmg_ie_oper = NULL;