Lines Matching +full:sd +full:- +full:hs
3 * Copyright (c) 2011-2014, Qualcomm Atheros, Inc.
67 sta->flags |= WLAN_STA_GAS;
74 hapd->conf->gas_comeback_delay / 1024 +
80 if (sta->gas_dialog == NULL) {
81 sta->gas_dialog = os_calloc(GAS_DIALOG_MAX,
83 if (sta->gas_dialog == NULL)
87 for (i = sta->gas_dialog_next, j = 0; j < GAS_DIALOG_MAX; i++, j++) {
90 if (sta->gas_dialog[i].valid)
92 dia = &sta->gas_dialog[i];
93 dia->valid = 1;
94 dia->dialog_token = dialog_token;
95 sta->gas_dialog_next = (++i == GAS_DIALOG_MAX) ? 0 : i;
99 wpa_msg(hapd->msg_ctx, MSG_ERROR, "ANQP: Could not create dialog for "
120 for (i = 0; sta->gas_dialog && i < GAS_DIALOG_MAX; i++) {
121 if (sta->gas_dialog[i].dialog_token != dialog_token ||
122 !sta->gas_dialog[i].valid)
125 return &sta->gas_dialog[i];
135 wpabuf_free(dia->sd_resp);
147 if (sta == NULL || sta->gas_dialog == NULL)
151 if (sta->gas_dialog[i].valid)
155 os_free(sta->gas_dialog);
156 sta->gas_dialog = NULL;
172 if (hapd->conf->hs20_oper_friendly_name)
174 if (hapd->conf->hs20_wan_metrics)
176 if (hapd->conf->hs20_connection_capability)
178 if (hapd->conf->nai_realm_data)
180 if (hapd->conf->hs20_operating_class)
182 if (hapd->conf->hs20_osu_providers_count)
184 if (hapd->conf->hs20_osu_providers_nai_count)
186 if (hapd->conf->hs20_icons_count)
188 if (hapd->conf->hs20_operator_icon_count)
200 dl_list_for_each(elem, &hapd->conf->anqp_elem, struct anqp_element,
202 if (elem->infoid == infoid)
218 if (wpabuf_tailroom(buf) < 2 + 2 + wpabuf_len(elem->payload)) {
225 wpabuf_put_le16(buf, wpabuf_len(elem->payload));
226 wpabuf_put_buf(buf, elem->payload);
253 if (hapd->conf->venue_name || get_anqp_elem(hapd, ANQP_VENUE_NAME))
257 if (hapd->conf->network_auth_type ||
260 if (hapd->conf->roaming_consortium ||
263 if (hapd->conf->ipaddr_type_configured ||
266 if (hapd->conf->nai_realm_data ||
269 if (hapd->conf->anqp_3gpp_cell_net ||
278 if (hapd->conf->domain_name || get_anqp_elem(hapd, ANQP_DOMAIN_NAME))
289 if (!dl_list_empty(&hapd->conf->fils_realms) ||
295 if (hapd->conf->venue_url || get_anqp_elem(hapd, ANQP_VENUE_URL))
317 if (hapd->conf->venue_name) {
321 wpabuf_put_u8(buf, hapd->conf->venue_group);
322 wpabuf_put_u8(buf, hapd->conf->venue_type);
323 for (i = 0; i < hapd->conf->venue_name_count; i++) {
325 vn = &hapd->conf->venue_name[i];
326 wpabuf_put_u8(buf, 3 + vn->name_len);
327 wpabuf_put_data(buf, vn->lang, 3);
328 wpabuf_put_data(buf, vn->name, vn->name_len);
340 if (hapd->conf->venue_url) {
345 for (i = 0; i < hapd->conf->venue_url_count; i++) {
348 url = &hapd->conf->venue_url[i];
349 wpabuf_put_u8(buf, 1 + url->url_len);
350 wpabuf_put_u8(buf, url->venue_number);
351 wpabuf_put_data(buf, url->url, url->url_len);
364 if (hapd->conf->network_auth_type) {
366 wpabuf_put_le16(buf, hapd->conf->network_auth_type_len);
367 wpabuf_put_data(buf, hapd->conf->network_auth_type,
368 hapd->conf->network_auth_type_len);
383 for (i = 0; i < hapd->conf->roaming_consortium_count; i++) {
385 rc = &hapd->conf->roaming_consortium[i];
386 wpabuf_put_u8(buf, rc->len);
387 wpabuf_put_data(buf, rc->oi, rc->len);
399 if (hapd->conf->ipaddr_type_configured) {
402 wpabuf_put_u8(buf, hapd->conf->ipaddr_type_availability);
412 wpabuf_put_u8(buf, realm->eap_method_count);
414 for (i = 0; i < realm->eap_method_count; i++) {
415 struct hostapd_nai_realm_eap *eap = &realm->eap_method[i];
416 wpabuf_put_u8(buf, 2 + (3 * eap->num_auths));
417 wpabuf_put_u8(buf, eap->eap_method);
418 wpabuf_put_u8(buf, eap->num_auths);
419 for (j = 0; j < eap->num_auths; j++) {
420 wpabuf_put_u8(buf, eap->auth_id[j]);
422 wpabuf_put_u8(buf, eap->auth_val[j]);
434 wpa_printf(MSG_DEBUG, "realm=%s, len=%d", realm->realm[realm_idx],
435 (int) os_strlen(realm->realm[realm_idx]));
437 wpabuf_put_u8(buf, realm->encoding);
438 wpabuf_put_u8(buf, os_strlen(realm->realm[realm_idx]));
439 wpabuf_put_str(buf, realm->realm[realm_idx]);
461 if (end - pos < 1) {
464 return -1;
469 if (end - pos < 2) {
473 return -1;
477 if (realm_len > end - pos) {
481 return -1;
484 for (j = 0; j < hapd->conf->nai_realm_count &&
487 realm = &hapd->conf->nai_realm_data[j];
488 if (encoding != realm->encoding)
500 realm->realm[k] &&
502 if ((int) os_strlen(realm->realm[k]) !=
503 rend - rpos ||
505 realm->realm[k],
506 rend - rpos) != 0)
531 realm = &hapd->conf->nai_realm_data[matches[i].realm_data_idx];
547 if (nai_realm && hapd->conf->nai_realm_data) {
551 wpabuf_put_le16(buf, hapd->conf->nai_realm_count);
552 for (i = 0; i < hapd->conf->nai_realm_count; i++) {
556 realm = &hapd->conf->nai_realm_data[i];
558 wpabuf_put_u8(buf, realm->encoding);
560 for (j = 0; realm->realm[j]; j++) {
563 wpabuf_put_str(buf, realm->realm[j]);
565 *realm_len = (u8 *) wpabuf_put(buf, 0) - realm_len - 1;
570 } else if (nai_home_realm && hapd->conf->nai_realm_data && home_realm) {
583 if (hapd->conf->anqp_3gpp_cell_net) {
586 hapd->conf->anqp_3gpp_cell_net_len);
587 wpabuf_put_data(buf, hapd->conf->anqp_3gpp_cell_net,
588 hapd->conf->anqp_3gpp_cell_net_len);
598 if (hapd->conf->domain_name) {
600 wpabuf_put_le16(buf, hapd->conf->domain_name_len);
601 wpabuf_put_data(buf, hapd->conf->domain_name,
602 hapd->conf->domain_name_len);
616 count = dl_list_len(&hapd->conf->fils_realms);
625 dl_list_for_each(realm, &hapd->conf->fils_realms,
629 wpabuf_put_data(buf, realm->hash, 2);
630 count--;
642 if (hapd->conf->hs20_oper_friendly_name) {
650 for (i = 0; i < hapd->conf->hs20_oper_friendly_name_count; i++)
653 vn = &hapd->conf->hs20_oper_friendly_name[i];
654 wpabuf_put_u8(buf, 3 + vn->name_len);
655 wpabuf_put_data(buf, vn->lang, 3);
656 wpabuf_put_data(buf, vn->name, vn->name_len);
666 if (hapd->conf->hs20_wan_metrics) {
672 wpabuf_put_data(buf, hapd->conf->hs20_wan_metrics, 13);
681 if (hapd->conf->hs20_connection_capability) {
687 wpabuf_put_data(buf, hapd->conf->hs20_connection_capability,
688 hapd->conf->hs20_connection_capability_len);
697 if (hapd->conf->hs20_operating_class) {
703 wpabuf_put_data(buf, hapd->conf->hs20_operating_class,
704 hapd->conf->hs20_operating_class_len);
716 for (j = 0; j < bss->hs20_icons_count && !icon; j++) {
717 if (os_strcmp(name, bss->hs20_icons[j].name) == 0)
718 icon = &bss->hs20_icons[j];
723 wpabuf_put_le16(buf, icon->width);
724 wpabuf_put_le16(buf, icon->height);
725 wpabuf_put_data(buf, icon->language, 3);
726 wpabuf_put_u8(buf, os_strlen(icon->type));
727 wpabuf_put_str(buf, icon->type);
728 wpabuf_put_u8(buf, os_strlen(icon->name));
729 wpabuf_put_str(buf, icon->name);
744 for (i = 0; i < p->friendly_name_count; i++) {
745 struct hostapd_lang_string *s = &p->friendly_name[i];
746 wpabuf_put_u8(buf, 3 + s->name_len);
747 wpabuf_put_data(buf, s->lang, 3);
748 wpabuf_put_data(buf, s->name, s->name_len);
750 WPA_PUT_LE16(len2, (u8 *) wpabuf_put(buf, 0) - len2 - 2);
753 if (p->server_uri) {
754 wpabuf_put_u8(buf, os_strlen(p->server_uri));
755 wpabuf_put_str(buf, p->server_uri);
761 for (i = 0; p->method_list && p->method_list[i] >= 0; i++)
762 wpabuf_put_u8(buf, p->method_list[i]);
767 for (i = 0; i < p->icons_count; i++)
768 anqp_add_icon(buf, bss, p->icons[i]);
769 WPA_PUT_LE16(len2, (u8 *) wpabuf_put(buf, 0) - len2 - 2);
772 if (p->osu_nai) {
773 wpabuf_put_u8(buf, os_strlen(p->osu_nai));
774 wpabuf_put_str(buf, p->osu_nai);
780 for (i = 0; i < p->service_desc_count; i++) {
781 struct hostapd_lang_string *s = &p->service_desc[i];
782 wpabuf_put_u8(buf, 3 + s->name_len);
783 wpabuf_put_data(buf, s->lang, 3);
784 wpabuf_put_data(buf, s->name, s->name_len);
786 WPA_PUT_LE16(len2, (u8 *) wpabuf_put(buf, 0) - len2 - 2);
788 WPA_PUT_LE16(len, (u8 *) wpabuf_put(buf, 0) - len - 2);
795 if (hapd->conf->hs20_osu_providers_count) {
804 wpabuf_put_u8(buf, hapd->conf->osu_ssid_len);
805 wpabuf_put_data(buf, hapd->conf->osu_ssid,
806 hapd->conf->osu_ssid_len);
809 wpabuf_put_u8(buf, hapd->conf->hs20_osu_providers_count);
811 for (i = 0; i < hapd->conf->hs20_osu_providers_count; i++) {
813 buf, hapd->conf,
814 &hapd->conf->hs20_osu_providers[i]);
826 if (p->osu_nai2) {
827 wpabuf_put_u8(buf, os_strlen(p->osu_nai2));
828 wpabuf_put_str(buf, p->osu_nai2);
838 if (hapd->conf->hs20_osu_providers_nai_count) {
846 for (i = 0; i < hapd->conf->hs20_osu_providers_count; i++) {
848 buf, &hapd->conf->hs20_osu_providers[i]);
864 wpa_hexdump_ascii(MSG_DEBUG, "HS 2.0: Requested Icon Filename",
866 for (i = 0; i < hapd->conf->hs20_icons_count; i++) {
867 icon = &hapd->conf->hs20_icons[i];
868 if (name_len == os_strlen(icon->name) &&
869 os_memcmp(name, icon->name, name_len) == 0)
873 if (i < hapd->conf->hs20_icons_count)
874 icon = &hapd->conf->hs20_icons[i];
888 data = os_readfile(icon->file, &data_len);
896 wpabuf_put_u8(buf, os_strlen(icon->type));
897 wpabuf_put_str(buf, icon->type);
915 struct hostapd_bss_config *bss = hapd->conf;
919 if (!bss->hs20_operator_icon_count)
929 for (i = 0; i < bss->hs20_operator_icon_count; i++)
930 anqp_add_icon(buf, bss, bss->hs20_operator_icon[i]);
942 if (hapd->conf->mbo_cell_data_conn_pref >= 0) {
947 wpabuf_put_u8(buf, hapd->conf->mbo_cell_data_conn_pref);
965 len += 2 + 2 + wpabuf_len(elem->payload);
991 len += 2 * dl_list_len(&hapd->conf->fils_realms);
1093 qi->request |= bit;
1112 hapd->conf->venue_name != NULL, qi);
1121 hapd->conf->network_auth_type != NULL, qi);
1125 hapd->conf->roaming_consortium != NULL, qi);
1130 hapd->conf->ipaddr_type_configured, qi);
1134 hapd->conf->nai_realm_data != NULL, qi);
1139 hapd->conf->anqp_3gpp_cell_net != NULL, qi);
1158 hapd->conf->domain_name != NULL, qi);
1178 !dl_list_empty(&hapd->conf->fils_realms)) {
1183 if (info_id == ANQP_VENUE_URL && hapd->conf->venue_url) {
1191 if (qi->num_extra_req == ANQP_MAX_EXTRA_REQ) {
1193 "ANQP: No more room for extra requests - ignore Info Id %u",
1198 qi->extra_req[qi->num_extra_req] = info_id;
1199 qi->num_extra_req++;
1210 (unsigned int) (end - pos) / 2);
1212 while (end - pos >= 2) {
1226 set_anqp_req(ANQP_REQ_HS_CAPABILITY_LIST, "HS Capability List",
1232 hapd->conf->hs20_oper_friendly_name != NULL, qi);
1236 hapd->conf->hs20_wan_metrics != NULL, qi);
1241 hapd->conf->hs20_connection_capability != NULL,
1246 hapd->conf->hs20_operating_class != NULL, qi);
1250 hapd->conf->hs20_osu_providers_count, qi);
1255 hapd->conf->hs20_operator_icon_count, qi);
1260 hapd->conf->hs20_osu_providers_nai_count, qi);
1263 wpa_printf(MSG_DEBUG, "ANQP: Unsupported HS 2.0 subtype %u",
1274 qi->request |= ANQP_REQ_NAI_HOME_REALM;
1275 qi->home_realm_query = pos;
1276 qi->home_realm_query_len = end - pos;
1277 if (hapd->conf->nai_realm_data != NULL) {
1278 wpa_printf(MSG_DEBUG, "ANQP: HS 2.0 NAI Home Realm Query "
1281 wpa_printf(MSG_DEBUG, "ANQP: HS 2.0 NAI Home Realm Query not "
1291 qi->request |= ANQP_REQ_ICON_REQUEST;
1292 qi->icon_name = pos;
1293 qi->icon_name_len = end - pos;
1294 if (hapd->conf->hs20_icons_count) {
1295 wpa_printf(MSG_DEBUG, "ANQP: HS 2.0 Icon Request Query "
1298 wpa_printf(MSG_DEBUG, "ANQP: HS 2.0 Icon Request Query not "
1310 if (end - pos <= 1)
1317 wpa_printf(MSG_DEBUG, "ANQP: HS 2.0 Query List");
1330 wpa_printf(MSG_DEBUG, "ANQP: Unsupported HS 2.0 query subtype "
1344 * This is for P2P SD and will be taken care of by the P2P
1349 "ANQP: Ignore WFA vendor type %u (P2P SD) in generic GAS server",
1351 qi->p2p_sd = 1;
1366 hapd->conf->mbo_cell_data_conn_pref >= 0, qi);
1382 if (end - pos < 1)
1410 if (end - pos < 4) {
1455 buf = gas_serv_build_gas_resp_payload(hapd, qi->request,
1456 qi->home_realm_query,
1457 qi->home_realm_query_len,
1458 qi->icon_name, qi->icon_name_len,
1459 qi->extra_req, qi->num_extra_req);
1465 if (wpabuf_len(buf) == 0 && qi->p2p_sd) {
1467 "ANQP: Do not send response to P2P SD from generic GAS service (P2P SD implementation will process this)");
1473 if (wpabuf_len(buf) > hapd->conf->gas_frag_limit ||
1474 hapd->conf->gas_comeback_delay) {
1478 if (hapd->conf->gas_comeback_delay) {
1479 /* Testing - allow overriding of the delay value */
1480 comeback_delay = hapd->conf->gas_comeback_delay;
1484 "initial response - use GAS comeback");
1495 di->prot = prot;
1496 di->sd_resp = buf;
1497 di->sd_resp_pos = 0;
1513 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
1517 hostapd_drv_send_action_addr3_ap(hapd, hapd->iface->freq, 0, sa,
1531 if (wpabuf_len(buf) > hapd->conf->gas_frag_limit ||
1532 hapd->conf->gas_comeback_delay) {
1536 if (hapd->conf->gas_comeback_delay) {
1537 /* Testing - allow overriding of the delay value */
1538 comeback_delay = hapd->conf->gas_comeback_delay;
1542 "DPP: Too long response to fit in initial response - use GAS comeback");
1555 di->prot = prot;
1556 di->sd_resp = buf;
1557 di->sd_resp_pos = 0;
1558 di->dpp = 1;
1585 hostapd_drv_send_action(hapd, freq ? freq : hapd->iface->freq, 0, sa,
1615 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1620 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1627 if (slen > end - pos || slen < 2) {
1628 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1633 pos++; /* skip QueryRespLenLimit and PAME-BI */
1646 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1650 return; /* Invalid source address - drop silently */
1661 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
1666 hapd->iface->freq, 0,
1675 if (end - pos < 2)
1679 if (slen > end - pos)
1701 if (end - pos < 4)
1709 if (elen > end - pos) {
1750 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Dialog Token: %u",
1755 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: No pending SD "
1760 return; /* Invalid source address - drop silently */
1769 frag_len = wpabuf_len(dialog->sd_resp) - dialog->sd_resp_pos;
1770 if (frag_len > hapd->conf->gas_frag_limit) {
1771 frag_len = hapd->conf->gas_frag_limit;
1774 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: resp frag_len %u",
1776 buf = wpabuf_alloc_copy(wpabuf_head_u8(dialog->sd_resp) +
1777 dialog->sd_resp_pos, frag_len);
1779 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Failed to allocate "
1785 if (dialog->dpp) {
1788 dialog->sd_frag_id, more, 0,
1799 dialog->sd_frag_id,
1806 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Tx GAS Comeback Response "
1808 dialog->sd_frag_id, more, (int) frag_len);
1809 dialog->sd_frag_id++;
1810 dialog->sd_resp_pos += frag_len;
1813 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: %d more bytes remain "
1815 (int) (wpabuf_len(dialog->sd_resp) -
1816 dialog->sd_resp_pos));
1818 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: All fragments of "
1819 "SD response sent");
1821 if (dialog->dpp)
1832 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
1836 hostapd_drv_send_action_addr3_ap(hapd, hapd->iface->freq, 0, sa,
1854 if (mgmt->u.action.category != WLAN_ACTION_PUBLIC &&
1855 mgmt->u.action.category != WLAN_ACTION_PROTECTED_DUAL)
1862 prot = mgmt->u.action.category == WLAN_ACTION_PROTECTED_DUAL;
1863 sa = mgmt->sa;
1864 if (hapd->conf->gas_address3 == 1)
1866 else if (hapd->conf->gas_address3 == 2)
1869 std_addr3 = is_broadcast_ether_addr(mgmt->bssid);
1870 len -= IEEE80211_HDRLEN + 1;
1874 gas_serv_rx_gas_initial_req(hapd, sa, data + 1, len - 1, prot,
1878 gas_serv_rx_gas_comeback_req(hapd, sa, data + 1, len - 1, prot,
1887 hapd->public_action_cb2 = gas_serv_rx_public_action;
1888 hapd->public_action_cb2_ctx = hapd;