aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/iu.h1
-rw-r--r--openbsc/include/openbsc/msc_ifaces.h2
-rw-r--r--openbsc/src/libiu/iu.c19
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c1
-rw-r--r--openbsc/src/libmsc/msc_ifaces.c19
-rw-r--r--openbsc/tests/libiudummy/iudummy.c6
6 files changed, 48 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/iu.h b/openbsc/include/openbsc/iu.h
index f973ac1ba..c45fec576 100644
--- a/openbsc/include/openbsc/iu.h
+++ b/openbsc/include/openbsc/iu.h
@@ -58,5 +58,6 @@ int iu_rab_act(struct ue_conn_ctx *ue_ctx, struct msgb *msg);
int iu_rab_deact(struct ue_conn_ctx *ue_ctx, uint8_t rab_id);
int iu_tx_sec_mode_cmd(struct ue_conn_ctx *uectx, struct gsm_auth_tuple *tp,
int send_ck, int new_key);
+int iu_tx_common_id(struct ue_conn_ctx *ue_ctx, const char *imsi);
void iu_vty_init(int *asn_debug_p);
diff --git a/openbsc/include/openbsc/msc_ifaces.h b/openbsc/include/openbsc/msc_ifaces.h
index 83aad92a4..0f2142a20 100644
--- a/openbsc/include/openbsc/msc_ifaces.h
+++ b/openbsc/include/openbsc/msc_ifaces.h
@@ -45,3 +45,5 @@ int msc_gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn,
/* TODO: specific to A interface, move this away */
int msc_gsm0808_tx_cipher_mode(struct gsm_subscriber_connection *conn, int cipher,
const uint8_t *key, int len, int include_imeisv);
+
+int msc_tx_common_id(struct gsm_subscriber_connection *conn);
diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c
index 8ba6fa49d..696527dca 100644
--- a/openbsc/src/libiu/iu.c
+++ b/openbsc/src/libiu/iu.c
@@ -256,6 +256,25 @@ int iu_tx_sec_mode_cmd(struct ue_conn_ctx *uectx, struct gsm_auth_tuple *tp,
return 0;
}
+int iu_tx_common_id(struct ue_conn_ctx *uectx, const char *imsi)
+{
+ struct msgb *msg;
+ struct osmo_scu_prim *prim;
+
+ LOGP(DRANAP, LOGL_INFO, "Transmitting RANAP CommonID (SUA link %p conn_id %u)\n",
+ uectx->link, uectx->conn_id);
+
+ msg = ranap_new_msg_common_id(imsi);
+ msg->l2h = msg->data;
+ prim = (struct osmo_scu_prim *) msgb_push(msg, sizeof(*prim));
+ prim->u.data.conn_id = uectx->conn_id;
+ osmo_prim_init(&prim->oph, SCCP_SAP_USER,
+ OSMO_SCU_PRIM_N_DATA,
+ PRIM_OP_REQUEST, msg);
+ osmo_sua_user_link_down(uectx->link, &prim->oph);
+ return 0;
+}
+
static int iu_grnc_id_parse(struct iu_grnc_id *dst,
struct RANAP_GlobalRNC_ID *src)
{
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 54329c74c..e74dbdf74 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -973,6 +973,7 @@ static int _gsm48_rx_mm_serv_req_sec_cb(
/* nothing to do. CIPHER MODE COMMAND is
* implicit CM SERV ACK */
implit_attach(conn);
+ rc = msc_tx_common_id(conn);
break;
default:
diff --git a/openbsc/src/libmsc/msc_ifaces.c b/openbsc/src/libmsc/msc_ifaces.c
index bc8533b5a..04a3d3a8f 100644
--- a/openbsc/src/libmsc/msc_ifaces.c
+++ b/openbsc/src/libmsc/msc_ifaces.c
@@ -23,6 +23,10 @@
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
#include <openbsc/msc_ifaces.h>
+#include <openbsc/iu.h>
+#include <openbsc/gsm_subscriber.h>
+
+#include "../../bscconfig.h"
static int msc_tx(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
@@ -81,3 +85,18 @@ int msc_gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn,
return msc_tx_dtap(conn, msg);
}
+
+int msc_tx_common_id(struct gsm_subscriber_connection *conn)
+{
+ /* Common ID is only sent over IuCS */
+ if (conn->via_iface != IFACE_IU)
+ return 0;
+
+#ifdef BUILD_IU
+ return iu_tx_common_id(conn->iu.ue_ctx, conn->subscr->imsi);
+#else
+ LOGP(DMM, LOGL_ERROR,
+ "Cannot send CommonID: IFACE_IU but IuCS support not built\n");
+ return -ENOTSUP;
+#endif
+}
diff --git a/openbsc/tests/libiudummy/iudummy.c b/openbsc/tests/libiudummy/iudummy.c
index 7052de82c..32ffaa172 100644
--- a/openbsc/tests/libiudummy/iudummy.c
+++ b/openbsc/tests/libiudummy/iudummy.c
@@ -33,3 +33,9 @@ int iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t ra
LOGP(DLGLOBAL, LOGL_INFO, "iu_page_ps() dummy called, NOT paging\n");
return 0;
}
+
+int iu_tx_common_id(struct ue_conn_ctx *uectx, const char *imsi)
+{
+ LOGP(DLGLOBAL, LOGL_INFO, "iu_tx_common_id() dummy called, NOT sending CommonID\n");
+ return 0;
+}