summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
authorJérémy Dufour2010-08-27 11:43:53 +0200
committerJérémy Dufour2010-08-27 17:32:01 +0200
commit044a2ed0dcf0e8376eb1d08edbdd42ab49f41e75 (patch)
tree0736d30367300eb11efb282146a1919481599cc2 /cesar/cp
parent47597bec56b0d571e4d8e2fdefb511ab633482e0 (diff)
cesar/cp/{fsm,sta/action}: SC_ADD timeout don't trigger to_leave, closes #1841
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/fsm/src/fsm/cp.fsm12
-rw-r--r--cesar/cp/sta/action/sc.h12
-rw-r--r--cesar/cp/sta/action/src/sc.c7
-rw-r--r--cesar/cp/sta/action/test/utest/inc/scenario_defs.h2
-rw-r--r--cesar/cp/sta/action/test/utest/src/sc.c29
-rw-r--r--cesar/cp/sta/action/test/utest/src/scenario_actions.c1
6 files changed, 58 insertions, 5 deletions
diff --git a/cesar/cp/fsm/src/fsm/cp.fsm b/cesar/cp/fsm/src/fsm/cp.fsm
index f636dd87e0..e40bafde38 100644
--- a/cesar/cp/fsm/src/fsm/cp.fsm
+++ b/cesar/cp/fsm/src/fsm/cp.fsm
@@ -604,9 +604,17 @@ SC_NMK_EXCHANGE:
CM_SET_KEY_CNF_PID3: nok -> SC_IDLE
Check MME. If ok, authentication can start.
-SC_ADD, SC_WAIT_PEER_ASSOCIATED, SC_JOIN, SC_BUILDING_TEK, SC_NMK_EXCHANGE, SC_WAIT_BEACON:
+SC_WAIT_PEER_ASSOCIATED, SC_JOIN, SC_BUILDING_TEK, SC_NMK_EXCHANGE, SC_WAIT_BEACON:
sc_timeout -> SC_IDLE [cp_sta_action_sc__sc_timeout]
- SC Procedure is abort, tell it to the CP FSM.
+ SC Procedure is aborted, tell it to the CP FSM and stop association FSM.
+ to_stop -> SC_IDLE [cp_sta_action_sc__to_stop]
+ Timer stop is handled when going to SC_IDLE, just need to tell the top FSP
+ the SC procedure is abort.
+
+SC_ADD:
+ sc_timeout -> SC_IDLE [cp_sta_action_sc_add__sc_timeout]
+ SC Procedure is aborted, tell it to the CP FSM but not to the association
+ FSM.
to_stop -> SC_IDLE [cp_sta_action_sc__to_stop]
Timer stop is handled when going to SC_IDLE, just need to tell the top FSP
the SC procedure is abort.
diff --git a/cesar/cp/sta/action/sc.h b/cesar/cp/sta/action/sc.h
index f9540ef86d..4d9a8c3ac1 100644
--- a/cesar/cp/sta/action/sc.h
+++ b/cesar/cp/sta/action/sc.h
@@ -72,12 +72,22 @@ cp_sta_action_sc__sc_join__leave (cp_t *ctx);
* Handle * => SC_TIMEOUT.
* \param ctx control plane context.
*
- * Tell the CP FSM the SC FSM is finished with an error.
+ * SC Procedure is aborted, tell it to the CP FSM and stop association FSM.
*/
void
cp_sta_action_sc__sc_timeout (cp_t *ctx);
/**
+ * Handle SC_ADD => SC_TIMEOUT.
+ * \param ctx control plane context.
+ *
+ * SC Procedure is aborded, tell it to the CP FSM but not to the association
+ * FSM.
+ */
+void
+cp_sta_action_sc_add__sc_timeout (cp_t *ctx);
+
+/**
* Handle SC_ADD => CM_SC_JOIN.REQ.
* \param ctx control plane context.
*
diff --git a/cesar/cp/sta/action/src/sc.c b/cesar/cp/sta/action/src/sc.c
index bea9e43efc..e76a01b5ea 100644
--- a/cesar/cp/sta/action/src/sc.c
+++ b/cesar/cp/sta/action/src/sc.c
@@ -238,6 +238,13 @@ cp_sta_action_sc__sc_timeout (cp_t *ctx)
}
void
+cp_sta_action_sc_add__sc_timeout (cp_t *ctx)
+{
+ /* Generate the event for the CP FSM. */
+ cp_fsm_post_new_event (ctx, bare, sc_failed);
+}
+
+void
cp_sta_action_sc__sc_add__cm_sc_join_req (cp_t *ctx, cp_mme_rx_t *mme)
{
/* Check parameters. */
diff --git a/cesar/cp/sta/action/test/utest/inc/scenario_defs.h b/cesar/cp/sta/action/test/utest/inc/scenario_defs.h
index 75c7be5eba..2926fef310 100644
--- a/cesar/cp/sta/action/test/utest/inc/scenario_defs.h
+++ b/cesar/cp/sta/action/test/utest/inc/scenario_defs.h
@@ -133,6 +133,7 @@
sc__sc_join__leave, \
sc__sc_join__sc_join_req_timeout, \
sc__sc_timeout, \
+ sc_add__sc_timeout, \
sc__sc_join__cm_sc_join_cnf, \
sc__sc_join__cm_sc_join_req, \
sc__sc_add__cm_sc_join_req, \
@@ -313,6 +314,7 @@ __0 (sc__sc_join__enter)
__0 (sc__sc_join__leave)
__0 (sc__sc_join__sc_join_req_timeout)
__0 (sc__sc_timeout)
+__0 (sc_add__sc_timeout)
__m (sc__sc_join__cm_sc_join_cnf)
__m (sc__sc_join__cm_sc_join_req)
__m (sc__sc_add__cm_sc_join_req)
diff --git a/cesar/cp/sta/action/test/utest/src/sc.c b/cesar/cp/sta/action/test/utest/src/sc.c
index 8e83f3d37a..568a65aae1 100644
--- a/cesar/cp/sta/action/test/utest/src/sc.c
+++ b/cesar/cp/sta/action/test/utest/src/sc.c
@@ -133,8 +133,8 @@ sc_basic_test_cases (test_t t)
}
} test_end;
- /* Timeout of the whole SC procedure. */
- test_begin (t, "timeout of SC procedure")
+ /* Timeout of the whole SC procedure not in SC_ADD. */
+ test_begin (t, "timeout of SC procedure (not in SC_ADD)")
{
/* No answer, main timeout of SC join procedure occurs. */
scenario_entry_t sc_main_timeout[] = {
@@ -161,6 +161,31 @@ sc_basic_test_cases (test_t t)
scenario_run (t, sc_main_timeout, &globals);
} test_end;
+ /* Timeout of the whole SC procedure in SC_ADD. */
+ test_begin (t, "timeout of SC procedure (in SC_ADD)")
+ {
+ /* No answer, main timeout of SC join procedure occurs. */
+ scenario_entry_t sc_main_timeout[] = {
+ /* First, execute transition. */
+ SCENARIO_ACTION (sc_add__sc_timeout),
+ /* Tell CP FSM we failed. */
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_sc_failed),
+ /* Second, leave the SC_IDLE. */
+ SCENARIO_ACTION (sc__sc_join__leave),
+ /* Stop SC join timer. */
+ SCENARIO_EVENT (cp_sta_core_stop_timed_or_cyclic_event),
+ /* Last, enter SC_IDLE. */
+ SCENARIO_ACTION (sc__sc_idle__enter),
+ /* Stop timer. */
+ SCENARIO_EVENT (cp_sta_core_stop_timed_or_cyclic_event),
+ /* Check SC status has been updated. */
+ SCENARIO_ACTION (sc__check_sc_status, .sc_status = false),
+ SCENARIO_END
+ };
+ scenario_run (t, sc_main_timeout, &globals);
+ } test_end;
+
/* Test SC join procedure with a STA replying with an SC_JOIN.CNF. */
test_begin (t, "SC_JOIN.CNF received from unassociated STA, decoding"
" failed")
diff --git a/cesar/cp/sta/action/test/utest/src/scenario_actions.c b/cesar/cp/sta/action/test/utest/src/scenario_actions.c
index 106622fbd0..0614bdcacc 100644
--- a/cesar/cp/sta/action/test/utest/src/scenario_actions.c
+++ b/cesar/cp/sta/action/test/utest/src/scenario_actions.c
@@ -192,6 +192,7 @@ __0 (sc__sc_join__enter)
__0 (sc__sc_join__leave)
__0 (sc__sc_join__sc_join_req_timeout)
__0 (sc__sc_timeout)
+__0 (sc_add__sc_timeout)
__m (sc__sc_join__cm_sc_join_cnf)
__m (sc__sc_join__cm_sc_join_req)
__m (sc__sc_add__cm_sc_join_req)