Stefan Sperling has uploaded this change for review. ( 
https://gerrit.osmocom.org/12364


Change subject: fix ipa_asp_fsm down state transition
......................................................................

fix ipa_asp_fsm down state transition

Properly transition into IPA_ASP_S_DOWN from IPA_ASP_S_ACTIVE
and fix the mask of legal out states from IPA_ASP_S_ACTIVE.

BSC-sccplite tests are still passing with this change.

Change-Id: Idb8e7bd1c74a4b47080fe32ebe0161c503ead571
Related: OS#3111
---
M src/xua_asp_fsm.c
1 file changed, 26 insertions(+), 22 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/64/12364/1

diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index d6edac0..b0c672b 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -916,6 +916,28 @@
        }
 }

+static void ipa_asp_fsm_del_route(struct osmo_fsm_inst *fi)
+{
+       struct ipa_asp_fsm_priv *iafp = fi->priv;
+       struct osmo_ss7_asp *asp = iafp->asp;
+       struct osmo_ss7_instance *inst = asp->inst;
+       struct osmo_ss7_as *as = osmo_ss7_as_find_by_rctx(inst, 0);
+       struct osmo_ss7_route *rt;
+
+       OSMO_ASSERT(as);
+
+       /* find the route which we have created if we ever reached 
ipa_asp_fsm_wait_id_ack2 */
+       rt = osmo_ss7_route_find_dpc_mask(inst->rtable_system, 
as->cfg.routing_key.pc, 0xffffff);
+       /* no route found, bail out */
+       if (!rt)
+               return;
+       /* route points to different AS, bail out */
+       if (rt->dest.as != as)
+               return;
+
+       osmo_ss7_route_destroy(rt);
+       osmo_timer_del(&iafp->pong_timer);
+}

 /* Server + Client: We're actively transmitting user data */
 static void ipa_asp_fsm_active(struct osmo_fsm_inst *fi, uint32_t event, void 
*data)
@@ -923,7 +945,8 @@
        switch (event) {
        case XUA_ASP_E_M_ASP_DOWN_REQ:
        case XUA_ASP_E_M_ASP_INACTIVE_REQ:
-               /* FIXME: kill ASP and (wait for) re-connect */
+               ipa_asp_fsm_del_route(fi);
+               osmo_fsm_inst_state_chg(fi, IPA_ASP_S_DOWN, 0, 0);
                break;
        }
 }
@@ -1025,8 +1048,7 @@
        [IPA_ASP_S_ACTIVE] = {
                .in_event_mask = S(XUA_ASP_E_M_ASP_DOWN_REQ) |
                                 S(XUA_ASP_E_M_ASP_INACTIVE_REQ),
-               .out_state_mask = S(XUA_ASP_S_INACTIVE) |
-                                 S(XUA_ASP_S_DOWN),
+               .out_state_mask = S(IPA_ASP_S_DOWN),
                .name = "ASP_ACTIVE",
                .action = ipa_asp_fsm_active,
                .onenter = ipa_asp_fsm_active_onenter,
@@ -1035,25 +1057,7 @@

 static void ipa_asp_fsm_cleanup(struct osmo_fsm_inst *fi, enum 
osmo_fsm_term_cause cause)
 {
-       struct ipa_asp_fsm_priv *iafp = fi->priv;
-       struct osmo_ss7_asp *asp = iafp->asp;
-       struct osmo_ss7_instance *inst = asp->inst;
-       struct osmo_ss7_as *as = osmo_ss7_as_find_by_rctx(inst, 0);
-       struct osmo_ss7_route *rt;
-
-       OSMO_ASSERT(as);
-
-       /* find the route which we have created if we ever reached 
ipa_asp_fsm_wait_id_ack2 */
-       rt = osmo_ss7_route_find_dpc_mask(inst->rtable_system, 
as->cfg.routing_key.pc, 0xffffff);
-       /* no route found, bail out */
-       if (!rt)
-               return;
-       /* route points to different AS, bail out */
-       if (rt->dest.as != as)
-               return;
-
-       osmo_ss7_route_destroy(rt);
-       osmo_timer_del(&iafp->pong_timer);
+       ipa_asp_fsm_del_route(fi);
 }

 struct osmo_fsm ipa_asp_fsm = {

--
To view, visit https://gerrit.osmocom.org/12364
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb8e7bd1c74a4b47080fe32ebe0161c503ead571
Gerrit-Change-Number: 12364
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <[email protected]>

Reply via email to