]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
FILS: Make FILS Indication element information available in BSS output
authorJouni Malinen <j@w1.fi>
Sat, 17 Dec 2016 20:45:32 +0000 (22:45 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 18 Dec 2016 09:41:59 +0000 (11:41 +0200)
This extends wpa_supplicant BSS command to parse FILS Indication
element.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/common/wpa_ctrl.h
wpa_supplicant/ctrl_iface.c

index ae31ef36ac83d8854368090435ee58673e62aa61..4420b5860169261030e0da4f35a5272173949b47 100644 (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 */
index cd10fa84c235d2ddac9160261007cea86975a3a0..c943deeedc545f8176efbc0b2cc74a568e945f3f 100644 (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))