[PATCH] libosmo-sccp[master]: osmo_ss7: Send M-SCTP_RELEASE.ind for close of xUA client or...

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:15:22 UTC 2017


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

osmo_ss7: Send M-SCTP_RELEASE.ind for close of xUA client or server socket

Change-Id: I31e7de136545279a75a5faca0927d3dbf11ff46d
---
M src/osmo_ss7.c
1 file changed, 22 insertions(+), 3 deletions(-)


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

diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 9f01863..ff53317 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1253,6 +1253,22 @@
 	return 0;
 }
 
+static void xua_cli_close(struct osmo_stream_cli *cli)
+{
+	struct osmo_ss7_asp *asp = osmo_stream_cli_get_data(cli);
+
+	osmo_stream_cli_close(cli);
+
+	/* send M-SCTP_RELEASE.ind to Layer Manager */
+	xua_asp_send_xlm_prim_simple(asp, OSMO_XLM_PRIM_M_SCTP_RELEASE, PRIM_OP_INDICATION);
+}
+
+static void xua_cli_close_and_reconnect(struct osmo_stream_cli *cli)
+{
+	xua_cli_close(cli);
+	osmo_stream_cli_reconnect(cli);
+}
+
 static int xua_cli_read_cb(struct osmo_stream_cli *conn)
 {
 	struct osmo_fd *ofd = osmo_stream_cli_get_ofd(conn);
@@ -1272,10 +1288,10 @@
 	LOGPASP(asp, DLSS7, LOGL_DEBUG, "%s(): sctp_recvmsg() returned %d (flags=0x%x)\n",
 		__func__, rc, flags);
 	if (rc < 0) {
-		osmo_stream_cli_reconnect(conn);
+		xua_cli_close_and_reconnect(conn);
 		goto out;
 	} else if (rc == 0) {
-		osmo_stream_cli_reconnect(conn);
+		xua_cli_close_and_reconnect(conn);
 	} else {
 		msgb_put(msg, rc);
 	}
@@ -1288,7 +1304,7 @@
 		switch (notif->sn_header.sn_type) {
 		case SCTP_SHUTDOWN_EVENT:
 			osmo_fsm_inst_dispatch(asp->fi, XUA_ASP_E_SCTP_COMM_DOWN_IND, asp);
-			osmo_stream_cli_reconnect(conn);
+			xua_cli_close_and_reconnect(conn);
 			break;
 		default:
 			break;
@@ -1329,6 +1345,9 @@
 
 	/* FIXME: somehow notify ASP FSM and everyone else */
 
+	/* send M-SCTP_RELEASE.ind to Layer Manager */
+	xua_asp_send_xlm_prim_simple(asp, OSMO_XLM_PRIM_M_SCTP_RELEASE, PRIM_OP_INDICATION);
+
 	return 0;
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I31e7de136545279a75a5faca0927d3dbf11ff46d
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