FILS: Make FILS Indication element information available in BSS output

This extends wpa_supplicant BSS command to parse FILS Indication
element.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2016-12-17 22:45:32 +02:00
parent 8183aee6cc
commit b54f43390e
2 changed files with 82 additions and 0 deletions

View file

@ -320,6 +320,7 @@ extern "C" {
#define WPA_BSS_MASK_FST BIT(21)
#define WPA_BSS_MASK_UPDATE_IDX BIT(22)
#define WPA_BSS_MASK_BEACON_IE BIT(23)
#define WPA_BSS_MASK_FILS_INDICATION BIT(24)
/* VENDOR_ELEM_* frame id values */

View file

@ -4101,6 +4101,78 @@ static char * anqp_add_hex(char *pos, char *end, const char *title,
#endif /* CONFIG_INTERWORKING */
#ifdef CONFIG_FILS
static int print_fils_indication(struct wpa_bss *bss, char *pos, char *end)
{
char *start = pos;
const u8 *ie, *ie_end;
u16 info, realms;
int ret;
ie = wpa_bss_get_ie(bss, WLAN_EID_FILS_INDICATION);
if (!ie)
return 0;
ie_end = ie + 2 + ie[1];
ie += 2;
if (ie_end - ie < 2)
return -1;
info = WPA_GET_LE16(ie);
ie += 2;
ret = os_snprintf(pos, end - pos, "fils_info=%04x\n", info);
if (os_snprintf_error(end - pos, ret))
return 0;
pos += ret;
if (info & BIT(7)) {
/* Cache Identifier Included */
if (ie_end - ie < 2)
return -1;
ret = os_snprintf(pos, end - pos, "fils_cache_id=%02x%02x\n",
ie[0], ie[1]);
if (os_snprintf_error(end - pos, ret))
return 0;
pos += ret;
ie += 2;
}
if (info & BIT(8)) {
/* HESSID Included */
if (ie_end - ie < ETH_ALEN)
return -1;
ret = os_snprintf(pos, end - pos, "fils_hessid=" MACSTR "\n",
MAC2STR(ie));
if (os_snprintf_error(end - pos, ret))
return 0;
pos += ret;
ie += ETH_ALEN;
}
realms = (info & (BIT(3) | BIT(4) | BIT(5))) >> 3;
if (realms) {
if (ie_end - ie < realms * 2)
return -1;
ret = os_snprintf(pos, end - pos, "fils_realms=");
if (os_snprintf_error(end - pos, ret))
return 0;
pos += ret;
ret = wpa_snprintf_hex(pos, end - pos, ie, realms * 2);
if (ret <= 0)
return 0;
pos += ret;
ie += realms * 2;
ret = os_snprintf(pos, end - pos, "\n");
if (os_snprintf_error(end - pos, ret))
return 0;
pos += ret;
}
return pos - start;
}
#endif /* CONFIG_FILS */
static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
unsigned long mask, char *buf, size_t buflen)
{
@ -4473,6 +4545,15 @@ static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
pos += ret;
}
#ifdef CONFIG_FILS
if (mask & WPA_BSS_MASK_FILS_INDICATION) {
ret = print_fils_indication(bss, pos, end);
if (ret < 0)
return 0;
pos += ret;
}
#endif /* CONFIG_FILS */
if (mask & WPA_BSS_MASK_DELIM) {
ret = os_snprintf(pos, end - pos, "====\n");
if (os_snprintf_error(end - pos, ret))