]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
GAS server: Add support for ANQP Roaming Consortium list
authorJouni Malinen <jouni@qca.qualcomm.com>
Sun, 26 Feb 2012 20:34:19 +0000 (22:34 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 26 Feb 2012 20:53:16 +0000 (22:53 +0200)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/ap/gas_serv.c
src/ap/gas_serv.h

index 3cda29d6196bdc99ae026cb6fedaa84c5f8b57b4..187513ad6ac374e6861f7a9e7e49bd7127162248 100644 (file)
@@ -135,6 +135,25 @@ static void anqp_add_capab_list(struct hostapd_data *hapd,
 
        len = gas_anqp_add_element(buf, ANQP_CAPABILITY_LIST);
        wpabuf_put_le16(buf, ANQP_CAPABILITY_LIST);
+       if (hapd->conf->roaming_consortium)
+               wpabuf_put_le16(buf, ANQP_ROAMING_CONSORTIUM);
+       gas_anqp_set_element_len(buf, len);
+}
+
+
+static void anqp_add_roaming_consortium(struct hostapd_data *hapd,
+                                       struct wpabuf *buf)
+{
+       unsigned int i;
+       u8 *len;
+
+       len = gas_anqp_add_element(buf, ANQP_ROAMING_CONSORTIUM);
+       for (i = 0; i < hapd->conf->roaming_consortium_count; i++) {
+               struct hostapd_roaming_consortium *rc;
+               rc = &hapd->conf->roaming_consortium[i];
+               wpabuf_put_u8(buf, rc->len);
+               wpabuf_put_data(buf, rc->oi, rc->len);
+       }
        gas_anqp_set_element_len(buf, len);
 }
 
@@ -152,6 +171,8 @@ gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
 
        if (request & ANQP_REQ_CAPABILITY_LIST)
                anqp_add_capab_list(hapd, buf);
+       if (request & ANQP_REQ_ROAMING_CONSORTIUM)
+               anqp_add_roaming_consortium(hapd, buf);
 
        return buf;
 }
@@ -203,6 +224,10 @@ static void rx_anqp_query_list_id(struct hostapd_data *hapd, u16 info_id,
                set_anqp_req(ANQP_REQ_CAPABILITY_LIST, "Capability List", 1, 0,
                             0, qi);
                break;
+       case ANQP_ROAMING_CONSORTIUM:
+               set_anqp_req(ANQP_REQ_ROAMING_CONSORTIUM, "Roaming Consortium",
+                            hapd->conf->roaming_consortium != NULL, 0, 0, qi);
+               break;
        default:
                wpa_printf(MSG_DEBUG, "ANQP: Unsupported Info Id %u",
                           info_id);
index 9ecdbb0d14b53316e83106e819a8a03500eb3ee4..7116e792235ed4a85c7e4e9982ea26458c6a8ccd 100644 (file)
@@ -11,6 +11,8 @@
 
 #define ANQP_REQ_CAPABILITY_LIST \
        (1 << (ANQP_CAPABILITY_LIST - ANQP_QUERY_LIST))
+#define ANQP_REQ_ROAMING_CONSORTIUM \
+       (1 << (ANQP_ROAMING_CONSORTIUM - ANQP_QUERY_LIST))
 
 /* To account for latencies between hostapd and external ANQP processor */
 #define GAS_SERV_COMEBACK_DELAY_FUDGE 10