From: Jouni Malinen Date: Tue, 13 Dec 2016 13:49:22 +0000 (+0200) Subject: Make Beacon IEs available in wpa_supplicant BSS command X-Git-Tag: hostap_2_7~2018 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=19810d29bcd169c3d786f30aed7902c7d51ee6a1;p=thirdparty%2Fhostap.git Make Beacon IEs available in wpa_supplicant BSS command This makes both the Probe Response and Beacon frame IEs available to upper layers if scan results include both IE sets. When the BSS command mask includes WPA_BSS_MASK_BEACON_IE, a new beacon_ie= entry will be included in output if the BSS entry has two separate sets of IEs (ie= showing the Probe Response frame contents and beacon_ie= the Beacon rame contents). Signed-off-by: Jouni Malinen --- diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index 6be472de6..ae31ef36a 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -319,6 +319,7 @@ extern "C" { #define WPA_BSS_MASK_EST_THROUGHPUT BIT(20) #define WPA_BSS_MASK_FST BIT(21) #define WPA_BSS_MASK_UPDATE_IDX BIT(22) +#define WPA_BSS_MASK_BEACON_IE BIT(23) /* VENDOR_ELEM_* frame id values */ diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index beb06ed5f..4439efbe2 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -4450,6 +4450,27 @@ static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, pos += ret; } + if ((mask & WPA_BSS_MASK_BEACON_IE) && bss->beacon_ie_len) { + ret = os_snprintf(pos, end - pos, "beacon_ie="); + if (os_snprintf_error(end - pos, ret)) + return 0; + pos += ret; + + ie = (const u8 *) (bss + 1); + ie += bss->ie_len; + for (i = 0; i < bss->beacon_ie_len; i++) { + ret = os_snprintf(pos, end - pos, "%02x", *ie++); + if (os_snprintf_error(end - pos, ret)) + return 0; + pos += ret; + } + + ret = os_snprintf(pos, end - pos, "\n"); + if (os_snprintf_error(end - pos, ret)) + return 0; + pos += ret; + } + if (mask & WPA_BSS_MASK_DELIM) { ret = os_snprintf(pos, end - pos, "====\n"); if (os_snprintf_error(end - pos, ret))