pespin submitted this change.

View Change

Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved
xua asp block: SG: turn asp inactive when administratively blocked

This commit intentionally leaves aside implementing active->inactive
transition for asps with role ASP/(active) IPSP.

Change-Id: If8e34cfb05b8b63173b8bb01a520c058daf1fe39
---
M src/ss7_asp.c
M src/xua_asp_fsm.c
M src/xua_asp_fsm.h
3 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/src/ss7_asp.c b/src/ss7_asp.c
index 96e8759..23a9b66 100644
--- a/src/ss7_asp.c
+++ b/src/ss7_asp.c
@@ -1540,6 +1540,9 @@
asp->cfg.adm_state.blocked ? "" : "no ",
blocked ? "" : "no ");
asp->cfg.adm_state.blocked = blocked;
+
+ if (asp->cfg.adm_state.blocked)
+ osmo_fsm_inst_dispatch(asp->fi, XUA_ASP_E_ADM_BLOCKED, NULL);
}

/* Apply sane configs for unconfigured options and restart the ASP. */
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 7ee3fd1..8ac31f6 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -74,6 +74,7 @@
{ XUA_ASP_E_ASPSM_BEAT_ACK, "ASPSM_BEAT_ACK" },

{ XUA_ASP_E_AS_ASSIGNED, "AS_ASSIGNED" },
+ { XUA_ASP_E_ADM_BLOCKED, "ADM_BLOCKED" },

{ IPA_ASP_E_ID_RESP, "IPA_CCM_ID_RESP" },
{ IPA_ASP_E_ID_GET, "IPA_CCM_ID_GET" },
@@ -212,6 +213,24 @@
return cnt;
}

+static int xua_asp_tx_unsolicited_aspia_ack(struct osmo_ss7_asp *asp)
+{
+ struct msgb *msg;
+ struct xua_msg *xua = xua_msg_alloc();
+
+ OSMO_ASSERT(xua);
+
+ xua->hdr = XUA_HDR(SUA_MSGC_ASPTM, SUA_ASPTM_INACTIVE_ACK);
+ xua_msg_add_asp_rctx(xua, asp);
+
+ msg = xua_to_msg(SUA_VERSION, xua);
+ xua_msg_free(xua);
+ if (!msg)
+ return -1;
+
+ return osmo_ss7_asp_send(asp, msg);
+}
+
/* ask the xUA implementation to transmit a specific message */
static int peer_send(struct osmo_fsm_inst *fi, int out_event, struct xua_msg *in)
{
@@ -893,6 +912,7 @@
static void xua_asp_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
struct xua_asp_fsm_priv *xafp = fi->priv;
+ struct osmo_ss7_asp *asp = xafp->asp;
struct xua_msg *xua;

switch (event) {
@@ -914,6 +934,26 @@
case XUA_ASP_E_AS_ASSIGNED:
/* Ignore, only used in IPA asps so far. */
break;
+ case XUA_ASP_E_ADM_BLOCKED:
+ if (fi->state != XUA_ASP_S_ACTIVE) {
+ /* nothing to be done, ASPAC will be rejected when received. */
+ return;
+ }
+ if (asp->cfg.role == OSMO_SS7_ASP_ROLE_SG) {
+ /* RFC4666 4.3.4.4: Transmit unsolicited ASPIA ACK no tnotify peer.
+ * "If the ASP receives an ASP Inactive Ack without having sent an
+ * ASP Inactive message, the ASP should now consider itself to be
+ * in the ASP-INACTIVE state. If the ASP was previously in the
+ * ASP-ACTIVE state, the ASP should then initiate procedures to
+ * return itself to its previous state."
+ */
+ xua_asp_tx_unsolicited_aspia_ack(asp);
+ /* transition state and inform layer manager */
+ osmo_fsm_inst_state_chg(fi, XUA_ASP_S_INACTIVE, 0, 0);
+ send_xlm_prim_simple(fi, OSMO_XLM_PRIM_M_ASP_INACTIVE, PRIM_OP_INDICATION);
+ }
+ /* TODO: implement ASP and IPSP roles. */
+ break;
default:
break;
}
@@ -999,7 +1039,8 @@
S(XUA_ASP_E_SCTP_RESTART_IND) |
S(XUA_ASP_E_ASPSM_BEAT) |
S(XUA_ASP_E_ASPSM_BEAT_ACK) |
- S(XUA_ASP_E_AS_ASSIGNED),
+ S(XUA_ASP_E_AS_ASSIGNED) |
+ S(XUA_ASP_E_ADM_BLOCKED),
.allstate_action = xua_asp_allstate,
.cleanup = xua_asp_fsm_cleanup,
};
diff --git a/src/xua_asp_fsm.h b/src/xua_asp_fsm.h
index 61a43a1..52d5f4b 100644
--- a/src/xua_asp_fsm.h
+++ b/src/xua_asp_fsm.h
@@ -31,6 +31,9 @@
/* The ASP was added to an AS. data: (struct osmo_ss7_as *) */
XUA_ASP_E_AS_ASSIGNED,

+ /* The ASP became administratively blocked */
+ XUA_ASP_E_ADM_BLOCKED,
+
/* IPA specific */
IPA_ASP_E_ID_RESP,
IPA_ASP_E_ID_ACK,

To view, visit change 42559. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: If8e34cfb05b8b63173b8bb01a520c058daf1fe39
Gerrit-Change-Number: 42559
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>