aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-12-23 01:22:03 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2018-02-19 11:43:07 +0100
commitd387ac8ad7635798f0a1d9f12ef85a1b699fef2a (patch)
tree63ac865963da7f3c5787d1ab29c711af53f82da5
parent51e4bf329844b8daa20239f77bb90cf04ce6dbb9 (diff)
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
-rw-r--r--src/osmo-bsc/osmo_bsc_bssap.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index b14968a50..399b04a8d 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -750,6 +750,7 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn,
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 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn,
/* 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 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn,
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 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn,
* 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 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn,
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 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn,
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 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn,
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 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn,
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 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn,
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 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn,
}
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;