aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/osmo_bsc_bssap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo-bsc/osmo_bsc_bssap.c')
-rw-r--r--src/osmo-bsc/osmo_bsc_bssap.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index ddebb6a7d..0d6127258 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -1006,6 +1006,66 @@ reject:
return -EINVAL;
}
+/* Handle Confusion message, MSC indicating an error to us:
+ *
+ * See 3GPP TS 48.008 ยง3.2.1.45
+ */
+static int bssmap_handle_confusion(struct gsm_subscriber_connection *conn,
+ struct msgb *msg, unsigned int length)
+{
+ struct tlv_parsed tp;
+ int diag_len;
+ enum gsm0808_cause cause;
+ enum gsm0808_cause_class cause_class;
+ struct gsm0808_diagnostics *diag;
+
+ osmo_bssap_tlv_parse(&tp, msg->l4h + 1, length - 1);
+
+ /* Check for the Cause and Diagnostic mandatory elements */
+ if (!TLVP_PRESENT(&tp, GSM0808_IE_CAUSE) || !TLVP_PRESENT(&tp, GSM0808_IE_DIAGNOSTIC)) {
+ LOGPFSML(conn->fi, LOGL_ERROR,
+ "Received Confusion message,"
+ " but either Cause or Diagnostic mandatory IE is not present: %s\n",
+ osmo_hexdump(msg->l4h, length));
+ return -EINVAL;
+ }
+
+ diag_len = TLVP_LEN(&tp, GSM0808_IE_DIAGNOSTIC);
+ if (diag_len < 5) {
+ LOGPFSML(conn->fi, LOGL_ERROR,
+ "Received Confusion message with short Diagnostic length: %d (expected > 5)\n",
+ diag_len);
+ return -EINVAL;
+ }
+
+ cause = gsm0808_get_cause(&tp);
+ cause_class = gsm0808_cause_class(cause);
+ LOGPFSML(conn->fi, LOGL_ERROR,
+ "Received Confusion message: Cause %d/0x%x (%s)",
+ cause, cause, gsm0808_cause_name(cause));
+ LOGPFSML(conn->fi, LOGL_ERROR,
+ "Received Confusion message: Cause class %d/0x%x (%s)",
+ cause_class, cause_class, gsm0808_cause_class_name(cause_class));
+
+ diag = (struct gsm0808_diagnostics *)TLVP_VAL(&tp, GSM0808_IE_DIAGNOSTIC);
+ /* octet location */
+ LOGPFSML(conn->fi, LOGL_ERROR,
+ " Confusion Diagnostics error octet location %d (%s)\n",
+ diag->error_pointer_octet,
+ gsm0808_diagnostics_octet_location_str(diag->error_pointer_octet));
+ /* bit location */
+ LOGPFSML(conn->fi, LOGL_ERROR,
+ " Confusion Diagnostics error bit location: %d (%s)\n",
+ diag->error_pointer_bit,
+ gsm0808_diagnostics_bit_location_str(diag->error_pointer_bit));
+ /* received message dump */
+ LOGPFSML(conn->fi, LOGL_ERROR,
+ " Confusion Diagnostics message that provoked the error: %s\n",
+ osmo_hexdump(diag->msg, diag_len-2));
+
+ return 0;
+}
+
static int bssmap_rcvmsg_udt(struct bsc_msc_data *msc,
struct msgb *msg, unsigned int length)
{
@@ -1082,6 +1142,10 @@ static int bssmap_rcvmsg_dt1(struct gsm_subscriber_connection *conn,
rate_ctr_inc(&ctrs[MSC_CTR_BSSMAP_RX_DT1_CLASSMARK_RQST]);
ret = gsm48_send_rr_classmark_enquiry(conn->lchan);
break;
+ case BSS_MAP_MSG_CONFUSION:
+ rate_ctr_inc(&ctrs[MSC_CTR_BSSMAP_RX_DT1_CONFUSION]);
+ ret = bssmap_handle_confusion(conn, msg, length);
+ break;
default:
rate_ctr_inc(&ctrs[MSC_CTR_BSSMAP_RX_DT1_UNKNOWN]);
LOGP(DMSC, LOGL_NOTICE, "Unimplemented msg type: %s\n",