[PATCH] osmo-bsc[master]: bssmap_handle_assignm_req(): Use proper cause values

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/.

dexter gerrit-no-reply at lists.osmocom.org
Mon Feb 19 10:21:42 UTC 2018


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

bssmap_handle_assignm_req(): Use proper cause values

The BSSMAP Cause value should give a clear indication of why a given
operation failed.  Previously we were unconditionally sending
GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE  even in cases where mandatory
IEs were missing or other errors occurred unrelated to resource
availability.

Closes: OS#2759
Change-Id: I86adcae2950cbea6dcac4551cfde1054cb0abad1
---
M src/osmo-bsc/osmo_bsc_bssap.c
1 file changed, 15 insertions(+), 11 deletions(-)


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

diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index a27610e..c4c2d8a 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -750,6 +750,7 @@
 	struct sockaddr_storage rtp_addr;
 	struct gsm0808_channel_type ct;
 	struct gsm0808_speech_codec_list *scl_ptr = NULL;
+	uint8_t cause;
 	int rc;
 
 	if (!conn) {
@@ -765,6 +766,7 @@
 	/* Check for channel type element, if its missing, immediately reject */
 	if (!TLVP_PRESENT(&tp, GSM0808_IE_CHANNEL_TYPE)) {
 		LOGP(DMSC, LOGL_ERROR, "Mandatory channel type not present.\n");
+		cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING;
 		goto reject;
 	}
 
@@ -773,6 +775,7 @@
 				      TLVP_LEN(&tp, GSM0808_IE_CHANNEL_TYPE));
 	if (rc < 0) {
 		LOGP(DMSC, LOGL_ERROR, "unable to decode channel type.\n");
+		cause = GSM0808_CAUSE_INCORRECT_VALUE;
 		goto reject;
 	}
 
@@ -781,6 +784,7 @@
 	 * multi-slot, limiting the channel coding to speech */
 	if (ct.ch_indctr != GSM0808_CHAN_SPEECH) {
 		LOGP(DMSC, LOGL_ERROR, "Unsupported channel type, currently only speech is supported!\n");
+		cause = GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_NOT_SUPP;
 		goto reject;
 	}
 
@@ -795,14 +799,14 @@
 		rc = gsm0808_dec_aoip_trasp_addr(&rtp_addr, TLVP_VAL(&tp, GSM0808_IE_AOIP_TRASP_ADDR),
 						 TLVP_LEN(&tp, GSM0808_IE_AOIP_TRASP_ADDR));
 		if (rc < 0) {
-			LOGP(DMSC, LOGL_ERROR,
-			     "Unable to decode aoip transport address.\n");
+			LOGP(DMSC, LOGL_ERROR, "Unable to decode aoip transport address.\n");
+			cause = GSM0808_CAUSE_INCORRECT_VALUE;
 			goto reject;
 		}
 		aoip = true;
 	} else {
-		LOGP(DMSC, LOGL_ERROR,
-		     "transport address missing. Audio routing will not work.\n");
+		LOGP(DMSC, LOGL_ERROR, "transport address missing. Audio routing will not work.\n");
+		cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING;
 		goto reject;
 	}
 
@@ -811,8 +815,8 @@
 	if (aoip) {
 		/* Check for speech codec list element */
 		if (!TLVP_PRESENT(&tp, GSM0808_IE_SPEECH_CODEC_LIST)) {
-			LOGP(DMSC, LOGL_ERROR,
-			     "Mandatory speech codec list not present.\n");
+			LOGP(DMSC, LOGL_ERROR, "Mandatory speech codec list not present.\n");
+			cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING;
 			goto reject;
 		}
 
@@ -821,8 +825,8 @@
 						   TLVP_VAL(&tp, GSM0808_IE_SPEECH_CODEC_LIST),
 						   TLVP_LEN(&tp, GSM0808_IE_SPEECH_CODEC_LIST));
 		if (rc < 0) {
-			LOGP(DMSC, LOGL_ERROR,
-			     "Unable to decode speech codec list\n");
+			LOGP(DMSC, LOGL_ERROR, "Unable to decode speech codec list\n");
+			cause = GSM0808_CAUSE_INCORRECT_VALUE;
 			goto reject;
 		}
 		conn->codec_list_present = true;
@@ -838,6 +842,7 @@
 		     ct.ch_indctr, ct.ch_rate_type, osmo_hexdump(ct.perm_spch, ct.perm_spch_len));
 		/* TODO: actually output codec names, e.g. implement gsm0808_permitted_speech_names[] and
 		 * iterate perm_spch. */
+		cause = GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL;
 		goto reject;
 	}
 	DEBUGP(DMSC, "Found matching audio type: %s %s for channel_type ="
@@ -866,6 +871,7 @@
 		if (!conn->user_plane.mgcp_ctx) {
 			LOGP(DMSC, LOGL_ERROR, "MGCP GW failure, rejecting assignment... (id=%i)\n",
 				conn->sccp.conn_id);
+			cause = GSM0808_CAUSE_EQUIPMENT_FAILURE;
 			goto reject;
 		}
 
@@ -882,9 +888,7 @@
 	}
 
 reject:
-	resp =
-	    gsm0808_create_assignment_failure
-	    (GSM0808_CAUSE_NO_RADIO_RESOURCE_AVAILABLE, NULL);
+	resp = gsm0808_create_assignment_failure(cause, NULL);
 	if (!resp) {
 		LOGP(DMSC, LOGL_ERROR, "Channel allocation failure.\n");
 		return -1;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I86adcae2950cbea6dcac4551cfde1054cb0abad1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list