]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: Process received Terms and Conditions Acceptance notification
authorJouni Malinen <jouni@codeaurora.org>
Mon, 23 Apr 2018 21:17:47 +0000 (00:17 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 23 Apr 2018 21:35:47 +0000 (00:35 +0300)
Extend wpa_supplicant WNM-Notification RX handling to parse and process
received Terms and Conditions Acceptance notifications. If PMF is
enabled for the association, this frame results in control interface
indication (HS20-T-C-ACCEPTANCE <URL>) to get upper layers to guide the
user through the required acceptance steps.

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

index cc481a1cda7c46d128e9d8297417f8724d03d16b..a9da1cd80bd21861fb7460ae7d77557b185f4ef5 100644 (file)
@@ -274,6 +274,7 @@ extern "C" {
 
 #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 "
 
 #define EXT_RADIO_WORK_START "EXT-RADIO-WORK-START "
 #define EXT_RADIO_WORK_TIMEOUT "EXT-RADIO-WORK-TIMEOUT "
index 70ba528ece7e9962a00d282ac580db9e745e4dc2..b02923964d594cc00308689bb4d455a0f3e60265 100644 (file)
@@ -1232,6 +1232,18 @@ void hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s, u8 code,
 }
 
 
+void hs20_rx_t_c_acceptance(struct wpa_supplicant *wpa_s, const char *url)
+{
+       if (!wpa_sm_pmf_enabled(wpa_s->wpa)) {
+               wpa_printf(MSG_DEBUG,
+                          "HS 2.0: Ignore Terms and Conditions Acceptance since PMF was not enabled");
+               return;
+       }
+
+       wpa_msg(wpa_s, MSG_INFO, HS20_T_C_ACCEPTANCE "%s", url);
+}
+
+
 void hs20_init(struct wpa_supplicant *wpa_s)
 {
        dl_list_init(&wpa_s->icon_head);
index e3bbb1ebdfc6ddff4327ee13d87ba0ce461fcc86..66fc540be3e4ff852d7ff6bfd0b6ab4a19a2c3ab 100644 (file)
@@ -29,6 +29,7 @@ void hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
                                      const char *url, u8 osu_method);
 void hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s, u8 code,
                                    u16 reauth_delay, const char *url);
+void hs20_rx_t_c_acceptance(struct wpa_supplicant *wpa_s, const char *url);
 
 void hs20_free_osu_prov(struct wpa_supplicant *wpa_s);
 void hs20_next_osu_icon(struct wpa_supplicant *wpa_s);
index 28346ea966c2c54c69a7c71c37eda26a9549e6aa..7c410e7301429de040094ab8fb8f079959ff8a62 100644 (file)
@@ -1644,6 +1644,32 @@ static void ieee802_11_rx_wnm_notif_req_wfa(struct wpa_supplicant *wpa_s,
                        pos = next;
                        continue;
                }
+
+               if (ie == WLAN_EID_VENDOR_SPECIFIC && ie_len >= 5 &&
+                   WPA_GET_BE24(pos) == OUI_WFA &&
+                   pos[3] == HS20_WNM_T_C_ACCEPTANCE) {
+                       const u8 *ie_end;
+                       u8 url_len;
+                       char *url;
+
+                       ie_end = pos + ie_len;
+                       pos += 4;
+                       url_len = *pos++;
+                       wpa_printf(MSG_DEBUG,
+                                  "WNM: HS 2.0 Terms and Conditions Acceptance (URL Length %u)",
+                                  url_len);
+                       if (url_len > ie_end - pos)
+                               break;
+                       url = os_malloc(url_len + 1);
+                       if (!url)
+                               break;
+                       os_memcpy(url, pos, url_len);
+                       url[url_len] = '\0';
+                       hs20_rx_t_c_acceptance(wpa_s, url);
+                       os_free(url);
+                       pos = next;
+                       continue;
+               }
 #endif /* CONFIG_HS20 */
 
                pos = next;