]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: As a STA, do not indicate release number greater than the AP
authorJouni Malinen <jouni@codeaurora.org>
Fri, 7 Dec 2018 22:51:04 +0000 (00:51 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 8 Dec 2018 12:06:58 +0000 (14:06 +0200)
Hotspot 2.0 tech spec mandates mobile device to not indicate a release
number that is greater than the release number advertised by the AP. Add
this constraint to the HS 2.0 Indication element when adding this into
(Re)Association Request frame. The element in the Probe Request frame
continues to show the station's latest supported release number.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/hs20_supplicant.c
wpa_supplicant/hs20_supplicant.h
wpa_supplicant/scan.c
wpa_supplicant/sme.c
wpa_supplicant/wpa_supplicant.c

index f4187900ed42d418c257be6618233d064067e72c..030b5aa9985a163f8683f4d5169eca8ecc0b40b4 100644 (file)
@@ -104,15 +104,22 @@ void hs20_configure_frame_filters(struct wpa_supplicant *wpa_s)
 }
 
 
-void wpas_hs20_add_indication(struct wpabuf *buf, int pps_mo_id)
+void wpas_hs20_add_indication(struct wpabuf *buf, int pps_mo_id, int ap_release)
 {
+       int release;
        u8 conf;
 
+       release = (HS20_VERSION >> 4) + 1;
+       if (ap_release > 0 && release > ap_release)
+               release = ap_release;
+       if (release < 2)
+               pps_mo_id = -1;
+
        wpabuf_put_u8(buf, WLAN_EID_VENDOR_SPECIFIC);
        wpabuf_put_u8(buf, pps_mo_id >= 0 ? 7 : 5);
        wpabuf_put_be24(buf, OUI_WFA);
        wpabuf_put_u8(buf, HS20_INDICATION_OUI_TYPE);
-       conf = HS20_VERSION;
+       conf = (release - 1) << 4;
        if (pps_mo_id >= 0)
                conf |= HS20_PPS_MO_ID_PRESENT;
        wpabuf_put_u8(buf, conf);
@@ -137,6 +144,21 @@ void wpas_hs20_add_roam_cons_sel(struct wpabuf *buf,
 }
 
 
+int get_hs20_version(struct wpa_bss *bss)
+{
+       const u8 *ie;
+
+       if (!bss)
+               return 0;
+
+       ie = wpa_bss_get_vendor_ie(bss, HS20_IE_VENDOR_TYPE);
+       if (!ie || ie[1] < 5)
+               return 0;
+
+       return ((ie[6] >> 4) & 0x0f) + 1;
+}
+
+
 int is_hs20_network(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
                    struct wpa_bss *bss)
 {
index 66fc540be3e4ff852d7ff6bfd0b6ab4a19a2c3ab..e43414bc65c55eb35f7d6956692a23e850725ff7 100644 (file)
@@ -9,7 +9,8 @@
 #define HS20_SUPPLICANT_H
 
 void hs20_configure_frame_filters(struct wpa_supplicant *wpa_s);
-void wpas_hs20_add_indication(struct wpabuf *buf, int pps_mo_id);
+void wpas_hs20_add_indication(struct wpabuf *buf, int pps_mo_id,
+                             int ap_release);
 void wpas_hs20_add_roam_cons_sel(struct wpabuf *buf,
                                 const struct wpa_ssid *ssid);
 
@@ -20,6 +21,7 @@ void hs20_put_anqp_req(u32 stypes, const u8 *payload, size_t payload_len,
 void hs20_parse_rx_hs20_anqp_resp(struct wpa_supplicant *wpa_s,
                                  struct wpa_bss *bss, const u8 *sa,
                                  const u8 *data, size_t slen, u8 dialog_token);
+int get_hs20_version(struct wpa_bss *bss);
 int is_hs20_network(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
                    struct wpa_bss *bss);
 int hs20_get_pps_mo_id(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
index ee39e0c9228d16e99897f14a23430c56205568cc..be328dedb7ad69cdce6920e11b9b3f6e95c2ecf2 100644 (file)
@@ -582,7 +582,7 @@ static struct wpabuf * wpa_supplicant_extra_ies(struct wpa_supplicant *wpa_s)
 
 #ifdef CONFIG_HS20
        if (wpa_s->conf->hs20 && wpabuf_resize(&extra_ie, 7) == 0)
-               wpas_hs20_add_indication(extra_ie, -1);
+               wpas_hs20_add_indication(extra_ie, -1, 0);
 #endif /* CONFIG_HS20 */
 
 #ifdef CONFIG_FST
index f77f75177ef261d38017668b380bf222bf18f180..becc4fa2837a4bca8fdb8d49808716eb25d87d7a 100644 (file)
@@ -550,7 +550,8 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
                        int pps_mo_id = hs20_get_pps_mo_id(wpa_s, ssid);
                        size_t len;
 
-                       wpas_hs20_add_indication(hs20, pps_mo_id);
+                       wpas_hs20_add_indication(hs20, pps_mo_id,
+                                                get_hs20_version(bss));
                        wpas_hs20_add_roam_cons_sel(hs20, ssid);
                        len = sizeof(wpa_s->sme.assoc_req_ie) -
                                wpa_s->sme.assoc_req_ie_len;
index e587d7e3cd69bd11aec1cba71b85e11cd9255e9c..59fb47c955962f1a7e6742fcaa49b7bff7d77837 100644 (file)
@@ -2678,7 +2678,8 @@ static u8 * wpas_populate_assoc_ies(
                        int pps_mo_id = hs20_get_pps_mo_id(wpa_s, ssid);
                        size_t len;
 
-                       wpas_hs20_add_indication(hs20, pps_mo_id);
+                       wpas_hs20_add_indication(hs20, pps_mo_id,
+                                                get_hs20_version(bss));
                        wpas_hs20_add_roam_cons_sel(hs20, ssid);
                        len = max_wpa_ie_len - wpa_ie_len;
                        if (wpabuf_len(hs20) <= len) {