]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Indicate whether additional ANQP elements were protected
authorJouni Malinen <jouni@codeaurora.org>
Mon, 23 Nov 2020 18:32:26 +0000 (20:32 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 23 Nov 2020 18:32:26 +0000 (20:32 +0200)
Store information on whether extra ANQP elements were received using the
protection alternative (protected GAS during an association using PMF)
and make this available through the control interface BSS command.

For example:
anqp[277]=<hexdump>
protected-anqp-info[277]=1

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/bss.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/interworking.c

index c68a3e5763efe4aae7592a0275a0e7c49d592225..7cb1745dbbeed7a6d814cd5efc44d7d3ec55d8b2 100644 (file)
@@ -23,6 +23,7 @@ struct wpa_scan_res;
 struct wpa_bss_anqp_elem {
        struct dl_list list;
        u16 infoid;
+       bool protected; /* received in a protected GAS response */
        struct wpabuf *payload;
 };
 
index 1f91723321eb0a88261e7ed42649896a43c8853a..8306950a57ae03ba5e33ce3fdddf40ebc96a8b67 100644 (file)
@@ -5285,6 +5285,14 @@ static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
                        os_snprintf(title, sizeof(title), "anqp[%u]",
                                    elem->infoid);
                        pos = anqp_add_hex(pos, end, title, elem->payload);
+                       if (elem->protected) {
+                               ret = os_snprintf(pos, end - pos,
+                                                 "protected-anqp-info[%u]=1\n",
+                                                 elem->infoid);
+                               if (os_snprintf_error(end - pos, ret))
+                                       return 0;
+                               pos += ret;
+                       }
                }
        }
 #endif /* CONFIG_INTERWORKING */
index ce11491b96ddfb5b11e56729bc9b249c029860f2..5f9d1dced2d2727240570d15eb3d7eefd033d188 100644 (file)
@@ -2831,7 +2831,7 @@ int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst, int freq,
 
 static void anqp_add_extra(struct wpa_supplicant *wpa_s,
                           struct wpa_bss_anqp *anqp, u16 info_id,
-                          const u8 *data, size_t slen)
+                          const u8 *data, size_t slen, bool protected)
 {
        struct wpa_bss_anqp_elem *tmp, *elem = NULL;
 
@@ -2856,6 +2856,7 @@ static void anqp_add_extra(struct wpa_supplicant *wpa_s,
                wpabuf_free(elem->payload);
        }
 
+       elem->protected = protected;
        elem->payload = wpabuf_alloc_copy(data, slen);
        if (!elem->payload) {
                dl_list_del(&elem->list);
@@ -2898,6 +2899,7 @@ static void interworking_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
        const u8 *pos = data;
        struct wpa_bss_anqp *anqp = NULL;
        u8 type;
+       bool protected;
 
        if (bss)
                anqp = bss->anqp;
@@ -2998,9 +3000,10 @@ static void interworking_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
        case ANQP_VENUE_URL:
                wpa_msg(wpa_s, MSG_INFO, RX_ANQP MACSTR " Venue URL",
                        MAC2STR(sa));
-               anqp_add_extra(wpa_s, anqp, info_id, pos, slen);
+               protected = pmf_in_use(wpa_s, sa);
+               anqp_add_extra(wpa_s, anqp, info_id, pos, slen, protected);
 
-               if (!pmf_in_use(wpa_s, sa)) {
+               if (!protected) {
                        wpa_printf(MSG_DEBUG,
                                   "ANQP: Ignore Venue URL since PMF was not enabled");
                        break;
@@ -3052,7 +3055,8 @@ static void interworking_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
        default:
                wpa_msg(wpa_s, MSG_DEBUG,
                        "Interworking: Unsupported ANQP Info ID %u", info_id);
-               anqp_add_extra(wpa_s, anqp, info_id, data, slen);
+               anqp_add_extra(wpa_s, anqp, info_id, data, slen,
+                              pmf_in_use(wpa_s, sa));
                break;
        }
 }