Lines Matching full:s
28 #define fst_printf_session(s, level, format, ...) \ argument
30 (s)->id, (s)->data.fsts_id, \
31 MAC2STR((s)->data.old_peer_addr), \
32 MAC2STR((s)->data.new_peer_addr), \
35 #define fst_printf_siface(s, iface, level, format, ...) \ argument
36 fst_printf_session((s), (level), "%s: " format, \
39 #define fst_printf_sframe(s, is_old, level, format, ...) \ argument
40 fst_printf_siface((s), \
41 (is_old) ? (s)->data.old_iface : (s)->data.new_iface, \
80 #define foreach_fst_session(s) \ argument
81 dl_list_for_each((s), &global_sessions_list, \
84 #define foreach_fst_session_safe(s, temp) \ argument
85 dl_list_for_each_safe((s), (temp), &global_sessions_list, \
110 static inline void fst_session_notify_ctrl(struct fst_session *s, in fst_session_notify_ctrl() argument
114 foreach_fst_ctrl_call(on_event, event_type, NULL, s, extra); in fst_session_notify_ctrl()
118 static void fst_session_set_state(struct fst_session *s, in fst_session_set_state() argument
122 if (s->state != state) { in fst_session_set_state()
125 .old_state = s->state, in fst_session_set_state()
132 fst_session_notify_ctrl(s, EVENT_FST_SESSION_STATE_CHANGED, in fst_session_set_state()
134 fst_printf_session(s, MSG_INFO, "State: %s => %s", in fst_session_set_state()
135 fst_session_state_name(s->state), in fst_session_set_state()
137 s->state = state; in fst_session_set_state()
145 struct fst_session *s; in fst_find_free_session_id() local
150 foreach_fst_session(s) { in fst_find_free_session_id()
151 if (s->id == global_session_id) { in fst_find_free_session_id()
170 struct fst_session *s = user_ctx; in fst_session_timeout_handler() local
177 fst_printf_session(s, MSG_WARNING, "Session State Timeout"); in fst_session_timeout_handler()
178 fst_session_set_state(s, FST_SESSION_STATE_INITIAL, &extra); in fst_session_timeout_handler()
182 static void fst_session_stt_arm(struct fst_session *s) in fst_session_stt_arm() argument
186 fst_session_timeout_handler, NULL, s); in fst_session_stt_arm()
187 s->stt_armed = true; in fst_session_stt_arm()
191 static void fst_session_stt_disarm(struct fst_session *s) in fst_session_stt_disarm() argument
193 if (s->stt_armed) { in fst_session_stt_disarm()
194 eloop_cancel_timeout(fst_session_timeout_handler, NULL, s); in fst_session_stt_disarm()
195 s->stt_armed = false; in fst_session_stt_disarm()
200 static bool fst_session_is_in_transition(struct fst_session *s) in fst_session_is_in_transition() argument
203 return s->stt_armed; in fst_session_is_in_transition()
207 static int fst_session_is_in_progress(struct fst_session *s) in fst_session_is_in_progress() argument
209 return s->state != FST_SESSION_STATE_INITIAL; in fst_session_is_in_progress()
213 static int fst_session_is_ready_pending(struct fst_session *s) in fst_session_is_ready_pending() argument
215 return s->state == FST_SESSION_STATE_SETUP_COMPLETION && in fst_session_is_ready_pending()
216 fst_session_is_in_transition(s); in fst_session_is_ready_pending()
220 static int fst_session_is_ready(struct fst_session *s) in fst_session_is_ready() argument
222 return s->state == FST_SESSION_STATE_SETUP_COMPLETION && in fst_session_is_ready()
223 !fst_session_is_in_transition(s); in fst_session_is_ready()
227 static int fst_session_is_switch_requested(struct fst_session *s) in fst_session_is_switch_requested() argument
229 return s->state == FST_SESSION_STATE_TRANSITION_DONE && in fst_session_is_switch_requested()
230 fst_session_is_in_transition(s); in fst_session_is_switch_requested()
237 struct fst_session *s; in fst_find_session_in_progress() local
239 foreach_fst_session(s) { in fst_find_session_in_progress()
240 if (s->group == g && in fst_find_session_in_progress()
241 (ether_addr_equal(s->data.old_peer_addr, peer_addr) || in fst_find_session_in_progress()
242 ether_addr_equal(s->data.new_peer_addr, peer_addr)) && in fst_find_session_in_progress()
243 fst_session_is_in_progress(s)) in fst_find_session_in_progress()
244 return s; in fst_find_session_in_progress()
251 static void fst_session_reset_ex(struct fst_session *s, enum fst_reason reason) in fst_session_reset_ex() argument
259 if (s->state == FST_SESSION_STATE_SETUP_COMPLETION || in fst_session_reset_ex()
260 s->state == FST_SESSION_STATE_TRANSITION_DONE) in fst_session_reset_ex()
261 fst_session_tear_down_setup(s); in fst_session_reset_ex()
262 fst_session_stt_disarm(s); in fst_session_reset_ex()
263 os_memset(&s->data, 0, sizeof(s->data)); in fst_session_reset_ex()
264 fst_session_set_state(s, FST_SESSION_STATE_INITIAL, &evext); in fst_session_reset_ex()
268 static int fst_session_send_action(struct fst_session *s, bool old_iface, in fst_session_send_action() argument
277 old_iface ? s->data.old_iface : s->data.new_iface; in fst_session_send_action()
287 fst_printf_session(s, MSG_ERROR, in fst_session_send_action()
288 "no %s interface for FST Action '%s' sending", in fst_session_send_action()
300 fst_printf_session(s, MSG_ERROR, in fst_session_send_action()
301 "cannot allocate buffer of %zu bytes for FST Action '%s' sending", in fst_session_send_action()
312 old_iface ? s->data.old_peer_addr : in fst_session_send_action()
313 s->data.new_peer_addr, buf); in fst_session_send_action()
315 fst_printf_siface(s, iface, MSG_ERROR, in fst_session_send_action()
316 "failed to send FST Action '%s'", in fst_session_send_action()
319 fst_printf_siface(s, iface, MSG_DEBUG, "FST Action '%s' sent", in fst_session_send_action()
327 static int fst_session_send_tear_down(struct fst_session *s) in fst_session_send_tear_down() argument
332 if (!fst_session_is_in_progress(s)) { in fst_session_send_tear_down()
333 fst_printf_session(s, MSG_ERROR, "No FST setup to tear down"); in fst_session_send_tear_down()
337 WPA_ASSERT(s->data.old_iface != NULL); in fst_session_send_tear_down()
338 WPA_ASSERT(s->data.new_iface != NULL); in fst_session_send_tear_down()
343 td.fsts_id = host_to_le32(s->data.fsts_id); in fst_session_send_tear_down()
345 res = fst_session_send_action(s, true, &td, sizeof(td), NULL); in fst_session_send_tear_down()
347 fst_printf_sframe(s, true, MSG_INFO, "FST TearDown sent"); in fst_session_send_tear_down()
349 fst_printf_sframe(s, true, MSG_ERROR, in fst_session_send_tear_down()
360 struct fst_session *s; in fst_session_handle_setup_request() local
409 "FST Request: new iface (%s:" MACSTR ") found", in fst_session_handle_setup_request()
413 s = fst_find_session_in_progress(mgmt->sa, g); in fst_session_handle_setup_request()
414 if (s) { in fst_session_handle_setup_request()
427 * the initiator’s MAC address, in which case, the responder in fst_session_handle_setup_request()
430 if (fst_session_is_ready_pending(s) && in fst_session_handle_setup_request()
433 fst_printf_session(s, MSG_WARNING, in fst_session_handle_setup_request()
448 * 3. peer's FST state machines are out of sync due to some in fst_session_handle_setup_request()
454 fst_printf_session(s, MSG_WARNING, in fst_session_handle_setup_request()
459 * initialized before, there's no need to tear down the session. in fst_session_handle_setup_request()
464 if (le_to_host32(req->stie.fsts_id) != s->data.fsts_id) in fst_session_handle_setup_request()
465 fst_session_send_tear_down(s); in fst_session_handle_setup_request()
467 fst_printf_session(s, MSG_WARNING, in fst_session_handle_setup_request()
469 fst_session_set_state(s, FST_SESSION_STATE_INITIAL, &evext); in fst_session_handle_setup_request()
470 fst_session_stt_disarm(s); in fst_session_handle_setup_request()
473 s = fst_session_create(g); in fst_session_handle_setup_request()
474 if (!s) { in fst_session_handle_setup_request()
476 "FST Request dropped: cannot create session for %s and %s", in fst_session_handle_setup_request()
482 fst_session_set_iface(s, iface, true); in fst_session_handle_setup_request()
483 fst_session_set_peer_addr(s, mgmt->sa, true); in fst_session_handle_setup_request()
484 fst_session_set_iface(s, new_iface, false); in fst_session_handle_setup_request()
485 fst_session_set_peer_addr(s, new_iface_peer_addr, false); in fst_session_handle_setup_request()
486 fst_session_set_llt(s, FST_LLT_VAL_TO_MS(le_to_host32(req->llt))); in fst_session_handle_setup_request()
487 s->data.pending_setup_req_dlgt = req->dialog_token; in fst_session_handle_setup_request()
488 s->data.fsts_id = le_to_host32(req->stie.fsts_id); in fst_session_handle_setup_request()
490 fst_session_stt_arm(s); in fst_session_handle_setup_request()
492 fst_session_notify_ctrl(s, EVENT_FST_SETUP, NULL); in fst_session_handle_setup_request()
494 fst_session_set_state(s, FST_SESSION_STATE_SETUP_COMPLETION, NULL); in fst_session_handle_setup_request()
498 static void fst_session_handle_setup_response(struct fst_session *s, in fst_session_handle_setup_response() argument
513 if (iface != s->data.old_iface) { in fst_session_handle_setup_response()
514 fst_printf_session(s, MSG_WARNING, in fst_session_handle_setup_response()
515 "FST Response dropped: %s is not the old iface", in fst_session_handle_setup_response()
520 if (!fst_session_is_ready_pending(s)) { in fst_session_handle_setup_response()
521 fst_printf_session(s, MSG_WARNING, in fst_session_handle_setup_response()
522 "FST Response dropped due to wrong state: %s", in fst_session_handle_setup_response()
523 fst_session_state_name(s->state)); in fst_session_handle_setup_response()
528 fst_printf_session(s, MSG_WARNING, in fst_session_handle_setup_response()
541 if (res->dialog_token != s->data.pending_setup_req_dlgt) { in fst_session_handle_setup_response()
542 fst_printf_session(s, MSG_WARNING, in fst_session_handle_setup_response()
544 s->data.pending_setup_req_dlgt, in fst_session_handle_setup_response()
550 le_to_host32(res->stie.fsts_id) != s->data.fsts_id) { in fst_session_handle_setup_response()
551 fst_printf_session(s, MSG_WARNING, in fst_session_handle_setup_response()
557 fst_session_stt_disarm(s); in fst_session_handle_setup_response()
571 fst_session_set_state(s, FST_SESSION_STATE_INITIAL, &evext); in fst_session_handle_setup_response()
572 fst_printf_session(s, MSG_WARNING, in fst_session_handle_setup_response()
578 fst_iface_get_channel_info(s->data.new_iface, &hw_mode, &channel); in fst_session_handle_setup_response()
582 fst_session_set_state(s, FST_SESSION_STATE_INITIAL, &evext); in fst_session_handle_setup_response()
583 fst_printf_session(s, MSG_WARNING, in fst_session_handle_setup_response()
585 fst_session_tear_down_setup(s); in fst_session_handle_setup_response()
589 fst_printf_session(s, MSG_INFO, in fst_session_handle_setup_response()
590 "%s: FST Setup established for %s (llt=%u)", in fst_session_handle_setup_response()
591 fst_iface_get_name(s->data.old_iface), in fst_session_handle_setup_response()
592 fst_iface_get_name(s->data.new_iface), in fst_session_handle_setup_response()
593 s->data.llt_ms); in fst_session_handle_setup_response()
595 fst_session_notify_ctrl(s, EVENT_FST_ESTABLISHED, NULL); in fst_session_handle_setup_response()
597 if (s->data.llt_ms == FST_LLT_SWITCH_IMMEDIATELY) in fst_session_handle_setup_response()
598 fst_session_initiate_switch(s); in fst_session_handle_setup_response()
602 static void fst_session_handle_tear_down(struct fst_session *s, in fst_session_handle_tear_down() argument
617 fst_printf_session(s, MSG_WARNING, in fst_session_handle_tear_down()
624 if (le_to_host32(td->fsts_id) != s->data.fsts_id) { in fst_session_handle_tear_down()
625 fst_printf_siface(s, iface, MSG_WARNING, in fst_session_handle_tear_down()
631 fst_session_stt_disarm(s); in fst_session_handle_tear_down()
633 fst_session_set_state(s, FST_SESSION_STATE_INITIAL, &evext); in fst_session_handle_tear_down()
637 static void fst_session_handle_ack_request(struct fst_session *s, in fst_session_handle_ack_request() argument
652 if (!fst_session_is_ready(s) && !fst_session_is_switch_requested(s)) { in fst_session_handle_ack_request()
653 fst_printf_siface(s, iface, MSG_ERROR, in fst_session_handle_ack_request()
654 "cannot initiate switch due to wrong session state (%s)", in fst_session_handle_ack_request()
655 fst_session_state_name(s->state)); in fst_session_handle_ack_request()
659 WPA_ASSERT(s->data.new_iface != NULL); in fst_session_handle_ack_request()
661 if (iface != s->data.new_iface) { in fst_session_handle_ack_request()
662 fst_printf_siface(s, iface, MSG_ERROR, in fst_session_handle_ack_request()
668 fst_printf_session(s, MSG_WARNING, in fst_session_handle_ack_request()
675 if (le_to_host32(req->fsts_id) != s->data.fsts_id) { in fst_session_handle_ack_request()
676 fst_printf_siface(s, iface, MSG_WARNING, in fst_session_handle_ack_request()
688 if (!fst_session_send_action(s, false, &res, sizeof(res), NULL)) { in fst_session_handle_ack_request()
689 fst_printf_sframe(s, false, MSG_INFO, "FST Ack Response sent"); in fst_session_handle_ack_request()
690 fst_session_stt_disarm(s); in fst_session_handle_ack_request()
691 fst_session_set_state(s, FST_SESSION_STATE_TRANSITION_DONE, in fst_session_handle_ack_request()
693 fst_session_set_state(s, FST_SESSION_STATE_TRANSITION_CONFIRMED, in fst_session_handle_ack_request()
695 fst_session_set_state(s, FST_SESSION_STATE_INITIAL, &evext); in fst_session_handle_ack_request()
701 fst_session_handle_ack_response(struct fst_session *s, in fst_session_handle_ack_response() argument
715 if (!fst_session_is_switch_requested(s)) { in fst_session_handle_ack_response()
716 fst_printf_siface(s, iface, MSG_ERROR, in fst_session_handle_ack_response()
717 "Ack Response in inappropriate session state (%s)", in fst_session_handle_ack_response()
718 fst_session_state_name(s->state)); in fst_session_handle_ack_response()
722 WPA_ASSERT(s->data.new_iface != NULL); in fst_session_handle_ack_response()
724 if (iface != s->data.new_iface) { in fst_session_handle_ack_response()
725 fst_printf_siface(s, iface, MSG_ERROR, in fst_session_handle_ack_response()
731 fst_printf_session(s, MSG_WARNING, in fst_session_handle_ack_response()
738 if (le_to_host32(res->fsts_id) != s->data.fsts_id) { in fst_session_handle_ack_response()
739 fst_printf_siface(s, iface, MSG_ERROR, in fst_session_handle_ack_response()
745 fst_session_set_state(s, FST_SESSION_STATE_TRANSITION_CONFIRMED, NULL); in fst_session_handle_ack_response()
746 fst_session_set_state(s, FST_SESSION_STATE_INITIAL, &evext); in fst_session_handle_ack_response()
748 fst_session_stt_disarm(s); in fst_session_handle_ack_response()
754 struct fst_session *s; in fst_session_create() local
763 s = os_zalloc(sizeof(*s)); in fst_session_create()
764 if (!s) { in fst_session_create()
769 s->id = id; in fst_session_create()
770 s->group = g; in fst_session_create()
771 s->state = FST_SESSION_STATE_INITIAL; in fst_session_create()
773 s->data.llt_ms = FST_LLT_MS_DEFAULT; in fst_session_create()
775 fst_printf(MSG_INFO, "Session %u created", s->id); in fst_session_create()
777 dl_list_add_tail(&global_sessions_list, &s->global_sessions_lentry); in fst_session_create()
779 foreach_fst_ctrl_call(on_session_added, s); in fst_session_create()
781 return s; in fst_session_create()
785 void fst_session_set_iface(struct fst_session *s, struct fst_iface *iface, in fst_session_set_iface() argument
789 s->data.old_iface = iface; in fst_session_set_iface()
791 s->data.new_iface = iface; in fst_session_set_iface()
796 void fst_session_set_llt(struct fst_session *s, u32 llt) in fst_session_set_llt() argument
798 s->data.llt_ms = llt; in fst_session_set_llt()
802 void fst_session_set_peer_addr(struct fst_session *s, const u8 *addr, in fst_session_set_peer_addr() argument
805 u8 *a = is_old ? s->data.old_peer_addr : s->data.new_peer_addr; in fst_session_set_peer_addr()
811 int fst_session_initiate_setup(struct fst_session *s) in fst_session_initiate_setup() argument
819 if (fst_session_is_in_progress(s)) { in fst_session_initiate_setup()
820 fst_printf_session(s, MSG_ERROR, "Session in progress"); in fst_session_initiate_setup()
824 if (is_zero_ether_addr(s->data.old_peer_addr)) { in fst_session_initiate_setup()
825 fst_printf_session(s, MSG_ERROR, "No old peer MAC address"); in fst_session_initiate_setup()
829 if (is_zero_ether_addr(s->data.new_peer_addr)) { in fst_session_initiate_setup()
830 fst_printf_session(s, MSG_ERROR, "No new peer MAC address"); in fst_session_initiate_setup()
834 if (!s->data.old_iface) { in fst_session_initiate_setup()
835 fst_printf_session(s, MSG_ERROR, "No old interface defined"); in fst_session_initiate_setup()
839 if (!s->data.new_iface) { in fst_session_initiate_setup()
840 fst_printf_session(s, MSG_ERROR, "No new interface defined"); in fst_session_initiate_setup()
844 if (s->data.new_iface == s->data.old_iface) { in fst_session_initiate_setup()
845 fst_printf_session(s, MSG_ERROR, in fst_session_initiate_setup()
850 if (!fst_iface_is_connected(s->data.old_iface, s->data.old_peer_addr, in fst_session_initiate_setup()
852 fst_printf_session(s, MSG_ERROR, in fst_session_initiate_setup()
857 if (!fst_iface_is_connected(s->data.new_iface, s->data.new_peer_addr, in fst_session_initiate_setup()
859 fst_printf_session(s, MSG_ERROR, in fst_session_initiate_setup()
864 _s = fst_find_session_in_progress(s->data.old_peer_addr, s->group); in fst_session_initiate_setup()
866 fst_printf_session(s, MSG_ERROR, in fst_session_initiate_setup()
872 _s = fst_find_session_in_progress(s->data.new_peer_addr, s->group); in fst_session_initiate_setup()
874 fst_printf_session(s, MSG_ERROR, in fst_session_initiate_setup()
880 dialog_token = fst_group_assign_dialog_token(s->group); in fst_session_initiate_setup()
881 fsts_id = fst_group_assign_fsts_id(s->group); in fst_session_initiate_setup()
885 fst_printf_siface(s, s->data.old_iface, MSG_INFO, in fst_session_initiate_setup()
886 "initiating FST setup for %s (llt=%u ms)", in fst_session_initiate_setup()
887 fst_iface_get_name(s->data.new_iface), s->data.llt_ms); in fst_session_initiate_setup()
891 req.llt = host_to_le32(FST_LLT_MS_TO_VAL(s->data.llt_ms)); in fst_session_initiate_setup()
898 req.stie.new_band_id = fst_iface_get_band_id(s->data.new_iface); in fst_session_initiate_setup()
902 req.stie.old_band_id = fst_iface_get_band_id(s->data.old_iface); in fst_session_initiate_setup()
906 res = fst_session_send_action(s, true, &req, sizeof(req), in fst_session_initiate_setup()
907 fst_iface_get_mbie(s->data.old_iface)); in fst_session_initiate_setup()
909 s->data.fsts_id = fsts_id; in fst_session_initiate_setup()
910 s->data.pending_setup_req_dlgt = dialog_token; in fst_session_initiate_setup()
911 fst_printf_sframe(s, true, MSG_INFO, "FST Setup Request sent"); in fst_session_initiate_setup()
912 fst_session_set_state(s, FST_SESSION_STATE_SETUP_COMPLETION, in fst_session_initiate_setup()
915 fst_session_stt_arm(s); in fst_session_initiate_setup()
922 int fst_session_respond(struct fst_session *s, u8 status_code) in fst_session_respond() argument
928 if (!fst_session_is_ready_pending(s)) { in fst_session_respond()
929 fst_printf_session(s, MSG_ERROR, "incorrect state: %s", in fst_session_respond()
930 fst_session_state_name(s->state)); in fst_session_respond()
934 if (is_zero_ether_addr(s->data.old_peer_addr)) { in fst_session_respond()
935 fst_printf_session(s, MSG_ERROR, "No peer MAC address"); in fst_session_respond()
939 if (!s->data.old_iface) { in fst_session_respond()
940 fst_printf_session(s, MSG_ERROR, "No old interface defined"); in fst_session_respond()
944 if (!s->data.new_iface) { in fst_session_respond()
945 fst_printf_session(s, MSG_ERROR, "No new interface defined"); in fst_session_respond()
949 if (s->data.new_iface == s->data.old_iface) { in fst_session_respond()
950 fst_printf_session(s, MSG_ERROR, in fst_session_respond()
955 if (!fst_iface_is_connected(s->data.old_iface, in fst_session_respond()
956 s->data.old_peer_addr, false)) { in fst_session_respond()
957 fst_printf_session(s, MSG_ERROR, in fst_session_respond()
962 fst_session_stt_disarm(s); in fst_session_respond()
967 res.dialog_token = s->data.pending_setup_req_dlgt; in fst_session_respond()
974 res.stie.fsts_id = host_to_le32(s->data.fsts_id); in fst_session_respond()
977 fst_iface_get_channel_info(s->data.new_iface, &hw_mode, in fst_session_respond()
983 fst_iface_get_channel_info(s->data.old_iface, &hw_mode, in fst_session_respond()
989 fst_printf_session(s, MSG_INFO, in fst_session_respond()
990 "%s: FST Setup Request accepted for %s (llt=%u)", in fst_session_respond()
991 fst_iface_get_name(s->data.old_iface), in fst_session_respond()
992 fst_iface_get_name(s->data.new_iface), in fst_session_respond()
993 s->data.llt_ms); in fst_session_respond()
995 fst_printf_session(s, MSG_WARNING, in fst_session_respond()
996 "%s: FST Setup Request rejected with code %d", in fst_session_respond()
997 fst_iface_get_name(s->data.old_iface), in fst_session_respond()
1001 if (fst_session_send_action(s, true, &res, sizeof(res), in fst_session_respond()
1002 fst_iface_get_mbie(s->data.old_iface))) { in fst_session_respond()
1003 fst_printf_sframe(s, true, MSG_ERROR, in fst_session_respond()
1009 fst_printf_sframe(s, true, MSG_INFO, "FST Setup Response sent"); in fst_session_respond()
1019 fst_session_set_state(s, FST_SESSION_STATE_INITIAL, &evext); in fst_session_respond()
1026 int fst_session_initiate_switch(struct fst_session *s) in fst_session_initiate_switch() argument
1032 if (!fst_session_is_ready(s)) { in fst_session_initiate_switch()
1033 fst_printf_session(s, MSG_ERROR, in fst_session_initiate_switch()
1035 s->state); in fst_session_initiate_switch()
1039 dialog_token = fst_group_assign_dialog_token(s->group); in fst_session_initiate_switch()
1041 WPA_ASSERT(s->data.new_iface != NULL); in fst_session_initiate_switch()
1042 WPA_ASSERT(s->data.old_iface != NULL); in fst_session_initiate_switch()
1044 fst_printf_session(s, MSG_INFO, "initiating FST switch: %s => %s", in fst_session_initiate_switch()
1045 fst_iface_get_name(s->data.old_iface), in fst_session_initiate_switch()
1046 fst_iface_get_name(s->data.new_iface)); in fst_session_initiate_switch()
1052 req.fsts_id = host_to_le32(s->data.fsts_id); in fst_session_initiate_switch()
1054 res = fst_session_send_action(s, false, &req, sizeof(req), NULL); in fst_session_initiate_switch()
1056 fst_printf_sframe(s, false, MSG_INFO, "FST Ack Request sent"); in fst_session_initiate_switch()
1057 fst_session_set_state(s, FST_SESSION_STATE_TRANSITION_DONE, in fst_session_initiate_switch()
1059 fst_session_stt_arm(s); in fst_session_initiate_switch()
1061 fst_printf_sframe(s, false, MSG_ERROR, in fst_session_initiate_switch()
1069 void fst_session_handle_action(struct fst_session *s, in fst_session_handle_action() argument
1079 fst_session_handle_setup_response(s, iface, mgmt, frame_len); in fst_session_handle_action()
1082 fst_session_handle_tear_down(s, iface, mgmt, frame_len); in fst_session_handle_action()
1085 fst_session_handle_ack_request(s, iface, mgmt, frame_len); in fst_session_handle_action()
1088 fst_session_handle_ack_response(s, iface, mgmt, frame_len); in fst_session_handle_action()
1092 fst_printf_sframe(s, false, MSG_ERROR, in fst_session_handle_action()
1099 int fst_session_tear_down_setup(struct fst_session *s) in fst_session_tear_down_setup() argument
1109 res = fst_session_send_tear_down(s); in fst_session_tear_down_setup()
1111 fst_session_set_state(s, FST_SESSION_STATE_INITIAL, &evext); in fst_session_tear_down_setup()
1117 void fst_session_reset(struct fst_session *s) in fst_session_reset() argument
1119 fst_session_reset_ex(s, REASON_RESET); in fst_session_reset()
1123 void fst_session_delete(struct fst_session *s) in fst_session_delete() argument
1125 fst_printf(MSG_INFO, "Session %u deleted", s->id); in fst_session_delete()
1126 dl_list_del(&s->global_sessions_lentry); in fst_session_delete()
1127 foreach_fst_ctrl_call(on_session_removed, s); in fst_session_delete()
1128 os_free(s); in fst_session_delete()
1132 struct fst_group * fst_session_get_group(struct fst_session *s) in fst_session_get_group() argument
1134 return s->group; in fst_session_get_group()
1138 struct fst_iface * fst_session_get_iface(struct fst_session *s, bool is_old) in fst_session_get_iface() argument
1140 return is_old ? s->data.old_iface : s->data.new_iface; in fst_session_get_iface()
1144 u32 fst_session_get_id(struct fst_session *s) in fst_session_get_id() argument
1146 return s->id; in fst_session_get_id()
1150 const u8 * fst_session_get_peer_addr(struct fst_session *s, bool is_old) in fst_session_get_peer_addr() argument
1152 return is_old ? s->data.old_peer_addr : s->data.new_peer_addr; in fst_session_get_peer_addr()
1156 u32 fst_session_get_llt(struct fst_session *s) in fst_session_get_llt() argument
1158 return s->data.llt_ms; in fst_session_get_llt()
1162 enum fst_session_state fst_session_get_state(struct fst_session *s) in fst_session_get_state() argument
1164 return s->state; in fst_session_get_state()
1170 struct fst_session *s; in fst_session_get_by_id() local
1172 foreach_fst_session(s) { in fst_session_get_by_id()
1173 if (id == s->id) in fst_session_get_by_id()
1174 return s; in fst_session_get_by_id()
1183 struct fst_session *s; in fst_session_enum() local
1185 foreach_fst_session(s) { in fst_session_enum()
1186 if (!g || s->group == g) in fst_session_enum()
1187 clb(s->group, s, ctx); in fst_session_enum()
1196 struct fst_session *s; in fst_session_on_action_rx() local
1207 "FST Action '%s' received!", in fst_session_on_action_rx()
1221 s = fst_find_session_in_progress(mgmt->sa, fst_iface_get_group(iface)); in fst_session_on_action_rx()
1222 if (s) { in fst_session_on_action_rx()
1223 fst_session_handle_action(s, iface, mgmt, len); in fst_session_on_action_rx()
1226 "FST Action '%s' dropped: no session in progress found", in fst_session_on_action_rx()
1232 int fst_session_set_str_ifname(struct fst_session *s, const char *ifname, in fst_session_set_str_ifname() argument
1235 struct fst_group *g = fst_session_get_group(s); in fst_session_set_str_ifname()
1240 fst_printf_session(s, MSG_WARNING, in fst_session_set_str_ifname()
1241 "Cannot set iface %s: no such iface within group '%s'", in fst_session_set_str_ifname()
1246 fst_session_set_iface(s, i, is_old); in fst_session_set_str_ifname()
1252 int fst_session_set_str_peer_addr(struct fst_session *s, const char *mac, in fst_session_set_str_peer_addr() argument
1261 fst_session_set_peer_addr(s, peer_addr, is_old); in fst_session_set_str_peer_addr()
1267 int fst_session_set_str_llt(struct fst_session *s, const char *llt_str) in fst_session_set_str_llt() argument
1273 fst_printf_session(s, MSG_WARNING, in fst_session_set_str_llt()
1274 "Cannot set llt %s: Invalid llt value (1..%u expected)", in fst_session_set_str_llt()
1278 fst_session_set_llt(s, (u32) llt); in fst_session_set_str_llt()
1286 struct fst_session *s; in fst_session_global_on_iface_detached() local
1288 foreach_fst_session(s) { in fst_session_global_on_iface_detached()
1289 if (fst_session_is_in_progress(s) && in fst_session_global_on_iface_detached()
1290 (s->data.new_iface == iface || in fst_session_global_on_iface_detached()
1291 s->data.old_iface == iface)) in fst_session_global_on_iface_detached()
1292 fst_session_reset_ex(s, REASON_DETACH_IFACE); in fst_session_global_on_iface_detached()
1299 struct fst_session *s; in fst_session_global_get_first_by_group() local
1301 foreach_fst_session(s) { in fst_session_global_get_first_by_group()
1302 if (s->group == g) in fst_session_global_get_first_by_group()
1303 return s; in fst_session_global_get_first_by_group()
1312 static int get_group_fill_session(struct fst_group **g, struct fst_session *s) in get_group_fill_session() argument
1317 os_memset(s, 0, sizeof(*s)); in get_group_fill_session()
1319 s->data.new_iface = fst_group_first_iface(*g); in get_group_fill_session()
1320 if (s->data.new_iface) in get_group_fill_session()
1323 if (!s->data.new_iface) in get_group_fill_session()
1326 s->data.old_iface = dl_list_entry(s->data.new_iface->group_lentry.next, in get_group_fill_session()
1328 if (!s->data.old_iface) in get_group_fill_session()
1331 old_addr = fst_iface_get_peer_first(s->data.old_iface, &ctx, true); in get_group_fill_session()
1335 new_addr = fst_iface_get_peer_first(s->data.new_iface, &ctx, true); in get_group_fill_session()
1339 os_memcpy(s->data.old_peer_addr, old_addr, ETH_ALEN); in get_group_fill_session()
1340 os_memcpy(s->data.new_peer_addr, new_addr, ETH_ALEN); in get_group_fill_session()
1354 struct fst_session s; in fst_test_req_send_fst_request() local
1367 if (get_group_fill_session(&g, &s)) in fst_test_req_send_fst_request()
1379 fst_iface_get_channel_info(s.data.new_iface, &hw_mode, &channel); in fst_test_req_send_fst_request()
1384 fst_iface_get_channel_info(s.data.old_iface, &hw_mode, &channel); in fst_test_req_send_fst_request()
1395 return fst_session_send_action(&s, true, &req, sizeof(req), in fst_test_req_send_fst_request()
1396 s.data.old_iface->mb_ie); in fst_test_req_send_fst_request()
1406 struct fst_session s; in fst_test_req_send_fst_response() local
1421 if (get_group_fill_session(&g, &s)) in fst_test_req_send_fst_response()
1438 _s = fst_find_session_in_progress(fst_session_get_peer_addr(&s, true), in fst_test_req_send_fst_response()
1451 fst_iface_get_channel_info(s.data.new_iface, &hw_mode, in fst_test_req_send_fst_response()
1457 fst_iface_get_channel_info(s.data.old_iface, &hw_mode, in fst_test_req_send_fst_response()
1470 return fst_session_send_action(&s, true, &res, sizeof(res), in fst_test_req_send_fst_response()
1471 s.data.old_iface->mb_ie); in fst_test_req_send_fst_response()
1481 struct fst_session s; in fst_test_req_send_ack_request() local
1491 if (get_group_fill_session(&g, &s)) in fst_test_req_send_ack_request()
1499 return fst_session_send_action(&s, false, &req, sizeof(req), NULL); in fst_test_req_send_ack_request()
1509 struct fst_session s; in fst_test_req_send_ack_response() local
1519 if (get_group_fill_session(&g, &s)) in fst_test_req_send_ack_response()
1527 return fst_session_send_action(&s, false, &res, sizeof(res), NULL); in fst_test_req_send_ack_response()
1537 struct fst_session s; in fst_test_req_send_tear_down() local
1547 if (get_group_fill_session(&g, &s)) in fst_test_req_send_tear_down()
1554 return fst_session_send_action(&s, true, &td, sizeof(td), NULL); in fst_test_req_send_tear_down()
1563 struct fst_session *s; in fst_test_req_get_fsts_id() local
1572 s = fst_session_get_by_id(sid); in fst_test_req_get_fsts_id()
1573 if (!s) in fst_test_req_get_fsts_id()
1576 return s->data.fsts_id; in fst_test_req_get_fsts_id()