Lines Matching refs:hapd
30 gas_dialog_create(struct hostapd_data *hapd, const u8 *addr, u8 dialog_token) in gas_dialog_create() argument
36 sta = ap_get_sta(hapd, addr); in gas_dialog_create()
44 sta = ap_sta_add(hapd, addr); in gas_dialog_create()
55 ap_sta_session_timeout(hapd, sta, 5); in gas_dialog_create()
57 ap_sta_replenish_timeout(hapd, sta, 5); in gas_dialog_create()
79 wpa_msg(hapd->msg_ctx, MSG_ERROR, "ANQP: Could not create dialog for " in gas_dialog_create()
88 gas_serv_dialog_find(struct hostapd_data *hapd, const u8 *addr, in gas_serv_dialog_find() argument
94 sta = ap_get_sta(hapd, addr); in gas_serv_dialog_find()
119 static void gas_serv_free_dialogs(struct hostapd_data *hapd, in gas_serv_free_dialogs() argument
125 sta = ap_get_sta(hapd, sta_addr); in gas_serv_free_dialogs()
140 static void anqp_add_hs_capab_list(struct hostapd_data *hapd, in anqp_add_hs_capab_list() argument
151 if (hapd->conf->hs20_oper_friendly_name) in anqp_add_hs_capab_list()
153 if (hapd->conf->hs20_wan_metrics) in anqp_add_hs_capab_list()
155 if (hapd->conf->hs20_connection_capability) in anqp_add_hs_capab_list()
157 if (hapd->conf->nai_realm_data) in anqp_add_hs_capab_list()
159 if (hapd->conf->hs20_operating_class) in anqp_add_hs_capab_list()
161 if (hapd->conf->hs20_osu_providers_count) in anqp_add_hs_capab_list()
163 if (hapd->conf->hs20_icons_count) in anqp_add_hs_capab_list()
170 static void anqp_add_capab_list(struct hostapd_data *hapd, in anqp_add_capab_list() argument
177 if (hapd->conf->venue_name) in anqp_add_capab_list()
179 if (hapd->conf->network_auth_type) in anqp_add_capab_list()
181 if (hapd->conf->roaming_consortium) in anqp_add_capab_list()
183 if (hapd->conf->ipaddr_type_configured) in anqp_add_capab_list()
185 if (hapd->conf->nai_realm_data) in anqp_add_capab_list()
187 if (hapd->conf->anqp_3gpp_cell_net) in anqp_add_capab_list()
189 if (hapd->conf->domain_name) in anqp_add_capab_list()
192 anqp_add_hs_capab_list(hapd, buf); in anqp_add_capab_list()
198 static void anqp_add_venue_name(struct hostapd_data *hapd, struct wpabuf *buf) in anqp_add_venue_name() argument
200 if (hapd->conf->venue_name) { in anqp_add_venue_name()
204 wpabuf_put_u8(buf, hapd->conf->venue_group); in anqp_add_venue_name()
205 wpabuf_put_u8(buf, hapd->conf->venue_type); in anqp_add_venue_name()
206 for (i = 0; i < hapd->conf->venue_name_count; i++) { in anqp_add_venue_name()
208 vn = &hapd->conf->venue_name[i]; in anqp_add_venue_name()
218 static void anqp_add_network_auth_type(struct hostapd_data *hapd, in anqp_add_network_auth_type() argument
221 if (hapd->conf->network_auth_type) { in anqp_add_network_auth_type()
223 wpabuf_put_le16(buf, hapd->conf->network_auth_type_len); in anqp_add_network_auth_type()
224 wpabuf_put_data(buf, hapd->conf->network_auth_type, in anqp_add_network_auth_type()
225 hapd->conf->network_auth_type_len); in anqp_add_network_auth_type()
230 static void anqp_add_roaming_consortium(struct hostapd_data *hapd, in anqp_add_roaming_consortium() argument
237 for (i = 0; i < hapd->conf->roaming_consortium_count; i++) { in anqp_add_roaming_consortium()
239 rc = &hapd->conf->roaming_consortium[i]; in anqp_add_roaming_consortium()
247 static void anqp_add_ip_addr_type_availability(struct hostapd_data *hapd, in anqp_add_ip_addr_type_availability() argument
250 if (hapd->conf->ipaddr_type_configured) { in anqp_add_ip_addr_type_availability()
253 wpabuf_put_u8(buf, hapd->conf->ipaddr_type_availability); in anqp_add_ip_addr_type_availability()
296 static int hs20_add_nai_home_realm_matches(struct hostapd_data *hapd, in hs20_add_nai_home_realm_matches() argument
335 for (j = 0; j < hapd->conf->nai_realm_count && in hs20_add_nai_home_realm_matches()
338 realm = &hapd->conf->nai_realm_data[j]; in hs20_add_nai_home_realm_matches()
382 realm = &hapd->conf->nai_realm_data[matches[i].realm_data_idx]; in hs20_add_nai_home_realm_matches()
390 static void anqp_add_nai_realm(struct hostapd_data *hapd, struct wpabuf *buf, in anqp_add_nai_realm() argument
394 if (nai_realm && hapd->conf->nai_realm_data) { in anqp_add_nai_realm()
398 wpabuf_put_le16(buf, hapd->conf->nai_realm_count); in anqp_add_nai_realm()
399 for (i = 0; i < hapd->conf->nai_realm_count; i++) { in anqp_add_nai_realm()
403 realm = &hapd->conf->nai_realm_data[i]; in anqp_add_nai_realm()
417 } else if (nai_home_realm && hapd->conf->nai_realm_data && home_realm) { in anqp_add_nai_realm()
418 hs20_add_nai_home_realm_matches(hapd, buf, home_realm, in anqp_add_nai_realm()
424 static void anqp_add_3gpp_cellular_network(struct hostapd_data *hapd, in anqp_add_3gpp_cellular_network() argument
427 if (hapd->conf->anqp_3gpp_cell_net) { in anqp_add_3gpp_cellular_network()
430 hapd->conf->anqp_3gpp_cell_net_len); in anqp_add_3gpp_cellular_network()
431 wpabuf_put_data(buf, hapd->conf->anqp_3gpp_cell_net, in anqp_add_3gpp_cellular_network()
432 hapd->conf->anqp_3gpp_cell_net_len); in anqp_add_3gpp_cellular_network()
437 static void anqp_add_domain_name(struct hostapd_data *hapd, struct wpabuf *buf) in anqp_add_domain_name() argument
439 if (hapd->conf->domain_name) { in anqp_add_domain_name()
441 wpabuf_put_le16(buf, hapd->conf->domain_name_len); in anqp_add_domain_name()
442 wpabuf_put_data(buf, hapd->conf->domain_name, in anqp_add_domain_name()
443 hapd->conf->domain_name_len); in anqp_add_domain_name()
450 static void anqp_add_operator_friendly_name(struct hostapd_data *hapd, in anqp_add_operator_friendly_name() argument
453 if (hapd->conf->hs20_oper_friendly_name) { in anqp_add_operator_friendly_name()
461 for (i = 0; i < hapd->conf->hs20_oper_friendly_name_count; i++) in anqp_add_operator_friendly_name()
464 vn = &hapd->conf->hs20_oper_friendly_name[i]; in anqp_add_operator_friendly_name()
474 static void anqp_add_wan_metrics(struct hostapd_data *hapd, in anqp_add_wan_metrics() argument
477 if (hapd->conf->hs20_wan_metrics) { in anqp_add_wan_metrics()
483 wpabuf_put_data(buf, hapd->conf->hs20_wan_metrics, 13); in anqp_add_wan_metrics()
489 static void anqp_add_connection_capability(struct hostapd_data *hapd, in anqp_add_connection_capability() argument
492 if (hapd->conf->hs20_connection_capability) { in anqp_add_connection_capability()
498 wpabuf_put_data(buf, hapd->conf->hs20_connection_capability, in anqp_add_connection_capability()
499 hapd->conf->hs20_connection_capability_len); in anqp_add_connection_capability()
505 static void anqp_add_operating_class(struct hostapd_data *hapd, in anqp_add_operating_class() argument
508 if (hapd->conf->hs20_operating_class) { in anqp_add_operating_class()
514 wpabuf_put_data(buf, hapd->conf->hs20_operating_class, in anqp_add_operating_class()
515 hapd->conf->hs20_operating_class_len); in anqp_add_operating_class()
598 static void anqp_add_osu_providers_list(struct hostapd_data *hapd, in anqp_add_osu_providers_list() argument
601 if (hapd->conf->hs20_osu_providers_count) { in anqp_add_osu_providers_list()
610 wpabuf_put_u8(buf, hapd->conf->osu_ssid_len); in anqp_add_osu_providers_list()
611 wpabuf_put_data(buf, hapd->conf->osu_ssid, in anqp_add_osu_providers_list()
612 hapd->conf->osu_ssid_len); in anqp_add_osu_providers_list()
615 wpabuf_put_u8(buf, hapd->conf->hs20_osu_providers_count); in anqp_add_osu_providers_list()
617 for (i = 0; i < hapd->conf->hs20_osu_providers_count; i++) { in anqp_add_osu_providers_list()
619 buf, hapd->conf, in anqp_add_osu_providers_list()
620 &hapd->conf->hs20_osu_providers[i]); in anqp_add_osu_providers_list()
628 static void anqp_add_icon_binary_file(struct hostapd_data *hapd, in anqp_add_icon_binary_file() argument
638 for (i = 0; i < hapd->conf->hs20_icons_count; i++) { in anqp_add_icon_binary_file()
639 icon = &hapd->conf->hs20_icons[i]; in anqp_add_icon_binary_file()
645 if (i < hapd->conf->hs20_icons_count) in anqp_add_icon_binary_file()
646 icon = &hapd->conf->hs20_icons[i]; in anqp_add_icon_binary_file()
687 gas_serv_build_gas_resp_payload(struct hostapd_data *hapd, in gas_serv_build_gas_resp_payload() argument
706 anqp_add_capab_list(hapd, buf); in gas_serv_build_gas_resp_payload()
708 anqp_add_venue_name(hapd, buf); in gas_serv_build_gas_resp_payload()
710 anqp_add_network_auth_type(hapd, buf); in gas_serv_build_gas_resp_payload()
712 anqp_add_roaming_consortium(hapd, buf); in gas_serv_build_gas_resp_payload()
714 anqp_add_ip_addr_type_availability(hapd, buf); in gas_serv_build_gas_resp_payload()
716 anqp_add_nai_realm(hapd, buf, home_realm, home_realm_len, in gas_serv_build_gas_resp_payload()
720 anqp_add_3gpp_cellular_network(hapd, buf); in gas_serv_build_gas_resp_payload()
722 anqp_add_domain_name(hapd, buf); in gas_serv_build_gas_resp_payload()
726 anqp_add_hs_capab_list(hapd, buf); in gas_serv_build_gas_resp_payload()
728 anqp_add_operator_friendly_name(hapd, buf); in gas_serv_build_gas_resp_payload()
730 anqp_add_wan_metrics(hapd, buf); in gas_serv_build_gas_resp_payload()
732 anqp_add_connection_capability(hapd, buf); in gas_serv_build_gas_resp_payload()
734 anqp_add_operating_class(hapd, buf); in gas_serv_build_gas_resp_payload()
736 anqp_add_osu_providers_list(hapd, buf); in gas_serv_build_gas_resp_payload()
738 anqp_add_icon_binary_file(hapd, buf, icon_name, icon_name_len); in gas_serv_build_gas_resp_payload()
767 static void rx_anqp_query_list_id(struct hostapd_data *hapd, u16 info_id, in rx_anqp_query_list_id() argument
777 hapd->conf->venue_name != NULL, qi); in rx_anqp_query_list_id()
781 hapd->conf->network_auth_type != NULL, qi); in rx_anqp_query_list_id()
785 hapd->conf->roaming_consortium != NULL, qi); in rx_anqp_query_list_id()
790 hapd->conf->ipaddr_type_configured, qi); in rx_anqp_query_list_id()
794 hapd->conf->nai_realm_data != NULL, qi); in rx_anqp_query_list_id()
799 hapd->conf->anqp_3gpp_cell_net != NULL, qi); in rx_anqp_query_list_id()
803 hapd->conf->domain_name != NULL, qi); in rx_anqp_query_list_id()
813 static void rx_anqp_query_list(struct hostapd_data *hapd, in rx_anqp_query_list() argument
821 rx_anqp_query_list_id(hapd, WPA_GET_LE16(pos), qi); in rx_anqp_query_list()
829 static void rx_anqp_hs_query_list(struct hostapd_data *hapd, u8 subtype, in rx_anqp_hs_query_list() argument
840 hapd->conf->hs20_oper_friendly_name != NULL, qi); in rx_anqp_hs_query_list()
844 hapd->conf->hs20_wan_metrics != NULL, qi); in rx_anqp_hs_query_list()
849 hapd->conf->hs20_connection_capability != NULL, in rx_anqp_hs_query_list()
854 hapd->conf->hs20_operating_class != NULL, qi); in rx_anqp_hs_query_list()
858 hapd->conf->hs20_osu_providers_count, qi); in rx_anqp_hs_query_list()
868 static void rx_anqp_hs_nai_home_realm(struct hostapd_data *hapd, in rx_anqp_hs_nai_home_realm() argument
875 if (hapd->conf->nai_realm_data != NULL) { in rx_anqp_hs_nai_home_realm()
885 static void rx_anqp_hs_icon_request(struct hostapd_data *hapd, in rx_anqp_hs_icon_request() argument
892 if (hapd->conf->hs20_icons_count) { in rx_anqp_hs_icon_request()
902 static void rx_anqp_vendor_specific(struct hostapd_data *hapd, in rx_anqp_vendor_specific() argument
954 rx_anqp_hs_query_list(hapd, *pos, qi); in rx_anqp_vendor_specific()
959 rx_anqp_hs_nai_home_realm(hapd, pos, end, qi); in rx_anqp_vendor_specific()
962 rx_anqp_hs_icon_request(hapd, pos, end, qi); in rx_anqp_vendor_specific()
974 static void gas_serv_req_local_processing(struct hostapd_data *hapd, in gas_serv_req_local_processing() argument
980 buf = gas_serv_build_gas_resp_payload(hapd, qi->request, in gas_serv_req_local_processing()
997 if (wpabuf_len(buf) > hapd->gas_frag_limit || in gas_serv_req_local_processing()
998 hapd->conf->gas_comeback_delay) { in gas_serv_req_local_processing()
1002 if (hapd->conf->gas_comeback_delay) { in gas_serv_req_local_processing()
1004 comeback_delay = hapd->conf->gas_comeback_delay; in gas_serv_req_local_processing()
1009 di = gas_dialog_create(hapd, sa, dialog_token); in gas_serv_req_local_processing()
1036 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa, in gas_serv_req_local_processing()
1042 static void gas_serv_rx_gas_initial_req(struct hostapd_data *hapd, in gas_serv_rx_gas_initial_req() argument
1060 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in gas_serv_rx_gas_initial_req()
1065 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in gas_serv_rx_gas_initial_req()
1074 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in gas_serv_rx_gas_initial_req()
1082 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in gas_serv_rx_gas_initial_req()
1096 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa, in gas_serv_rx_gas_initial_req()
1131 rx_anqp_query_list(hapd, pos, pos + elen, &qi); in gas_serv_rx_gas_initial_req()
1135 rx_anqp_vendor_specific(hapd, pos, pos + elen, &qi); in gas_serv_rx_gas_initial_req()
1147 gas_serv_req_local_processing(hapd, sa, dialog_token, &qi, prot); in gas_serv_rx_gas_initial_req()
1151 static void gas_serv_rx_gas_comeback_req(struct hostapd_data *hapd, in gas_serv_rx_gas_comeback_req() argument
1165 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Dialog Token: %u", in gas_serv_rx_gas_comeback_req()
1168 dialog = gas_serv_dialog_find(hapd, sa, dialog_token); in gas_serv_rx_gas_comeback_req()
1170 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: No pending SD " in gas_serv_rx_gas_comeback_req()
1185 if (frag_len > hapd->gas_frag_limit) { in gas_serv_rx_gas_comeback_req()
1186 frag_len = hapd->gas_frag_limit; in gas_serv_rx_gas_comeback_req()
1189 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: resp frag_len %u", in gas_serv_rx_gas_comeback_req()
1194 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Failed to allocate " in gas_serv_rx_gas_comeback_req()
1208 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Tx GAS Comeback Response " in gas_serv_rx_gas_comeback_req()
1215 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: %d more bytes remain " in gas_serv_rx_gas_comeback_req()
1220 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: All fragments of " in gas_serv_rx_gas_comeback_req()
1223 gas_serv_free_dialogs(hapd, sa); in gas_serv_rx_gas_comeback_req()
1229 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa, in gas_serv_rx_gas_comeback_req()
1238 struct hostapd_data *hapd = ctx; in gas_serv_rx_public_action() local
1260 gas_serv_rx_gas_initial_req(hapd, sa, data + 1, len - 1, prot); in gas_serv_rx_public_action()
1263 gas_serv_rx_gas_comeback_req(hapd, sa, data + 1, len - 1, prot); in gas_serv_rx_public_action()
1269 int gas_serv_init(struct hostapd_data *hapd) in gas_serv_init() argument
1271 hapd->public_action_cb2 = gas_serv_rx_public_action; in gas_serv_init()
1272 hapd->public_action_cb2_ctx = hapd; in gas_serv_init()
1273 hapd->gas_frag_limit = 1400; in gas_serv_init()
1274 if (hapd->conf->gas_frag_limit > 0) in gas_serv_init()
1275 hapd->gas_frag_limit = hapd->conf->gas_frag_limit; in gas_serv_init()
1280 void gas_serv_deinit(struct hostapd_data *hapd) in gas_serv_deinit() argument