]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: Add Roaming Consortium Selection network profile parameter
authorJouni Malinen <jouni@codeaurora.org>
Tue, 17 Apr 2018 14:12:22 +0000 (17:12 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 17 Apr 2018 14:26:56 +0000 (17:26 +0300)
This adds new roaming_consortium_selection network profile parameter
into wpa_supplicant. This is used to store the OI that was used for
network selection (INTERWORKING_SELECT) based on matching against the
Roaming Consortium OIs advertised by the AP. This can also be used when
using an external component to perform selection.

This commit adds the network profile parameter, but does not yet include
it in (Re)Association Request frames.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/README-HS20
wpa_supplicant/config.c
wpa_supplicant/config_file.c
wpa_supplicant/config_ssid.h
wpa_supplicant/interworking.c
wpa_supplicant/wpa_supplicant.conf

index 8d2bdbc85fb6d1e8ecb4d1a27a338b2ecfb14cd2..334287101c927fa7b76ac81a8e1ff2d31ddc1414 100644 (file)
@@ -606,7 +606,7 @@ network={
 Hotspot 2.0 connection with external network selection
 ------------------------------------------------------
 
-When an component controlling wpa_supplicant takes care of Interworking
+When a component controlling wpa_supplicant takes care of Interworking
 network selection, following configuration and network profile
 parameters can be used to configure a temporary network profile for a
 Hotspot 2.0 connection (e.g., with SET, ADD_NETWORK, SET_NETWORK, and
@@ -628,6 +628,7 @@ network={
     eap=TTLS
     phase2="auth=MSCHAPV2"
     update_identifier=54321
+    roaming_consortium_selection=112233
     #ocsp=2
 }
 
@@ -643,4 +644,5 @@ update_identifier: PPS/UpdateIdentifier
 ca_cert: from the downloaded trust root based on PPS information
 eap: Credential/UsernamePassword/EAPMethod or NAI Realm list
 phase2: Credential/UsernamePassword/EAPMethod or NAI Realm list
+roaming_consortium_selection: Matching OI from HomeSP/RoamingConsortiumOI
 ocsp: Credential/CheckAAAServerCertStatus
index 5247e90866d608d132b560e9ca5bb32d22627d16..f65bbb02f83d46450bee3aedac1c72a12f599893 100644 (file)
@@ -2289,6 +2289,7 @@ static const struct parse_data ssid_fields[] = {
 #endif /* CONFIG_MACSEC */
 #ifdef CONFIG_HS20
        { INT(update_identifier) },
+       { STR_RANGE(roaming_consortium_selection, 0, MAX_ROAMING_CONS_OI_LEN) },
 #endif /* CONFIG_HS20 */
        { INT_RANGE(mac_addr, 0, 2) },
        { INT_RANGE(pbss, 0, 2) },
@@ -2489,6 +2490,9 @@ void wpa_config_free_ssid(struct wpa_ssid *ssid)
 #ifdef CONFIG_MESH
        os_free(ssid->mesh_basic_rates);
 #endif /* CONFIG_MESH */
+#ifdef CONFIG_HS20
+       os_free(ssid->roaming_consortium_selection);
+#endif /* CONFIG_HS20 */
        os_free(ssid->dpp_connector);
        bin_clear_free(ssid->dpp_netaccesskey, ssid->dpp_netaccesskey_len);
        os_free(ssid->dpp_csign);
index e94a26f329e88cf688e9fd4318914ef3b3e9628c..985c371fa5cdbbe86dd9bdb69d3da0b8fa9030bf 100644 (file)
@@ -856,6 +856,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
 #endif /* CONFIG_MACSEC */
 #ifdef CONFIG_HS20
        INT(update_identifier);
+       STR(roaming_consortium_selection);
 #endif /* CONFIG_HS20 */
        write_int(f, "mac_addr", ssid->mac_addr, -1);
 #ifdef CONFIG_MESH
index 87a45c435268fdba67922fbeec9d999facd6dfff..9fd56c32f670d57bfc056e5d26a04cc861089f7f 100644 (file)
@@ -804,6 +804,19 @@ struct wpa_ssid {
 
 #ifdef CONFIG_HS20
        int update_identifier;
+
+       /**
+        * roaming_consortium_selection - Roaming Consortium Selection
+        *
+        * The matching Roaming Consortium OI that was used to generate this
+        * network profile.
+        */
+       u8 *roaming_consortium_selection;
+
+       /**
+        * roaming_consortium_selection_len - roaming_consortium_selection len
+        */
+       size_t roaming_consortium_selection_len;
 #endif /* CONFIG_HS20 */
 
        unsigned int wps_run;
index de01a0216fdb56be74177ffac8415c320aa4d96e..7976eef96c677b30759ca2ec4200cdcb69530785 100644 (file)
@@ -1555,6 +1555,9 @@ static int interworking_connect_roaming_consortium(
        struct wpa_bss *bss, int only_add)
 {
        struct wpa_ssid *ssid;
+       const u8 *ie;
+       const struct wpabuf *anqp;
+       unsigned int i;
 
        wpa_msg(wpa_s, MSG_DEBUG, "Interworking: Connect with " MACSTR
                " based on roaming consortium match", MAC2STR(bss->bssid));
@@ -1584,6 +1587,26 @@ static int interworking_connect_roaming_consortium(
        if (interworking_set_hs20_params(wpa_s, ssid) < 0)
                goto fail;
 
+       ie = wpa_bss_get_ie(bss, WLAN_EID_ROAMING_CONSORTIUM);
+       anqp = bss->anqp ? bss->anqp->roaming_consortium : NULL;
+       for (i = 0; (ie || anqp) && i < cred->num_roaming_consortiums; i++) {
+               if (!roaming_consortium_match(
+                           ie, anqp, cred->roaming_consortiums[i],
+                           cred->roaming_consortiums_len[i]))
+                       continue;
+
+               ssid->roaming_consortium_selection =
+                       os_malloc(cred->roaming_consortiums_len[i]);
+               if (!ssid->roaming_consortium_selection)
+                       goto fail;
+               os_memcpy(ssid->roaming_consortium_selection,
+                         cred->roaming_consortiums[i],
+                         cred->roaming_consortiums_len[i]);
+               ssid->roaming_consortium_selection_len =
+                       cred->roaming_consortiums_len[i];
+               break;
+       }
+
        if (cred->eap_method == NULL) {
                wpa_msg(wpa_s, MSG_DEBUG,
                        "Interworking: No EAP method set for credential using roaming consortium");
index 159537e7a91c083c74e3f6bc0d4b0727bc58739a..5c478b69630675962deeb8c2cb38618f5152f4a5 100644 (file)
@@ -1287,6 +1287,10 @@ fast_reauth=1
 
 # update_identifier: PPS MO ID
 #      (Hotspot 2.0 PerProviderSubscription/UpdateIdentifier)
+#
+# roaming_consortium_selection: Roaming Consortium Selection
+#      The matching Roaming Consortium OI that was used to generate this
+#      network profile.
 
 # Station inactivity limit
 #