[PATCH] libosmo-sccp[master]: osmo_ss7: destroy any ASPs allocated dynamically at accept()...

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
Tue Apr 11 20:48:39 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/2306

to look at the new patch set (#2).

osmo_ss7: destroy any ASPs allocated dynamically at accept() time

When we accept SCTP connections from clients for whose IP/port we have
no matching local configurations, and it is permitted by local
configuration, we dynamically allocate osmo_ss7_asp's in this case.
Make sure to properly destroy them at the time the SCTP connection is
lost.

Change-Id: I07d69a0cd52a049a7a4bb0d996e95d39fee9a106
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
2 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/06/2306/2

diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index cbc6a02..bb151d1 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -342,6 +342,9 @@
 	/* Layer Manager to which we talk */
 	struct osmo_xua_layer_manager *lm;
 
+	/*! Were we dynamically allocated */
+	bool dyn_allocated;
+
 	struct {
 		char *name;
 		char *description;
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index b32f5d9..78ff3ec 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1374,6 +1374,15 @@
 	/* send M-SCTP_RELEASE.ind to Layer Manager */
 	xua_asp_send_xlm_prim_simple(asp, OSMO_XLM_PRIM_M_SCTP_RELEASE, PRIM_OP_INDICATION);
 
+	/* if we were dynamically allocated at accept_cb() time, let's
+	 * self-destruct now.  A new connection will re-create the ASP. */
+	if (asp->dyn_allocated) {
+		/* avoid re-entrance via osmo_stream_srv_destroy() which
+		 * called us */
+		asp->server = NULL;
+		osmo_ss7_asp_destroy(asp);
+	}
+
 	return 0;
 }
 
@@ -1420,6 +1429,7 @@
 				LOGP(DLSS7, LOGL_INFO, "%s: created dynamicASP %s\n",
 					sock_name, asp->cfg.name);
 				asp->cfg.is_server = true;
+				asp->dyn_allocated = true;
 				osmo_ss7_asp_restart(asp);
 			}
 		}

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I07d69a0cd52a049a7a4bb0d996e95d39fee9a106
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list