Lines Matching defs:wpa_s
70 static int mesh_mpm_parse_peer_mgmt(struct wpa_supplicant *wpa_s,
86 wpa_msg(wpa_s, MSG_DEBUG, "MPM: Invalid peer mgmt ie");
122 static u16 copy_supp_rates(struct wpa_supplicant *wpa_s,
127 wpa_msg(wpa_s, MSG_ERROR, "no supported rates from " MACSTR,
134 wpa_msg(wpa_s, MSG_ERROR,
151 static bool matches_local(struct wpa_supplicant *wpa_s,
154 struct mesh_conf *mconf = wpa_s->ifmsh->mconf;
171 static bool llid_in_use(struct wpa_supplicant *wpa_s, u16 llid)
174 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
186 static void mesh_mpm_init_link(struct wpa_supplicant *wpa_s,
194 } while (!llid || llid_in_use(wpa_s, llid));
208 static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s,
214 struct hostapd_iface *ifmsh = wpa_s->ifmsh;
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) {
268 if (type != PLINK_CLOSE && wpa_s->mesh_eht_enabled) {
360 wpa_msg(wpa_s, MSG_INFO, "Mesh MPM: no SAE session");
363 mesh_rsn_get_pmkid(wpa_s->mesh_rsn, sta,
367 if (type != PLINK_CLOSE && wpa_s->mesh_ht_enabled) {
375 if (type != PLINK_CLOSE && wpa_s->mesh_vht_enabled) {
384 if (type != PLINK_CLOSE && wpa_s->mesh_he_enabled) {
405 if (wpa_drv_channel_info(wpa_s, &ci) != 0) {
418 if (type != PLINK_CLOSE && wpa_s->mesh_eht_enabled) {
432 if (ampe && mesh_rsn_protect_frame(wpa_s->mesh_rsn, sta, cat, buf)) {
433 wpa_msg(wpa_s, MSG_INFO,
438 wpa_msg(wpa_s, MSG_DEBUG, "Mesh MPM: Sending peering frame type %d to "
441 ret = wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0,
442 sta->addr, wpa_s->own_addr, wpa_s->own_addr,
445 wpa_msg(wpa_s, MSG_INFO,
454 void wpa_mesh_set_plink_state(struct wpa_supplicant *wpa_s,
461 wpa_msg(wpa_s, MSG_DEBUG, "MPM set " MACSTR " from %s into %s",
473 ret = wpa_drv_sta_add(wpa_s, ¶ms);
475 wpa_msg(wpa_s, MSG_ERROR, "Driver failed to set " MACSTR
481 static void mesh_mpm_fsm_restart(struct wpa_supplicant *wpa_s,
484 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
486 eloop_cancel_timeout(plink_timer, wpa_s, sta);
494 struct wpa_supplicant *wpa_s = eloop_ctx;
497 struct mesh_conf *conf = wpa_s->ifmsh->mconf;
498 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
508 plink_timer, wpa_s, sta);
509 mesh_mpm_send_plink_action(wpa_s, sta, PLINK_OPEN, 0);
520 wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
523 plink_timer, wpa_s, sta);
524 mesh_mpm_send_plink_action(wpa_s, sta, PLINK_CLOSE, reason);
535 mesh_mpm_fsm_restart(wpa_s, sta);
545 mesh_mpm_plink_open(struct wpa_supplicant *wpa_s, struct sta_info *sta,
548 struct mesh_conf *conf = wpa_s->ifmsh->mconf;
550 eloop_cancel_timeout(plink_timer, wpa_s, sta);
553 plink_timer, wpa_s, sta);
554 mesh_mpm_send_plink_action(wpa_s, sta, PLINK_OPEN, 0);
555 wpa_mesh_set_plink_state(wpa_s, sta, next_state);
562 struct wpa_supplicant *wpa_s = ctx;
569 wpa_s, sta->addr, WLAN_REASON_UNSPECIFIED);
571 wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
572 mesh_mpm_send_plink_action(wpa_s, sta, PLINK_CLOSE, reason);
575 eloop_cancel_timeout(plink_timer, wpa_s, sta);
576 eloop_cancel_timeout(mesh_auth_timer, wpa_s, sta);
584 int mesh_mpm_close_peer(struct wpa_supplicant *wpa_s, const u8 *addr)
589 if (!wpa_s->ifmsh) {
590 wpa_msg(wpa_s, MSG_INFO, "Mesh is not prepared yet");
594 hapd = wpa_s->ifmsh->bss[0];
597 wpa_msg(wpa_s, MSG_INFO, "No such mesh peer");
601 return mesh_mpm_plink_close(hapd, sta, wpa_s) == 0 ? 0 : -1;
607 struct wpa_supplicant *wpa_s = eloop_ctx;
608 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
614 int mesh_mpm_connect_peer(struct wpa_supplicant *wpa_s, const u8 *addr,
617 struct wpa_ssid *ssid = wpa_s->current_ssid;
622 if (!wpa_s->ifmsh) {
623 wpa_msg(wpa_s, MSG_INFO, "Mesh is not prepared yet");
628 wpa_msg(wpa_s, MSG_INFO,
633 hapd = wpa_s->ifmsh->bss[0];
634 conf = wpa_s->ifmsh->mconf;
638 wpa_msg(wpa_s, MSG_INFO, "No such mesh peer");
645 wpa_msg(wpa_s, MSG_INFO,
651 mesh_mpm_plink_open(wpa_s, sta, PLINK_OPN_SNT);
653 mesh_rsn_auth_sae_sta(wpa_s, sta);
656 peer_add_timer, wpa_s, NULL);
663 void mesh_mpm_deinit(struct wpa_supplicant *wpa_s, struct hostapd_iface *ifmsh)
668 ap_for_each_sta(hapd, mesh_mpm_plink_close, wpa_s);
672 eloop_cancel_timeout(peer_add_timer, wpa_s, NULL);
678 void mesh_mpm_auth_peer(struct wpa_supplicant *wpa_s, const u8 *addr)
680 struct hostapd_data *data = wpa_s->ifmsh->bss[0];
687 wpa_msg(wpa_s, MSG_DEBUG, "no such mesh peer");
695 mesh_rsn_init_ampe_sta(wpa_s, sta);
703 wpa_msg(wpa_s, MSG_DEBUG, "MPM authenticating " MACSTR,
705 ret = wpa_drv_sta_add(wpa_s, ¶ms);
707 wpa_msg(wpa_s, MSG_ERROR,
713 mesh_mpm_init_link(wpa_s, sta);
715 mesh_mpm_plink_open(wpa_s, sta, PLINK_OPN_SNT);
724 static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
729 struct mesh_conf *conf = wpa_s->ifmsh->mconf;
730 struct hostapd_data *data = wpa_s->ifmsh->bss[0];
737 wpa_msg(wpa_s, MSG_DEBUG,
755 if (copy_supp_rates(wpa_s, sta, elems)) {
761 mesh_mpm_init_link(wpa_s, sta);
769 wpa_msg(wpa_s, MSG_DEBUG, MACSTR
798 wpa_msg(wpa_s, MSG_ERROR, "No AIDs available");
830 ret = wpa_drv_sta_add(wpa_s, ¶ms);
832 wpa_msg(wpa_s, MSG_ERROR,
843 void wpa_mesh_new_mesh_peer(struct wpa_supplicant *wpa_s, const u8 *addr,
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;
851 sta = mesh_mpm_add_peer(wpa_s, addr, elems);
858 wpa_msg(wpa_s, MSG_INFO, "will not initiate new peer link with "
889 mesh_mpm_plink_open(wpa_s, sta, PLINK_OPN_SNT);
891 mesh_rsn_auth_sae_sta(wpa_s, sta);
896 void mesh_mpm_mgmt_rx(struct wpa_supplicant *wpa_s, struct rx_mgmt *rx_mgmt)
903 ieee802_11_mgmt(wpa_s->ifmsh->bss[0], rx_mgmt->frame,
908 static void mesh_mpm_plink_estab(struct wpa_supplicant *wpa_s,
911 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
912 struct mesh_conf *conf = wpa_s->ifmsh->mconf;
915 wpa_msg(wpa_s, MSG_INFO, "mesh plink with " MACSTR " established",
920 wpa_drv_set_key(wpa_s, -1,
930 wpa_drv_set_key(wpa_s, -1,
943 wpa_s, -1,
952 wpa_mesh_set_plink_state(wpa_s, sta, PLINK_ESTAB);
958 eloop_cancel_timeout(peer_add_timer, wpa_s, NULL);
959 peer_add_timer(wpa_s, NULL);
960 eloop_cancel_timeout(plink_timer, wpa_s, sta);
962 wpas_notify_mesh_peer_connected(wpa_s, sta->addr);
966 static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
969 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
970 struct mesh_conf *conf = wpa_s->ifmsh->mconf;
972 wpa_msg(wpa_s, MSG_DEBUG, "MPM " MACSTR " state %s event %s",
980 mesh_mpm_fsm_restart(wpa_s, sta);
983 mesh_mpm_plink_open(wpa_s, sta, PLINK_OPN_RCVD);
984 mesh_mpm_send_plink_action(wpa_s, sta, PLINK_CONFIRM,
988 mesh_mpm_send_plink_action(wpa_s, sta,
1003 wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
1009 plink_timer, wpa_s, sta);
1010 mesh_mpm_send_plink_action(wpa_s, sta,
1015 wpa_mesh_set_plink_state(wpa_s, sta, PLINK_OPN_RCVD);
1016 mesh_mpm_send_plink_action(wpa_s, sta,
1020 wpa_mesh_set_plink_state(wpa_s, sta, PLINK_CNF_RCVD);
1021 eloop_cancel_timeout(plink_timer, wpa_s, sta);
1025 plink_timer, wpa_s, sta);
1039 wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
1045 plink_timer, wpa_s, sta);
1047 mesh_mpm_send_plink_action(wpa_s, sta,
1051 mesh_mpm_send_plink_action(wpa_s, sta,
1056 mesh_rsn_derive_mtk(wpa_s, sta);
1057 mesh_mpm_plink_estab(wpa_s, sta);
1071 wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
1077 plink_timer, wpa_s, sta);
1079 mesh_mpm_send_plink_action(wpa_s, sta,
1084 mesh_rsn_derive_mtk(wpa_s, sta);
1085 mesh_mpm_plink_estab(wpa_s, sta);
1086 mesh_mpm_send_plink_action(wpa_s, sta,
1098 wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
1105 plink_timer, wpa_s, sta);
1108 wpa_msg(wpa_s, MSG_INFO, "mesh plink with " MACSTR
1112 wpas_notify_mesh_peer_disconnected(wpa_s, sta->addr,
1117 mesh_mpm_send_plink_action(wpa_s, sta,
1121 mesh_mpm_send_plink_action(wpa_s, sta,
1131 mesh_mpm_fsm_restart(wpa_s, sta);
1138 mesh_mpm_send_plink_action(wpa_s, sta,
1146 wpa_msg(wpa_s, MSG_DEBUG,
1154 void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s,
1158 struct hostapd_data *hapd = wpa_s->ifmsh->bss[0];
1159 struct mesh_conf *mconf = wpa_s->ifmsh->mconf;
1222 if (!matches_local(wpa_s, &elems)) {
1229 ret = mesh_mpm_parse_peer_mgmt(wpa_s, action_field,
1257 sta = mesh_mpm_add_peer(wpa_s, mgmt->sa, &elems);
1273 mesh_mpm_init_link(wpa_s, sta);
1278 res = mesh_rsn_process_ampe(wpa_s, sta, &elems,
1288 mesh_mpm_fsm(wpa_s, sta, OPN_RJCT,
1322 if (wpa_drv_channel_info(wpa_s, &ci) != 0) {
1423 mesh_mpm_fsm(wpa_s, sta, event, reason);
1430 struct wpa_supplicant *wpa_s = hapd->iface->owner;
1435 wpa_s, sta->addr, WLAN_REASON_UNSPECIFIED);