[PATCH] libosmo-sccp[master]: osmo_ss7: Release any dynamically-allocated ASs

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Apr 13 16:23:26 UTC 2017


Review at  https://gerrit.osmocom.org/2324

osmo_ss7: Release any dynamically-allocated ASs

When RKM dynamically allocates ASs on the SGP based on RKM registration
requests, we must make sure to properly destroy those at the time the
related ASP disconnects.  Also, make sure to send
XUA_ASP_E_SCTP_COMM_DOWN_IND to the layer manager (if any).

Change-Id: Ie6505680bb6890814ae36858c54a2a6d2850f5cf
---
M src/osmo_ss7.c
M src/xua_internal.h
M src/xua_rkm.c
3 files changed, 23 insertions(+), 1 deletion(-)


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

diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index e66414c..d864916 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1401,7 +1401,11 @@
 	LOGP(DLSS7, LOGL_INFO, "%s: SCTP connection closed\n",
 		asp ? asp->cfg.name : "?");
 
-	/* FIXME: somehow notify ASP FSM and everyone else */
+	/* notify ASP FSM and everyone else */
+	osmo_fsm_inst_dispatch(asp->fi, XUA_ASP_E_SCTP_COMM_DOWN_IND, NULL);
+
+	/* delete any RKM-dynamically allocated ASs for this ASP */
+	xua_rkm_cleanup_dyn_as_for_asp(asp);
 
 	/* send M-SCTP_RELEASE.ind to Layer Manager */
 	xua_asp_send_xlm_prim_simple(asp, OSMO_XLM_PRIM_M_SCTP_RELEASE, PRIM_OP_INDICATION);
diff --git a/src/xua_internal.h b/src/xua_internal.h
index 468b7e4..b291703 100644
--- a/src/xua_internal.h
+++ b/src/xua_internal.h
@@ -47,6 +47,7 @@
 int m3ua_decode_notify(struct osmo_xlm_prim_notify *npar, void *ctx,
 			const struct xua_msg *xua);
 int m3ua_rx_rkm(struct osmo_ss7_asp *asp, struct xua_msg *xua);
+void xua_rkm_cleanup_dyn_as_for_asp(struct osmo_ss7_asp *asp);
 
 struct osmo_xlm_prim *xua_xlm_prim_alloc(enum osmo_xlm_prim_type prim_type,
 					 enum osmo_prim_operation op);
diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index 38cbbda..62abfdd 100644
--- a/src/xua_rkm.c
+++ b/src/xua_rkm.c
@@ -544,3 +544,20 @@
 
 	return 0;
 }
+
+/* clean-up any dynamically created ASs + routes */
+void xua_rkm_cleanup_dyn_as_for_asp(struct osmo_ss7_asp *asp)
+{
+	struct osmo_ss7_instance *inst = asp->inst;
+	struct osmo_ss7_as *as, *as2;
+
+	llist_for_each_entry_safe(as, as2, &inst->as_list, list) {
+		if (!osmo_ss7_as_has_asp(as, asp))
+			continue;
+		/* FIXME: check if there are no other ASPs! */
+		if (!as->rkm_dyn_allocated)
+			continue;
+
+		osmo_ss7_as_destroy(as);
+	}
+}

-- 
To view, visit https://gerrit.osmocom.org/2324
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6505680bb6890814ae36858c54a2a6d2850f5cf
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list