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