Change in osmo-bsc[master]: bssap: Parse Osmux CID on ASSIG REQ recv

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed May 8 17:05:24 UTC 2019


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/13925


Change subject: bssap: Parse Osmux CID on ASSIG REQ recv
......................................................................

bssap: Parse Osmux CID on ASSIG REQ recv

Change-Id: I86e7e13fc7921e3209fb764c0e7797e7ec09b79e
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/osmo_bsc_bssap.c
2 files changed, 31 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/25/13925/1

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index dc686c3..68c95e1 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -33,6 +33,7 @@
 #include <osmocom/bsc/bsc_msg_filter.h>
 #include <osmocom/bsc/acc_ramp.h>
 #include <osmocom/bsc/neighbor_ident.h>
+#include <osmocom/bsc/osmux.h>
 
 #define GSM_T3122_DEFAULT 10
 
@@ -120,6 +121,8 @@
 
 	char msc_rtp_addr[INET_ADDRSTRLEN];
 	uint16_t msc_rtp_port;
+	bool use_osmux;
+	uint8_t osmux_cid;
 
 	/* Rate/codec setting in preference order (need at least 1 !) */
 	int n_ch_mode_rate;
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 014a9b8..9bbd5e4 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -780,6 +780,8 @@
 	struct tlv_parsed tp;
 	uint16_t cic = 0;
 	bool aoip = false;
+	bool use_osmux = false;
+	uint8_t osmux_cid = 0;
 	struct sockaddr_storage rtp_addr;
 	struct gsm0808_channel_type ct;
 	uint8_t cause;
@@ -857,6 +859,30 @@
 			goto reject;
 		}
 
+		if (TLVP_PRESENT(&tp, GSM0808_IE_OSMO_OSMUX_CID)) {
+			if (conn->sccp.msc->use_osmux == OSMUX_USAGE_OFF) {
+				LOGP(DMSC, LOGL_ERROR, "MSC using Osmux but we have it disabled.\n");
+				cause = GSM0808_CAUSE_INCORRECT_VALUE;
+				goto reject;
+			}
+			use_osmux = true;
+			rc = gsm0808_dec_osmux_cid(&osmux_cid,
+						   TLVP_VAL(&tp, GSM0808_IE_OSMO_OSMUX_CID),
+						   TLVP_LEN(&tp, GSM0808_IE_OSMO_OSMUX_CID));
+			if (rc < 0) {
+				LOGP(DMSC, LOGL_ERROR, "Unable to decode Osmux CID.\n");
+				cause = GSM0808_CAUSE_INCORRECT_VALUE;
+				goto reject;
+			}
+		} else {
+			if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ONLY) {
+				LOGP(DMSC, LOGL_ERROR, "MSC not using Osmux but we are forced to use it.\n");
+				cause = GSM0808_CAUSE_INCORRECT_VALUE;
+				goto reject;
+			} else if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ON)
+				LOGP(DMSC, LOGL_NOTICE, "MSC not using Osmux but we have Osmux enabled.\n");
+		}
+
 		/* Decode speech codec list. First set len = 0. */
 		conn->codec_list = (struct gsm0808_speech_codec_list){};
 		/* Check for speech codec list element */
@@ -882,6 +908,8 @@
 		req = (struct assignment_request){
 			.aoip = aoip,
 			.msc_assigned_cic = cic,
+			.use_osmux = use_osmux,
+			.osmux_cid = osmux_cid,
 		};
 
 		/* Match codec information from the assignment command against the

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I86e7e13fc7921e3209fb764c0e7797e7ec09b79e
Gerrit-Change-Number: 13925
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190508/3b598585/attachment.html>


More information about the gerrit-log mailing list