From c71fb71916ebe258516dd128778a814efbc52372 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 6 Nov 2019 15:40:28 +0100 Subject: xua: Reset AS traffic mode set by peer during shutdown This way the AS can be configured to use different traffic modes over time as long as they don't overlap in time. That is in this case where no specific traffic mode is specified in AS local configuration (VTY). Some RFC4666 state similar behvor of deleting data set by ASPs during AS shutdown. For instance: """ Other ASPs may continue to be associated with the Application Server, in which case the Routing Key data SHOULD NOT be deleted. If a Deregistration results in no more ASPs in an Application Server, an SG MAY delete the Routing Key data. """ This allows for tests to easily re-use same AS to test different traffic modes as long as they wait for the recovery timeout (2 secs by default, configurable via VTY). Related: OS#4220 Change-Id: I370aa3b5ddfc456c1be5b2585f2f470d5aa8d289 --- src/xua_as_fsm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c index b0fbd2a..04e592c 100644 --- a/src/xua_as_fsm.c +++ b/src/xua_as_fsm.c @@ -252,6 +252,17 @@ static void xua_as_fsm_onenter(struct osmo_fsm_inst *fi, uint32_t old_state) case XUA_AS_S_PENDING: npar.status_info = M3UA_NOTIFY_I_AS_PEND; break; + case XUA_AS_S_DOWN: + /* RFC4666 sec 4.3.2 AS States: + If we end up here, it means no ASP is ACTIVE or INACTIVE, + meaning no ASP can have already configured the traffic mode + in ASPAC or REG REQ. Hence, we can clear traffic mode defined + by peers and allow next first peer to request a new traffic + mode. */ + as->cfg.mode_set_by_peer = false; + if (!as->cfg.mode_set_by_vty) + as->cfg.mode = OSMO_SS7_AS_TMOD_OVERRIDE; + return; default: return; } @@ -374,6 +385,7 @@ static const struct osmo_fsm_state xua_as_fsm_states[] = { S(XUA_AS_S_INACTIVE), .name = "AS_DOWN", .action = xua_as_fsm_down, + .onenter = xua_as_fsm_onenter, }, [XUA_AS_S_INACTIVE] = { .in_event_mask = S(XUA_ASPAS_ASP_DOWN_IND) | -- cgit v1.2.3