diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-09-07 17:52:32 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-09-29 13:23:55 +0200 |
commit | 7b05b0296838f4d9e1fe89738477208b6a218f09 (patch) | |
tree | d416c0afad5a655276c486a12f6cac27bb52828a /openbsc/src | |
parent | 60c272ab2c4f6a972d99da70f929339db9300422 (diff) |
IuCS: send RANAP CommonID
Add libiu function to send a CommonID message down a UE connection,
iu_tx_common_id(); add also a corresponding stub to libiudummy for linking with
tests.
Add libmsc function msc_tx_common_id() to call the above. Add this mostly to
clearly indicate in msc_ifaces.h that libmsc is calling out of the MSC; also
to do conn->via_iface checking.
Call msc_tx_common_id() after ciphering is established, in
_gsm48_rx_mm_serv_req_sec_cb()'s GSM_SECURITY_SUCCEEDED case.
Change-Id: I576ddd5bbabfc989149debd2f8a9743db6d26043
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/libiu/iu.c | 19 | ||||
-rw-r--r-- | openbsc/src/libmsc/gsm_04_08.c | 1 | ||||
-rw-r--r-- | openbsc/src/libmsc/msc_ifaces.c | 19 |
3 files changed, 39 insertions, 0 deletions
diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c index 837385ebe..0e8721f0a 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 13118d06e..0a5830094 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -972,6 +972,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 +} |