]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ANQP: Parse and report Venue URL information
authorJouni Malinen <jouni@codeaurora.org>
Wed, 12 Sep 2018 22:56:37 +0000 (01:56 +0300)
committerJouni Malinen <jouni@codeaurora.org>
Sat, 15 Sep 2018 02:17:49 +0000 (05:17 +0300)
Parse the Venue URL ANQP-element payload and report it with the new
RX-VENUE-URL event messages if the query was done using PMF.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/wpa_ctrl.h
wpa_supplicant/interworking.c

index 4eb7356fbd6fe203c0886e258bcc9b21f658d6b4..4ee6400dabbbfc08db1dc92b39f3d07f29fd5cc4 100644 (file)
@@ -275,6 +275,9 @@ extern "C" {
 #define RX_HS20_ICON "RX-HS20-ICON "
 #define RX_MBO_ANQP "RX-MBO-ANQP "
 
+/* parameters: <Venue Number> <Venue URL> */
+#define RX_VENUE_URL "RX-VENUE-URL "
+
 #define HS20_SUBSCRIPTION_REMEDIATION "HS20-SUBSCRIPTION-REMEDIATION "
 #define HS20_DEAUTH_IMMINENT_NOTICE "HS20-DEAUTH-IMMINENT-NOTICE "
 #define HS20_T_C_ACCEPTANCE "HS20-T-C-ACCEPTANCE "
index 7976eef96c677b30759ca2ec4200cdcb69530785..f3f88d3916fb4cce5ab05c427a2092afc7003c7a 100644 (file)
@@ -2844,6 +2844,31 @@ static void anqp_add_extra(struct wpa_supplicant *wpa_s,
 }
 
 
+static void interworking_parse_venue_url(struct wpa_supplicant *wpa_s,
+                                        const u8 *data, size_t len)
+{
+       const u8 *pos = data, *end = data + len;
+       char url[255];
+
+       while (end - pos >= 2) {
+               u8 slen, num;
+
+               slen = *pos++;
+               if (slen < 1 || slen > end - pos) {
+                       wpa_printf(MSG_DEBUG,
+                                  "ANQP: Truncated Venue URL Duple field");
+                       return;
+               }
+
+               num = *pos++;
+               os_memcpy(url, pos, slen - 1);
+               url[slen - 1] = '\0';
+               wpa_msg(wpa_s, MSG_INFO, RX_VENUE_URL "%u %s", num, url);
+               pos += slen - 1;
+       }
+}
+
+
 static void interworking_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
                                            struct wpa_bss *bss, const u8 *sa,
                                            u16 info_id,
@@ -2950,6 +2975,18 @@ static void interworking_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
                }
                break;
 #endif /* CONFIG_FILS */
+       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);
+
+               if (!wpa_sm_pmf_enabled(wpa_s->wpa)) {
+                       wpa_printf(MSG_DEBUG,
+                                  "ANQP: Ignore Venue URL since PMF was not enabled");
+                       break;
+               }
+               interworking_parse_venue_url(wpa_s, pos, slen);
+               break;
        case ANQP_VENDOR_SPECIFIC:
                if (slen < 3)
                        return;