mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
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:
parent
8183aee6cc
commit
b54f43390e
@ -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 */
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user