pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42573?usp=email )
Change subject: Support administrative block in role ASP ......................................................................
Support administrative block in role ASP
Change-Id: If32902575e874d2acc9a5fc12509af42ed151739 --- M src/ss7_asp_vty.c M src/xua_default_lm_fsm.c 2 files changed, 17 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/73/42573/1
diff --git a/src/ss7_asp_vty.c b/src/ss7_asp_vty.c index e3c82fe..89fb949 100644 --- a/src/ss7_asp_vty.c +++ b/src/ss7_asp_vty.c @@ -714,11 +714,6 @@ return CMD_WARNING; }
- if (asp->cfg.role == OSMO_SS7_ASP_ROLE_ASP) { - vty_out(vty, "%% 'block' not yet implemented in 'role asp'%s", VTY_NEWLINE); - return CMD_WARNING; - } - ss7_asp_set_blocked(asp, true); return CMD_SUCCESS; } diff --git a/src/xua_default_lm_fsm.c b/src/xua_default_lm_fsm.c index f9f5cd4..773d6f2 100644 --- a/src/xua_default_lm_fsm.c +++ b/src/xua_default_lm_fsm.c @@ -199,6 +199,10 @@
static bool asp_act_needed(const struct osmo_ss7_asp *asp) { + /* Avoid activating if ASP is adminsitratively blocked locally: */ + if (asp->cfg.adm_state.blocked) + return false; + /* Don't change active ASP if there's already one active in the AS. */ if (ss7_asp_determine_traf_mode(asp) == OSMO_SS7_AS_TMOD_OVERRIDE) { struct ss7_as_asp_assoc *assoc; @@ -210,6 +214,13 @@ return true; }
+static void submit_m_asp_active_req_if_needed(struct osmo_ss7_asp *asp) +{ + if (!asp_act_needed(asp)) + return; + xlm_sap_down_simple(asp, OSMO_XLM_PRIM_M_ASP_ACTIVE, PRIM_OP_REQUEST); +} + static void lm_idle(struct osmo_fsm_inst *fi, uint32_t event, void *data) { switch (event) { @@ -342,10 +353,8 @@ struct xua_layer_manager_default_priv *lmp = fi->priv;
if (lmp->asp->cfg.role == OSMO_SS7_ASP_ROLE_ASP || - lmp->asp->cfg.role == OSMO_SS7_ASP_ROLE_IPSP) { - if (asp_act_needed(lmp->asp)) - xlm_sap_down_simple(lmp->asp, OSMO_XLM_PRIM_M_ASP_ACTIVE, PRIM_OP_REQUEST); - } + lmp->asp->cfg.role == OSMO_SS7_ASP_ROLE_IPSP) + submit_m_asp_active_req_if_needed(lmp->asp); }
static void lm_inactive(struct osmo_fsm_inst *fi, uint32_t event, void *data) @@ -366,16 +375,14 @@ break; case LM_E_AS_INACTIVE_IND: /* request the ASP to go into active state if needed */ - if (asp_act_needed(lmp->asp)) - xlm_sap_down_simple(lmp->asp, OSMO_XLM_PRIM_M_ASP_ACTIVE, PRIM_OP_REQUEST); + submit_m_asp_active_req_if_needed(lmp->asp); break; case LM_E_NOTIFY_IND: ENSURE_ASP_OR_IPSP(fi, event); OSMO_ASSERT(oxp->oph.primitive == OSMO_XLM_PRIM_M_NOTIFY); OSMO_ASSERT(oxp->oph.operation == PRIM_OP_INDICATION); /* request the ASP to go into active state if needed */ - if (asp_act_needed(lmp->asp)) - xlm_sap_down_simple(lmp->asp, OSMO_XLM_PRIM_M_ASP_ACTIVE, PRIM_OP_REQUEST); + submit_m_asp_active_req_if_needed(lmp->asp); break; case LM_E_ERROR_IND: ENSURE_ASP_OR_IPSP(fi, event); @@ -409,7 +416,7 @@ * peer's ASP became administratively blocked. * Try to re-activate, if peer's ASP is indeed blocked we'll probably receive an * ERR msg and continue from there in the case LM_E_ERROR_IND below. */ - xlm_sap_down_simple(lmp->asp, OSMO_XLM_PRIM_M_ASP_ACTIVE, PRIM_OP_REQUEST); + submit_m_asp_active_req_if_needed(lmp->asp); break; case LM_E_ASP_INACT_IND: ENSURE_SG_OR_IPSP(fi, event); @@ -417,7 +424,7 @@ break; case LM_E_AS_INACTIVE_IND: /* request the ASP to go into active state */ - xlm_sap_down_simple(lmp->asp, OSMO_XLM_PRIM_M_ASP_ACTIVE, PRIM_OP_REQUEST); + submit_m_asp_active_req_if_needed(lmp->asp); break; case LM_E_NOTIFY_IND: ENSURE_ASP_OR_IPSP(fi, event);