Lines Matching +full:max +full:- +full:reason

2  * WPA Supplicant - Basic mesh peer management
3 * Copyright (c) 2013-2014, cozybit, Inc. All rights reserved.
31 const u8 *reason; /* Reason Code (conditional, 2 octets) */ member
79 mpm_ie->chosen_pmk = ie + len - SAE_PMKID_LEN; in mesh_mpm_parse_peer_mgmt()
80 len -= SAE_PMKID_LEN; in mesh_mpm_parse_peer_mgmt()
87 return -1; in mesh_mpm_parse_peer_mgmt()
92 return -1; in mesh_mpm_parse_peer_mgmt()
93 mpm_ie->proto_id = ie; in mesh_mpm_parse_peer_mgmt()
94 mpm_ie->llid = ie + 2; in mesh_mpm_parse_peer_mgmt()
96 len -= 4; in mesh_mpm_parse_peer_mgmt()
98 /* close reason is always present at end for close */ in mesh_mpm_parse_peer_mgmt()
101 return -1; in mesh_mpm_parse_peer_mgmt()
102 mpm_ie->reason = ie + len - 2; in mesh_mpm_parse_peer_mgmt()
103 len -= 2; in mesh_mpm_parse_peer_mgmt()
108 mpm_ie->plid = ie; in mesh_mpm_parse_peer_mgmt()
116 if (hapd->max_plinks > hapd->num_plinks) in plink_free_count()
117 return hapd->max_plinks - hapd->num_plinks; in plink_free_count()
126 if (!elems->supp_rates) { in copy_supp_rates()
128 MAC2STR(sta->addr)); in copy_supp_rates()
132 if (elems->supp_rates_len + elems->ext_supp_rates_len > in copy_supp_rates()
133 sizeof(sta->supported_rates)) { in copy_supp_rates()
136 " %d+%d", MAC2STR(sta->addr), elems->supp_rates_len, in copy_supp_rates()
137 elems->ext_supp_rates_len); in copy_supp_rates()
141 sta->supported_rates_len = merge_byte_arrays( in copy_supp_rates()
142 sta->supported_rates, sizeof(sta->supported_rates), in copy_supp_rates()
143 elems->supp_rates, elems->supp_rates_len, in copy_supp_rates()
144 elems->ext_supp_rates, elems->ext_supp_rates_len); in copy_supp_rates()
154 struct mesh_conf *mconf = wpa_s->ifmsh->mconf; in matches_local()
156 if (elems->mesh_config_len < 5) in matches_local()
159 return (mconf->meshid_len == elems->mesh_id_len && in matches_local()
160 os_memcmp(mconf->meshid, elems->mesh_id, in matches_local()
161 elems->mesh_id_len) == 0 && in matches_local()
162 mconf->mesh_pp_id == elems->mesh_config[0] && in matches_local()
163 mconf->mesh_pm_id == elems->mesh_config[1] && in matches_local()
164 mconf->mesh_cc_id == elems->mesh_config[2] && in matches_local()
165 mconf->mesh_sp_id == elems->mesh_config[3] && in matches_local()
166 mconf->mesh_auth_id == elems->mesh_config[4]); in matches_local()
174 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0]; in llid_in_use()
176 for (sta = hapd->sta_list; sta; sta = sta->next) { in llid_in_use()
177 if (sta->my_lid == llid) in llid_in_use()
196 sta->my_lid = llid; in mesh_mpm_init_link()
197 sta->peer_lid = 0; in mesh_mpm_init_link()
198 sta->peer_aid = 0; in mesh_mpm_init_link()
204 sta->plink_state = PLINK_IDLE; in mesh_mpm_init_link()
214 struct hostapd_iface *ifmsh = wpa_s->ifmsh; in mesh_mpm_send_plink_action()
215 struct hostapd_data *bss = ifmsh->bss[0]; in mesh_mpm_send_plink_action()
216 struct mesh_conf *conf = ifmsh->mconf; in mesh_mpm_send_plink_action()
221 int ampe = conf->security & MESH_CONF_SEC_AMPE; in mesh_mpm_send_plink_action()
231 2 + (32 - 8) + in mesh_mpm_send_plink_action()
235 2 + 96 + 32 + 32 + /* AMPE (96 + max GTKlen + max IGTKlen) */ in mesh_mpm_send_plink_action()
237 if (type != PLINK_CLOSE && wpa_s->mesh_ht_enabled) { in mesh_mpm_send_plink_action()
242 if (type != PLINK_CLOSE && wpa_s->mesh_vht_enabled) { in mesh_mpm_send_plink_action()
248 if (type != PLINK_CLOSE && wpa_s->mesh_he_enabled) { in mesh_mpm_send_plink_action()
255 if (is_6ghz_op_class(bss->iconf->op_class)) in mesh_mpm_send_plink_action()
261 buf_len += conf->rsn_ie_len; /* RSN IE */ in mesh_mpm_send_plink_action()
264 if (type != PLINK_CLOSE && conf->ocv) in mesh_mpm_send_plink_action()
268 if (type != PLINK_CLOSE && wpa_s->mesh_eht_enabled) { in mesh_mpm_send_plink_action()
291 wpabuf_put_le16(buf, sta->aid); in mesh_mpm_send_plink_action()
296 wpabuf_put_data(buf, supp_rates, pos - supp_rates); in mesh_mpm_send_plink_action()
299 wpabuf_put_data(buf, conf->rsn_ie, conf->rsn_ie_len); in mesh_mpm_send_plink_action()
303 wpabuf_put_u8(buf, conf->meshid_len); in mesh_mpm_send_plink_action()
304 wpabuf_put_data(buf, conf->meshid, conf->meshid_len); in mesh_mpm_send_plink_action()
309 wpabuf_put_u8(buf, conf->mesh_pp_id); in mesh_mpm_send_plink_action()
310 wpabuf_put_u8(buf, conf->mesh_pm_id); in mesh_mpm_send_plink_action()
311 wpabuf_put_u8(buf, conf->mesh_cc_id); in mesh_mpm_send_plink_action()
312 wpabuf_put_u8(buf, conf->mesh_sp_id); in mesh_mpm_send_plink_action()
313 wpabuf_put_u8(buf, conf->mesh_auth_id); in mesh_mpm_send_plink_action()
314 info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1; in mesh_mpm_send_plink_action()
320 (conf->mesh_fwding ? MESH_CAP_FORWARDING : 0)); in mesh_mpm_send_plink_action()
324 wpabuf_put_u8(buf, conf->meshid_len); in mesh_mpm_send_plink_action()
325 wpabuf_put_data(buf, conf->meshid, conf->meshid_len); in mesh_mpm_send_plink_action()
342 ie_len += 2; /* reason code */ in mesh_mpm_send_plink_action()
353 wpabuf_put_le16(buf, sta->my_lid); in mesh_mpm_send_plink_action()
355 wpabuf_put_le16(buf, sta->peer_lid); in mesh_mpm_send_plink_action()
359 if (sta->sae == NULL) { in mesh_mpm_send_plink_action()
363 mesh_rsn_get_pmkid(wpa_s->mesh_rsn, sta, in mesh_mpm_send_plink_action()
367 if (type != PLINK_CLOSE && wpa_s->mesh_ht_enabled) { in mesh_mpm_send_plink_action()
372 wpabuf_put_data(buf, ht_capa_oper, pos - ht_capa_oper); in mesh_mpm_send_plink_action()
375 if (type != PLINK_CLOSE && wpa_s->mesh_vht_enabled) { in mesh_mpm_send_plink_action()
380 wpabuf_put_data(buf, vht_capa_oper, pos - vht_capa_oper); in mesh_mpm_send_plink_action()
384 if (type != PLINK_CLOSE && wpa_s->mesh_he_enabled) { in mesh_mpm_send_plink_action()
398 wpabuf_put_data(buf, he_capa_oper, pos - he_capa_oper); in mesh_mpm_send_plink_action()
402 if (type != PLINK_CLOSE && conf->ocv) { in mesh_mpm_send_plink_action()
418 if (type != PLINK_CLOSE && wpa_s->mesh_eht_enabled) { in mesh_mpm_send_plink_action()
428 wpabuf_put_data(buf, eht_capa_oper, pos - eht_capa_oper); in mesh_mpm_send_plink_action()
432 if (ampe && mesh_rsn_protect_frame(wpa_s->mesh_rsn, sta, cat, buf)) { in mesh_mpm_send_plink_action()
440 type, MAC2STR(sta->addr), sta->my_lid, sta->peer_lid); in mesh_mpm_send_plink_action()
441 ret = wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, in mesh_mpm_send_plink_action()
442 sta->addr, wpa_s->own_addr, wpa_s->own_addr, in mesh_mpm_send_plink_action()
462 MAC2STR(sta->addr), mplstate[sta->plink_state], in wpa_mesh_set_plink_state()
464 sta->plink_state = state; in wpa_mesh_set_plink_state()
467 params.addr = sta->addr; in wpa_mesh_set_plink_state()
469 params.peer_aid = sta->peer_aid; in wpa_mesh_set_plink_state()
471 params.mld_link_id = -1; in wpa_mesh_set_plink_state()
476 ": %d", MAC2STR(sta->addr), ret); in wpa_mesh_set_plink_state()
484 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0]; in mesh_mpm_fsm_restart()
496 u16 reason = 0; in plink_timer() local
497 struct mesh_conf *conf = wpa_s->ifmsh->mconf; in plink_timer()
498 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0]; in plink_timer()
500 switch (sta->plink_state) { in plink_timer()
504 if (sta->mpm_retries < conf->dot11MeshMaxRetries) { in plink_timer()
506 conf->dot11MeshRetryTimeout / 1000, in plink_timer()
507 (conf->dot11MeshRetryTimeout % 1000) * 1000, in plink_timer()
510 sta->mpm_retries++; in plink_timer()
513 reason = WLAN_REASON_MESH_MAX_RETRIES; in plink_timer()
518 if (!reason) in plink_timer()
519 reason = WLAN_REASON_MESH_CONFIRM_TIMEOUT; in plink_timer()
521 eloop_register_timeout(conf->dot11MeshHoldingTimeout / 1000, in plink_timer()
522 (conf->dot11MeshHoldingTimeout % 1000) * 1000, in plink_timer()
524 mesh_mpm_send_plink_action(wpa_s, sta, PLINK_CLOSE, reason); in plink_timer()
529 if (sta->mesh_sae_pmksa_caching) { in plink_timer()
532 MAC2STR(sta->addr)); in plink_timer()
533 wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); in plink_timer()
548 struct mesh_conf *conf = wpa_s->ifmsh->mconf; in mesh_mpm_plink_open()
551 eloop_register_timeout(conf->dot11MeshRetryTimeout / 1000, in mesh_mpm_plink_open()
552 (conf->dot11MeshRetryTimeout % 1000) * 1000, in mesh_mpm_plink_open()
563 int reason = WLAN_REASON_MESH_PEERING_CANCELLED; in mesh_mpm_plink_close() local
566 if (sta->plink_state == PLINK_ESTAB) { in mesh_mpm_plink_close()
567 hapd->num_plinks--; in mesh_mpm_plink_close()
569 wpa_s, sta->addr, WLAN_REASON_UNSPECIFIED); in mesh_mpm_plink_close()
572 mesh_mpm_send_plink_action(wpa_s, sta, PLINK_CLOSE, reason); in mesh_mpm_plink_close()
574 MAC2STR(sta->addr)); in mesh_mpm_plink_close()
589 if (!wpa_s->ifmsh) { in mesh_mpm_close_peer()
591 return -1; in mesh_mpm_close_peer()
594 hapd = wpa_s->ifmsh->bss[0]; in mesh_mpm_close_peer()
598 return -1; in mesh_mpm_close_peer()
601 return mesh_mpm_plink_close(hapd, sta, wpa_s) == 0 ? 0 : -1; in mesh_mpm_close_peer()
608 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0]; in peer_add_timer()
610 os_memset(hapd->mesh_required_peer, 0, ETH_ALEN); in peer_add_timer()
617 struct wpa_ssid *ssid = wpa_s->current_ssid; in mesh_mpm_connect_peer()
622 if (!wpa_s->ifmsh) { in mesh_mpm_connect_peer()
624 return -1; in mesh_mpm_connect_peer()
627 if (!ssid || !ssid->no_auto_peer) { in mesh_mpm_connect_peer()
630 return -1; in mesh_mpm_connect_peer()
633 hapd = wpa_s->ifmsh->bss[0]; in mesh_mpm_connect_peer()
634 conf = wpa_s->ifmsh->mconf; in mesh_mpm_connect_peer()
639 return -1; in mesh_mpm_connect_peer()
642 if ((PLINK_OPN_SNT <= sta->plink_state && in mesh_mpm_connect_peer()
643 sta->plink_state <= PLINK_ESTAB) || in mesh_mpm_connect_peer()
644 (sta->sae && sta->sae->state > SAE_NOTHING)) { in mesh_mpm_connect_peer()
647 return -1; in mesh_mpm_connect_peer()
650 if (conf->security == MESH_CONF_SEC_NONE) { in mesh_mpm_connect_peer()
654 os_memcpy(hapd->mesh_required_peer, addr, ETH_ALEN); in mesh_mpm_connect_peer()
655 eloop_register_timeout(duration == -1 ? 10 : duration, 0, in mesh_mpm_connect_peer()
665 struct hostapd_data *hapd = ifmsh->bss[0]; in mesh_mpm_deinit()
670 hapd->num_plinks = 0; in mesh_mpm_deinit()
680 struct hostapd_data *data = wpa_s->ifmsh->bss[0]; in mesh_mpm_auth_peer()
693 sta->flags |= WLAN_STA_AUTH; in mesh_mpm_auth_peer()
698 params.addr = sta->addr; in mesh_mpm_auth_peer()
701 params.mld_link_id = -1; in mesh_mpm_auth_peer()
704 MAC2STR(sta->addr)); in mesh_mpm_auth_peer()
709 MAC2STR(sta->addr), ret); in mesh_mpm_auth_peer()
712 if (!sta->my_lid) in mesh_mpm_auth_peer()
729 struct mesh_conf *conf = wpa_s->ifmsh->mconf; in mesh_mpm_add_peer()
730 struct hostapd_data *data = wpa_s->ifmsh->bss[0]; in mesh_mpm_add_peer()
735 if (elems->mesh_config_len >= 7 && in mesh_mpm_add_peer()
736 !(elems->mesh_config[6] & MESH_CAP_ACCEPT_ADDITIONAL_PEER)) { in mesh_mpm_add_peer()
752 sta->flags |= WLAN_STA_WMM; in mesh_mpm_add_peer()
760 if (!sta->my_lid) in mesh_mpm_add_peer()
763 copy_sta_ht_capab(data, sta, elems->ht_capabilities); in mesh_mpm_add_peer()
765 oper = (struct ieee80211_ht_operation *) elems->ht_operation; in mesh_mpm_add_peer()
767 !(oper->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) && in mesh_mpm_add_peer()
768 sta->ht_capabilities) { in mesh_mpm_add_peer()
771 MAC2STR(sta->addr)); in mesh_mpm_add_peer()
772 set_disable_ht40(sta->ht_capabilities, 1); in mesh_mpm_add_peer()
776 ieee802_11_update_beacons(data->iface); in mesh_mpm_add_peer()
779 copy_sta_vht_capab(data, sta, elems->vht_capabilities); in mesh_mpm_add_peer()
780 copy_sta_vht_oper(data, sta, elems->vht_operation); in mesh_mpm_add_peer()
781 set_sta_vht_opmode(data, sta, elems->opmode_notif); in mesh_mpm_add_peer()
786 elems->he_capabilities, elems->he_capabilities_len); in mesh_mpm_add_peer()
787 copy_sta_he_6ghz_capab(data, sta, elems->he_6ghz_band_cap); in mesh_mpm_add_peer()
791 elems->he_capabilities, in mesh_mpm_add_peer()
792 elems->he_capabilities_len, in mesh_mpm_add_peer()
793 elems->eht_capabilities, in mesh_mpm_add_peer()
794 elems->eht_capabilities_len); in mesh_mpm_add_peer()
805 params.supp_rates = sta->supported_rates; in mesh_mpm_add_peer()
806 params.supp_rates_len = sta->supported_rates_len; in mesh_mpm_add_peer()
808 params.plink_state = sta->plink_state; in mesh_mpm_add_peer()
809 params.aid = sta->aid; in mesh_mpm_add_peer()
810 params.peer_aid = sta->peer_aid; in mesh_mpm_add_peer()
812 params.ht_capabilities = sta->ht_capabilities; in mesh_mpm_add_peer()
813 params.vht_capabilities = sta->vht_capabilities; in mesh_mpm_add_peer()
814 params.he_capab = sta->he_capab; in mesh_mpm_add_peer()
815 params.he_capab_len = sta->he_capab_len; in mesh_mpm_add_peer()
816 params.he_6ghz_capab = sta->he_6ghz_capab; in mesh_mpm_add_peer()
817 params.eht_capab = sta->eht_capab; in mesh_mpm_add_peer()
818 params.eht_capab_len = sta->eht_capab_len; in mesh_mpm_add_peer()
821 params.mld_link_id = -1; in mesh_mpm_add_peer()
822 if (conf->security == MESH_CONF_SEC_NONE) { in mesh_mpm_add_peer()
826 sta->flags |= WLAN_STA_MFP; in mesh_mpm_add_peer()
846 struct mesh_conf *conf = wpa_s->ifmsh->mconf; in wpa_mesh_new_mesh_peer()
847 struct hostapd_data *data = wpa_s->ifmsh->bss[0]; in wpa_mesh_new_mesh_peer()
849 struct wpa_ssid *ssid = wpa_s->current_ssid; in wpa_mesh_new_mesh_peer()
855 if (ssid && ssid->no_auto_peer && in wpa_mesh_new_mesh_peer()
856 (is_zero_ether_addr(data->mesh_required_peer) || in wpa_mesh_new_mesh_peer()
857 !ether_addr_equal(data->mesh_required_peer, addr))) { in wpa_mesh_new_mesh_peer()
860 if (data->mesh_pending_auth) { in wpa_mesh_new_mesh_peer()
865 mgmt = wpabuf_head(data->mesh_pending_auth); in wpa_mesh_new_mesh_peer()
866 os_reltime_age(&data->mesh_pending_auth_time, &age); in wpa_mesh_new_mesh_peer()
868 ether_addr_equal(mgmt->sa, addr)) { in wpa_mesh_new_mesh_peer()
876 wpabuf_head(data->mesh_pending_auth), in wpa_mesh_new_mesh_peer()
877 wpabuf_len(data->mesh_pending_auth), in wpa_mesh_new_mesh_peer()
880 wpabuf_free(data->mesh_pending_auth); in wpa_mesh_new_mesh_peer()
881 data->mesh_pending_auth = NULL; in wpa_mesh_new_mesh_peer()
886 if (conf->security == MESH_CONF_SEC_NONE) { in wpa_mesh_new_mesh_peer()
887 if (sta->plink_state < PLINK_OPN_SNT || in wpa_mesh_new_mesh_peer()
888 sta->plink_state > PLINK_ESTAB) in wpa_mesh_new_mesh_peer()
901 fi.datarate = rx_mgmt->datarate; in mesh_mpm_mgmt_rx()
902 fi.ssi_signal = rx_mgmt->ssi_signal; in mesh_mpm_mgmt_rx()
903 ieee802_11_mgmt(wpa_s->ifmsh->bss[0], rx_mgmt->frame, in mesh_mpm_mgmt_rx()
904 rx_mgmt->frame_len, &fi); in mesh_mpm_mgmt_rx()
911 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0]; in mesh_mpm_plink_estab()
912 struct mesh_conf *conf = wpa_s->ifmsh->mconf; in mesh_mpm_plink_estab()
916 MAC2STR(sta->addr)); in mesh_mpm_plink_estab()
918 if (conf->security & MESH_CONF_SEC_AMPE) { in mesh_mpm_plink_estab()
919 wpa_hexdump_key(MSG_DEBUG, "mesh: MTK", sta->mtk, sta->mtk_len); in mesh_mpm_plink_estab()
920 wpa_drv_set_key(wpa_s, -1, in mesh_mpm_plink_estab()
921 wpa_cipher_to_alg(conf->pairwise_cipher), in mesh_mpm_plink_estab()
922 sta->addr, 0, 0, seq, sizeof(seq), in mesh_mpm_plink_estab()
923 sta->mtk, sta->mtk_len, in mesh_mpm_plink_estab()
927 sta->mgtk_rsc, sizeof(sta->mgtk_rsc)); in mesh_mpm_plink_estab()
929 sta->mgtk, sta->mgtk_len); in mesh_mpm_plink_estab()
930 wpa_drv_set_key(wpa_s, -1, in mesh_mpm_plink_estab()
931 wpa_cipher_to_alg(conf->group_cipher), in mesh_mpm_plink_estab()
932 sta->addr, sta->mgtk_key_id, 0, in mesh_mpm_plink_estab()
933 sta->mgtk_rsc, sizeof(sta->mgtk_rsc), in mesh_mpm_plink_estab()
934 sta->mgtk, sta->mgtk_len, in mesh_mpm_plink_estab()
937 if (sta->igtk_len) { in mesh_mpm_plink_estab()
939 sta->igtk_rsc, sizeof(sta->igtk_rsc)); in mesh_mpm_plink_estab()
941 sta->igtk, sta->igtk_len); in mesh_mpm_plink_estab()
943 wpa_s, -1, in mesh_mpm_plink_estab()
944 wpa_cipher_to_alg(conf->mgmt_group_cipher), in mesh_mpm_plink_estab()
945 sta->addr, sta->igtk_key_id, 0, in mesh_mpm_plink_estab()
946 sta->igtk_rsc, sizeof(sta->igtk_rsc), in mesh_mpm_plink_estab()
947 sta->igtk, sta->igtk_len, in mesh_mpm_plink_estab()
953 hapd->num_plinks++; in mesh_mpm_plink_estab()
955 sta->flags |= WLAN_STA_ASSOC; in mesh_mpm_plink_estab()
956 sta->mesh_sae_pmksa_caching = 0; in mesh_mpm_plink_estab()
962 wpas_notify_mesh_peer_connected(wpa_s, sta->addr); in mesh_mpm_plink_estab()
967 enum plink_event event, u16 reason) in mesh_mpm_fsm() argument
969 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0]; in mesh_mpm_fsm()
970 struct mesh_conf *conf = wpa_s->ifmsh->mconf; in mesh_mpm_fsm()
973 MAC2STR(sta->addr), mplstate[sta->plink_state], in mesh_mpm_fsm()
976 switch (sta->plink_state) { in mesh_mpm_fsm()
989 PLINK_CLOSE, reason); in mesh_mpm_fsm()
999 if (!reason) in mesh_mpm_fsm()
1000 reason = WLAN_REASON_MESH_CONFIG_POLICY_VIOLATION; in mesh_mpm_fsm()
1001 /* fall-through */ in mesh_mpm_fsm()
1004 if (!reason) in mesh_mpm_fsm()
1005 reason = WLAN_REASON_MESH_CLOSE_RCVD; in mesh_mpm_fsm()
1007 conf->dot11MeshHoldingTimeout / 1000, in mesh_mpm_fsm()
1008 (conf->dot11MeshHoldingTimeout % 1000) * 1000, in mesh_mpm_fsm()
1011 PLINK_CLOSE, reason); in mesh_mpm_fsm()
1023 conf->dot11MeshConfirmTimeout / 1000, in mesh_mpm_fsm()
1024 (conf->dot11MeshConfirmTimeout % 1000) * 1000, in mesh_mpm_fsm()
1035 if (!reason) in mesh_mpm_fsm()
1036 reason = WLAN_REASON_MESH_CONFIG_POLICY_VIOLATION; in mesh_mpm_fsm()
1037 /* fall-through */ in mesh_mpm_fsm()
1040 if (!reason) in mesh_mpm_fsm()
1041 reason = WLAN_REASON_MESH_CLOSE_RCVD; in mesh_mpm_fsm()
1043 conf->dot11MeshHoldingTimeout / 1000, in mesh_mpm_fsm()
1044 (conf->dot11MeshHoldingTimeout % 1000) * 1000, in mesh_mpm_fsm()
1046 sta->mpm_close_reason = reason; in mesh_mpm_fsm()
1048 PLINK_CLOSE, reason); in mesh_mpm_fsm()
1055 if (conf->security & MESH_CONF_SEC_AMPE) in mesh_mpm_fsm()
1067 if (!reason) in mesh_mpm_fsm()
1068 reason = WLAN_REASON_MESH_CONFIG_POLICY_VIOLATION; in mesh_mpm_fsm()
1069 /* fall-through */ in mesh_mpm_fsm()
1072 if (!reason) in mesh_mpm_fsm()
1073 reason = WLAN_REASON_MESH_CLOSE_RCVD; in mesh_mpm_fsm()
1075 conf->dot11MeshHoldingTimeout / 1000, in mesh_mpm_fsm()
1076 (conf->dot11MeshHoldingTimeout % 1000) * 1000, in mesh_mpm_fsm()
1078 sta->mpm_close_reason = reason; in mesh_mpm_fsm()
1080 PLINK_CLOSE, reason); in mesh_mpm_fsm()
1083 if (conf->security & MESH_CONF_SEC_AMPE) in mesh_mpm_fsm()
1099 if (!reason) in mesh_mpm_fsm()
1100 reason = WLAN_REASON_MESH_CLOSE_RCVD; in mesh_mpm_fsm()
1103 conf->dot11MeshHoldingTimeout / 1000, in mesh_mpm_fsm()
1104 (conf->dot11MeshHoldingTimeout % 1000) * 1000, in mesh_mpm_fsm()
1106 sta->mpm_close_reason = reason; in mesh_mpm_fsm()
1109 " closed with reason %d", in mesh_mpm_fsm()
1110 MAC2STR(sta->addr), reason); in mesh_mpm_fsm()
1112 wpas_notify_mesh_peer_disconnected(wpa_s, sta->addr, in mesh_mpm_fsm()
1113 reason); in mesh_mpm_fsm()
1115 hapd->num_plinks--; in mesh_mpm_fsm()
1118 PLINK_CLOSE, reason); in mesh_mpm_fsm()
1137 reason = sta->mpm_close_reason; in mesh_mpm_fsm()
1139 PLINK_CLOSE, reason); in mesh_mpm_fsm()
1148 mplevent[event], mplstate[sta->plink_state]); in mesh_mpm_fsm()
1158 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0]; in mesh_mpm_action_rx()
1159 struct mesh_conf *mconf = wpa_s->ifmsh->mconf; in mesh_mpm_action_rx()
1168 u16 reason = 0; in mesh_mpm_action_rx() local
1170 if (mgmt->u.action.category != WLAN_ACTION_SELF_PROTECTED) in mesh_mpm_action_rx()
1173 action_field = mgmt->u.action.u.slf_prot_action.action; in mesh_mpm_action_rx()
1179 ies = mgmt->u.action.u.slf_prot_action.variable; in mesh_mpm_action_rx()
1180 ie_len = (const u8 *) mgmt + len - in mesh_mpm_action_rx()
1181 mgmt->u.action.u.slf_prot_action.variable; in mesh_mpm_action_rx()
1196 ie_len -= 2; in mesh_mpm_action_rx()
1202 ie_len -= 2; in mesh_mpm_action_rx()
1238 /* the sender's llid is our plid and vice-versa */ in mesh_mpm_action_rx()
1245 wpa_printf(MSG_DEBUG, "MPM: close reason=%u", in mesh_mpm_action_rx()
1246 WPA_GET_LE16(peer_mgmt_ie.reason)); in mesh_mpm_action_rx()
1248 sta = ap_get_sta(hapd, mgmt->sa); in mesh_mpm_action_rx()
1255 (!(mconf->security & MESH_CONF_SEC_AMPE) || in mesh_mpm_action_rx()
1256 wpa_auth_pmksa_get(hapd->wpa_auth, mgmt->sa, NULL))) in mesh_mpm_action_rx()
1257 sta = mesh_mpm_add_peer(wpa_s, mgmt->sa, &elems); in mesh_mpm_action_rx()
1266 if (sta->sae && sta->sae->state != SAE_ACCEPTED) { in mesh_mpm_action_rx()
1272 if (!sta->my_lid) in mesh_mpm_action_rx()
1275 if (mconf->security & MESH_CONF_SEC_AMPE) { in mesh_mpm_action_rx()
1279 &mgmt->u.action.category, in mesh_mpm_action_rx()
1286 if (action_field == PLINK_OPEN && res == -2) { in mesh_mpm_action_rx()
1287 /* AES-SIV decryption failed */ in mesh_mpm_action_rx()
1296 struct wpa_state_machine *sm = sta->wpa_sm; in mesh_mpm_action_rx()
1299 res = wpa_parse_wpa_ie_rsn(elems.rsn_ie - 2, in mesh_mpm_action_rx()
1311 wpa_auth_set_ocv(sm, mconf->ocv && in mesh_mpm_action_rx()
1317 wpa_auth_uses_ocv(sta->wpa_sm)) { in mesh_mpm_action_rx()
1345 if (sta->plink_state == PLINK_BLOCKED) { in mesh_mpm_action_rx()
1355 reason = WLAN_REASON_MESH_MAX_PEERS; in mesh_mpm_action_rx()
1358 hapd->max_plinks); in mesh_mpm_action_rx()
1359 } else if (sta->peer_lid && sta->peer_lid != plid) { in mesh_mpm_action_rx()
1362 sta->peer_lid, plid); in mesh_mpm_action_rx()
1365 sta->peer_lid = plid; in mesh_mpm_action_rx()
1372 reason = WLAN_REASON_MESH_MAX_PEERS; in mesh_mpm_action_rx()
1375 hapd->max_plinks); in mesh_mpm_action_rx()
1376 } else if (sta->my_lid != llid || in mesh_mpm_action_rx()
1377 (sta->peer_lid && sta->peer_lid != plid)) { in mesh_mpm_action_rx()
1380 sta->my_lid, llid, sta->peer_lid, plid); in mesh_mpm_action_rx()
1383 if (!sta->peer_lid) in mesh_mpm_action_rx()
1384 sta->peer_lid = plid; in mesh_mpm_action_rx()
1385 sta->peer_aid = aid; in mesh_mpm_action_rx()
1390 if (sta->plink_state == PLINK_ESTAB) in mesh_mpm_action_rx()
1401 else if (sta->peer_lid != plid) { in mesh_mpm_action_rx()
1404 sta->peer_lid, plid); in mesh_mpm_action_rx()
1406 } else if (peer_mgmt_ie.plid && sta->my_lid != llid) { in mesh_mpm_action_rx()
1409 sta->my_lid, llid); in mesh_mpm_action_rx()
1423 mesh_mpm_fsm(wpa_s, sta, event, reason); in mesh_mpm_action_rx()
1430 struct wpa_supplicant *wpa_s = hapd->iface->owner; in mesh_mpm_free_sta()
1432 if (sta->plink_state == PLINK_ESTAB) { in mesh_mpm_free_sta()
1433 hapd->num_plinks--; in mesh_mpm_free_sta()
1435 wpa_s, sta->addr, WLAN_REASON_UNSPECIFIED); in mesh_mpm_free_sta()