Change in osmo-msc[master]: libvlr/vlr.c: forward unhandled GSUP messages towards MSC

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
Sun Jul 29 14:39:45 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9656 )

Change subject: libvlr/vlr.c: forward unhandled GSUP messages towards MSC
......................................................................

libvlr/vlr.c: forward unhandled GSUP messages towards MSC

Some internal sub-systems, such as SS/USSD or SMS implementation,
may also need to use GSUP connection with HLR. Previously, it was
only available within the libvlr code, and nowhere else.

Let's introduce the generic GSUP message router, which will
receive messages unhandled by VLR itself, and route them to
a handler depending on the message type.

Change-Id: Ib8146ce5788c8f249dcaa39d61bd0388574bf892
---
M include/osmocom/msc/vlr.h
M src/libmsc/gsm_04_08.c
M src/libvlr/vlr.c
3 files changed, 20 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/include/osmocom/msc/vlr.h b/include/osmocom/msc/vlr.h
index f12d758..b54aa55 100644
--- a/include/osmocom/msc/vlr.h
+++ b/include/osmocom/msc/vlr.h
@@ -8,6 +8,7 @@
 #include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
 #include <osmocom/gsm/gsm23003.h>
 #include <osmocom/gsm/gsm0808.h>
+#include <osmocom/gsm/gsup.h>
 #include <osmocom/msc/gsm_data.h>
 // for GSM_NAME_LENGTH
 #include <osmocom/msc/gsm_subscriber.h>
@@ -226,6 +227,9 @@
 	/* notify MSC/SGSN that the given subscriber has been associated
 	 * with this msc_conn_ref */
 	void (*subscr_assoc)(void *msc_conn_ref, struct vlr_subscr *vsub);
+
+	/* Forward a parsed GSUP message towards MSC message router */
+	int (*forward_gsup_msg)(struct vlr_subscr *vsub, struct osmo_gsup_message *gsup_msg);
 };
 
 enum vlr_timer {
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index f81a6fa..c10a701 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1698,6 +1698,18 @@
 	conn->vsub->cs.attached_via_ran = conn->via_ran;
 }
 
+static int msc_vlr_route_gsup_msg(struct vlr_subscr *vsub,
+				  struct osmo_gsup_message *gsup_msg)
+{
+	switch (gsup_msg->message_type) {
+	/* Nowhere to route for now */
+	default:
+		LOGP(DMM, LOGL_ERROR, "No handler found for %s, dropping message...\n",
+			osmo_gsup_message_type_name(gsup_msg->message_type));
+		return -GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL;
+	}
+}
+
 /* operations that we need to implement for libvlr */
 static const struct vlr_ops msc_vlr_ops = {
 	.tx_auth_req = msc_vlr_tx_auth_req,
@@ -1712,6 +1724,7 @@
 	.tx_mm_info = msc_vlr_tx_mm_info,
 	.subscr_update = msc_vlr_subscr_update,
 	.subscr_assoc = msc_vlr_subscr_assoc,
+	.forward_gsup_msg = msc_vlr_route_gsup_msg,
 };
 
 /* Allocate net->vlr so that the VTY may configure the VLR's data structures */
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index cff2e12..2f7dc30 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -1042,10 +1042,8 @@
 		rc = -GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL;
 		break;
 	default:
-		LOGVSUBP(LOGL_ERROR, vsub,
-			"Rx GSUP msg_type=%d not valid at VLR/SGSN side\n",
-			gsup.message_type);
-		rc = -GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL;
+		/* Forward message towards MSC */
+		rc = vlr->ops.forward_gsup_msg(vsub, &gsup);
 		break;
 	}
 
@@ -1192,6 +1190,7 @@
 	OSMO_ASSERT(ops->tx_common_id);
 	OSMO_ASSERT(ops->subscr_update);
 	OSMO_ASSERT(ops->subscr_assoc);
+	OSMO_ASSERT(ops->forward_gsup_msg);
 
 	INIT_LLIST_HEAD(&vlr->subscribers);
 	INIT_LLIST_HEAD(&vlr->operations);

-- 
To view, visit https://gerrit.osmocom.org/9656
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib8146ce5788c8f249dcaa39d61bd0388574bf892
Gerrit-Change-Number: 9656
Gerrit-PatchSet: 5
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180729/be68fc6e/attachment.htm>


More information about the gerrit-log mailing list