summaryrefslogtreecommitdiff
path: root/cesar/cp/sta/action/src/assoc.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/sta/action/src/assoc.c')
-rw-r--r--cesar/cp/sta/action/src/assoc.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/cesar/cp/sta/action/src/assoc.c b/cesar/cp/sta/action/src/assoc.c
index ab17d149d2..97516b8e61 100644
--- a/cesar/cp/sta/action/src/assoc.c
+++ b/cesar/cp/sta/action/src/assoc.c
@@ -667,16 +667,31 @@ cp_sta_action_assoc__authenticated__to_leave (cp_t *ctx)
dbg_assert (ctx);
/* Get our CCo. */
cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
- cp_mme_peer_t peer;
- cp_net_get_cco_peer (ctx, our_net, &peer);
- /* Start timer. */
- cp_fsm_event_t *event = cp_fsm_event_bare_new (
- ctx, CP_FSM_EVENT_TYPE_assoc_timeout);
- cp_sta_core_gen_timed_event (ctx, &ctx->sta_action.assoc.timer, event,
- LEAVING_TIMEOUT_MS);
- /* Send leave request. */
- cp_msg_cc_leave_req_send (ctx, &peer,
- CP_MSG_CC_LEAVE_REQ_REASON_USER_REQUEST);
+ /* If we were the CCo and we cannot provide the CCo role to another
+ * station (Handover failure because no station were authenticated in the
+ * AVLN) we must not send any MME to the CCo. */
+ cp_sta_t *cco = cp_net_get_cco (ctx, our_net);
+ if (cco)
+ {
+ cp_mme_peer_t peer;
+ cp_sta_get_peer (cco, &peer);
+ /* Start timer. */
+ cp_fsm_event_t *event = cp_fsm_event_bare_new (
+ ctx, CP_FSM_EVENT_TYPE_assoc_timeout);
+ cp_sta_core_gen_timed_event (ctx, &ctx->sta_action.assoc.timer, event,
+ LEAVING_TIMEOUT_MS);
+ /* Send leave request. */
+ cp_msg_cc_leave_req_send (ctx, &peer,
+ CP_MSG_CC_LEAVE_REQ_REASON_USER_REQUEST);
+ slab_release (cco);
+ /* Branch to the LEAVING state. */
+ cp_fsm_branch (ctx, AUTHENTICATED, to_leave, cco);
+ }
+ else
+ {
+ /* Branch to the UNASSOCIATED state. */
+ cp_fsm_branch (ctx, AUTHENTICATED, to_leave, no_cco);
+ }
}
void