]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: Allow Hotspot 2.0 release number to be configured
authorJouni Malinen <jouni@codeaurora.org>
Fri, 7 Dec 2018 22:39:00 +0000 (00:39 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 8 Dec 2018 12:06:54 +0000 (14:06 +0200)
The new hostapd configuration parameter hs20_release can be used to
configure the AP to advertise a specific Hotspot 2.0 release number
instead of the latest supported release. This is mainly for testing
purposes.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
hostapd/config_file.c
src/ap/ap_config.c
src/ap/ap_config.h
src/ap/hs20.c
src/ap/ieee802_1x.c

index 1bc835ab26d653b286cf0ad851578b872471515c..0452b78725c4996e5afcee094e4287980386504e 100644 (file)
@@ -3717,6 +3717,16 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 #ifdef CONFIG_HS20
        } else if (os_strcmp(buf, "hs20") == 0) {
                bss->hs20 = atoi(pos);
+       } else if (os_strcmp(buf, "hs20_release") == 0) {
+               int val = atoi(pos);
+
+               if (val < 1 || val > (HS20_VERSION >> 4) + 1) {
+                       wpa_printf(MSG_ERROR,
+                                  "Line %d: Unsupported hs20_release: %s",
+                                  line, pos);
+                       return 1;
+               }
+               bss->hs20_release = val;
        } else if (os_strcmp(buf, "disable_dgaf") == 0) {
                bss->disable_dgaf = atoi(pos);
        } else if (os_strcmp(buf, "na_mcast_to_ucast") == 0) {
index e6b1f10f1c1a064f60c8d287b132fb341e5805b4..cf96eb4fd320eeacb832ec77a13d90ad779c2f73 100644 (file)
@@ -133,6 +133,10 @@ void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
        bss->tls_flags = TLS_CONN_DISABLE_TLSv1_3;
 
        bss->send_probe_response = 1;
+
+#ifdef CONFIG_HS20
+       bss->hs20_release = (HS20_VERSION >> 4) + 1;
+#endif /* CONFIG_HS20 */
 }
 
 
index bd440af94980805e6ab28903037e76c64d77eb5c..bd2b96791a71978b575a755debe87998a2578c88 100644 (file)
@@ -557,6 +557,7 @@ struct hostapd_bss_config {
        int na_mcast_to_ucast;
 #ifdef CONFIG_HS20
        int hs20;
+       int hs20_release;
        int disable_dgaf;
        u16 anqp_domain_id;
        unsigned int hs20_oper_friendly_name_count;
index e265569aef389808157929e5315f4357732789b1..b2114b35aca6cc7f4b9bcce47a9a46647b0881f8 100644 (file)
@@ -25,17 +25,20 @@ u8 * hostapd_eid_hs20_indication(struct hostapd_data *hapd, u8 *eid)
        if (!hapd->conf->hs20)
                return eid;
        *eid++ = WLAN_EID_VENDOR_SPECIFIC;
-       *eid++ = 7;
+       *eid++ = hapd->conf->hs20_release < 2 ? 5 : 7;
        WPA_PUT_BE24(eid, OUI_WFA);
        eid += 3;
        *eid++ = HS20_INDICATION_OUI_TYPE;
-       conf = HS20_VERSION; /* Release Number */
-       conf |= HS20_ANQP_DOMAIN_ID_PRESENT;
+       conf = (hapd->conf->hs20_release - 1) << 4; /* Release Number */
+       if (hapd->conf->hs20_release >= 2)
+               conf |= HS20_ANQP_DOMAIN_ID_PRESENT;
        if (hapd->conf->disable_dgaf)
                conf |= HS20_DGAF_DISABLED;
        *eid++ = conf;
-       WPA_PUT_LE16(eid, hapd->conf->anqp_domain_id);
-       eid += 2;
+       if (hapd->conf->hs20_release >= 2) {
+               WPA_PUT_LE16(eid, hapd->conf->anqp_domain_id);
+               eid += 2;
+       }
 
        return eid;
 }
index 185279f9e3ef1d7796d22140eb0a5e17c09b28c4..efcbe6f1a4e51a4b6920ff28b3bf123203f9e194 100644 (file)
@@ -682,9 +682,8 @@ void ieee802_1x_encapsulate_radius(struct hostapd_data *hapd,
 
 #ifdef CONFIG_HS20
        if (hapd->conf->hs20) {
-               u8 ver = 1; /* Release 2 */
-               if (HS20_VERSION > 0x10)
-                       ver = 2; /* Release 3 */
+               u8 ver = hapd->conf->hs20_release - 1;
+
                if (!radius_msg_add_wfa(
                            msg, RADIUS_VENDOR_ATTR_WFA_HS20_AP_VERSION,
                            &ver, 1)) {