BSS: Add wpa_bss_get_ie_ext() wrapper

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>
This commit is contained in:
Jouni Malinen 2020-11-16 16:00:21 +02:00 committed by Jouni Malinen
parent dba4f7a545
commit 95edd81441
4 changed files with 19 additions and 4 deletions

View 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

View 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);

View 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;

View 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;