]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: Copy Roaming Consortium OI from (Re)AssocReq to Access-Request
authorJouni Malinen <jouni@codeaurora.org>
Tue, 17 Apr 2018 10:08:31 +0000 (13:08 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 17 Apr 2018 13:40:47 +0000 (16:40 +0300)
This extends hostapd processing of (Re)Association Request frames to
store a local copy of the Consortium OI within the Roaming Consortium
Selection element, if present, and then add that in HS 2.0 Roaming
Consortium attribute into RADIUS Access-Request messages.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/ap/drv_callbacks.c
src/ap/ieee802_11.c
src/ap/ieee802_1x.c
src/ap/sta_info.c
src/ap/sta_info.h
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h
src/common/ieee802_11_defs.h
src/radius/radius.h

index b9443ee242cf9e4f96e4a7444095638a5a6591c9..59299ad1bd2ecbf3ad3a58ec6012d9c0f046da10 100644 (file)
@@ -235,6 +235,14 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
                                                 elems.hs20_len - 4);
        } else
                sta->hs20_ie = NULL;
+
+       wpabuf_free(sta->roaming_consortium);
+       if (elems.roaming_cons_sel)
+               sta->roaming_consortium = wpabuf_alloc_copy(
+                       elems.roaming_cons_sel + 4,
+                       elems.roaming_cons_sel_len - 4);
+       else
+               sta->roaming_consortium = NULL;
 #endif /* CONFIG_HS20 */
 
 #ifdef CONFIG_FST
index bf94571cb72ea9a3ac823c96b690c5abb58612c1..68c0da24d0e16e10d2f483d370a57d81be778061 100644 (file)
@@ -2651,6 +2651,14 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
                                                 elems.hs20_len - 4);
        } else
                sta->hs20_ie = NULL;
+
+       wpabuf_free(sta->roaming_consortium);
+       if (elems.roaming_cons_sel)
+               sta->roaming_consortium = wpabuf_alloc_copy(
+                       elems.roaming_cons_sel + 4,
+                       elems.roaming_cons_sel_len - 4);
+       else
+               sta->roaming_consortium = NULL;
 #endif /* CONFIG_HS20 */
 
 #ifdef CONFIG_FST
index 98dc2bc5b6f9c23bf0a2a704be6249eee55df435..4fcccce72447bac987c98fcc111ba453f1d3e537 100644 (file)
@@ -712,6 +712,16 @@ void ieee802_1x_encapsulate_radius(struct hostapd_data *hapd,
                                goto fail;
                        }
                }
+
+               if (sta->roaming_consortium &&
+                   !radius_msg_add_wfa(
+                           msg, RADIUS_VENDOR_ATTR_WFA_HS20_ROAMING_CONSORTIUM,
+                           wpabuf_head(sta->roaming_consortium),
+                           wpabuf_len(sta->roaming_consortium))) {
+                       wpa_printf(MSG_ERROR,
+                                  "Could not add HS 2.0 Roaming Consortium");
+                       goto fail;
+               }
        }
 #endif /* CONFIG_HS20 */
 
index 154879c0651b722b4f8540ca2d18dcd54ef5f802..cb9be283276ca1665fda1bcd53a2347e5c44e6f8 100644 (file)
@@ -321,6 +321,7 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
        wpabuf_free(sta->wps_ie);
        wpabuf_free(sta->p2p_ie);
        wpabuf_free(sta->hs20_ie);
+       wpabuf_free(sta->roaming_consortium);
 #ifdef CONFIG_FST
        wpabuf_free(sta->mb_ies);
 #endif /* CONFIG_FST */
index fc7777bf9a6da310ff9efc168b246e2211e37a7e..896a2b54c77ae235275fdf09fa9c188e29d14646 100644 (file)
@@ -182,6 +182,8 @@ struct sta_info {
        struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
        struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */
        struct wpabuf *hs20_ie; /* HS 2.0 IE from (Re)Association Request */
+       /* Hotspot 2.0 Roaming Consortium from (Re)Association Request */
+       struct wpabuf *roaming_consortium;
        u8 remediation_method;
        char *remediation_url; /* HS 2.0 Subscription Remediation Server URL */
        struct wpabuf *hs20_deauth_req;
index f04e77fa5561c8b3f9a59745aa042b10a961deb7..d29c60188e5b8821a7cac5cb684bca1342078ece 100644 (file)
@@ -120,6 +120,11 @@ static int ieee802_11_parse_vendor_specific(const u8 *pos, size_t elen,
                        elems->mbo = pos;
                        elems->mbo_len = elen;
                        break;
+               case HS20_ROAMING_CONS_SEL_OUI_TYPE:
+                       /* Hotspot 2.0 Roaming Consortium Selection */
+                       elems->roaming_cons_sel = pos;
+                       elems->roaming_cons_sel_len = elen;
+                       break;
                default:
                        wpa_printf(MSG_MSGDUMP, "Unknown WFA "
                                   "information element ignored "
index 89ca92b7016bfb5c42e9cb444a67f66570443b35..bbb916b1f5b792b7a7bc266dc0c898f00eee3ca7 100644 (file)
@@ -80,6 +80,7 @@ struct ieee802_11_elems {
        const u8 *fils_nonce;
        const u8 *owe_dh;
        const u8 *power_capab;
+       const u8 *roaming_cons_sel;
 
        u8 ssid_len;
        u8 supp_rates_len;
@@ -124,6 +125,7 @@ struct ieee802_11_elems {
        u8 fils_pk_len;
        u8 owe_dh_len;
        u8 power_capab_len;
+       u8 roaming_cons_sel_len;
 
        struct mb_ies_info mb_ies;
 };
index 2bd585f21a232be8c8a10aa902ce06e52ec71740..45bbead39f50fc55dad066d18999cd786eef1ffe 100644 (file)
@@ -1317,6 +1317,7 @@ enum wmm_ac {
 #define HS20_INDICATION_OUI_TYPE 16
 #define HS20_ANQP_OUI_TYPE 17
 #define HS20_OSEN_OUI_TYPE 18
+#define HS20_ROAMING_CONS_SEL_OUI_TYPE 29
 #define HS20_STYPE_QUERY_LIST 1
 #define HS20_STYPE_CAPABILITY_LIST 2
 #define HS20_STYPE_OPERATOR_FRIENDLY_NAME 3
index a75922d4437d203608323dec993f9dd48275aa60..bed7f230eeb0cac91a790663a465b9b0d19159f5 100644 (file)
@@ -198,6 +198,7 @@ enum {
        RADIUS_VENDOR_ATTR_WFA_HS20_STA_VERSION = 3,
        RADIUS_VENDOR_ATTR_WFA_HS20_DEAUTH_REQ = 4,
        RADIUS_VENDOR_ATTR_WFA_HS20_SESSION_INFO_URL = 5,
+       RADIUS_VENDOR_ATTR_WFA_HS20_ROAMING_CONSORTIUM = 6,
 };
 
 #ifdef _MSC_VER