diff options
-rw-r--r-- | openbsc/include/openbsc/iu.h | 2 | ||||
-rw-r--r-- | openbsc/src/libiu/iu.c | 23 | ||||
-rw-r--r-- | openbsc/src/libmsc/osmo_msc.c | 1 | ||||
-rw-r--r-- | openbsc/src/libmsc/subscr_conn.c | 6 | ||||
-rw-r--r-- | openbsc/tests/db/db_test.c | 3 |
5 files changed, 31 insertions, 4 deletions
diff --git a/openbsc/include/openbsc/iu.h b/openbsc/include/openbsc/iu.h index c45fec576..2155790c1 100644 --- a/openbsc/include/openbsc/iu.h +++ b/openbsc/include/openbsc/iu.h @@ -8,6 +8,7 @@ struct gprs_ra_id; struct RANAP_RAB_SetupOrModifiedItemIEs_s; struct RANAP_GlobalRNC_ID; +struct RANAP_Cause; struct ue_conn_ctx { struct llist_head list; @@ -59,5 +60,6 @@ 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); +int iu_tx_release(struct ue_conn_ctx *ctx, const struct RANAP_Cause *cause); void iu_vty_init(int *asn_debug_p); diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c index 696527dca..2f208d02b 100644 --- a/openbsc/src/libiu/iu.c +++ b/openbsc/src/libiu/iu.c @@ -409,20 +409,35 @@ int iu_tx(struct msgb *msg_nas, uint8_t sapi) return 0; } -static int ranap_handle_co_iu_rel_req(struct ue_conn_ctx *ctx, RANAP_Iu_ReleaseRequestIEs_t *ies) +/* Send Iu Release for the given UE connection. + * If cause is NULL, the standard "No remaining RAB" cause is sent, otherwise + * the provided cause. */ +int iu_tx_release(struct ue_conn_ctx *ctx, const struct RANAP_Cause *cause) { struct msgb *msg; struct osmo_scu_prim *prim; + static const struct RANAP_Cause default_cause = { + .present = RANAP_Cause_PR_radioNetwork, + .choice.radioNetwork = RANAP_CauseRadioNetwork_no_remaining_rab, + }; - LOGP(DRANAP, LOGL_INFO, "Received Iu Release Request, Sending Release Command\n"); - msg = ranap_new_msg_iu_rel_cmd(&ies->cause); + if (!cause) + cause = &default_cause; + + msg = ranap_new_msg_iu_rel_cmd(cause); msg->l2h = msg->data; prim = (struct osmo_scu_prim *) msgb_push(msg, sizeof(*prim)); prim->u.data.conn_id = ctx->conn_id; osmo_prim_init(&prim->oph, SCCP_SAP_USER, OSMO_SCU_PRIM_N_DATA, PRIM_OP_REQUEST, msg); - osmo_sua_user_link_down(ctx->link, &prim->oph); + return osmo_sua_user_link_down(ctx->link, &prim->oph); +} + +static int ranap_handle_co_iu_rel_req(struct ue_conn_ctx *ctx, RANAP_Iu_ReleaseRequestIEs_t *ies) +{ + LOGP(DRANAP, LOGL_INFO, "Received Iu Release Request, Sending Release Command\n"); + iu_tx_release(ctx, &ies->cause); return 0; } diff --git a/openbsc/src/libmsc/osmo_msc.c b/openbsc/src/libmsc/osmo_msc.c index 61ccbcee2..0511fc5dd 100644 --- a/openbsc/src/libmsc/osmo_msc.c +++ b/openbsc/src/libmsc/osmo_msc.c @@ -28,6 +28,7 @@ #include <openbsc/db.h> #include <openbsc/vlr.h> #include <openbsc/osmo_msc.h> +#include <openbsc/iu.h> #include <openbsc/gsm_04_11.h> diff --git a/openbsc/src/libmsc/subscr_conn.c b/openbsc/src/libmsc/subscr_conn.c index fbbecd6bb..c9b927861 100644 --- a/openbsc/src/libmsc/subscr_conn.c +++ b/openbsc/src/libmsc/subscr_conn.c @@ -240,6 +240,12 @@ static void subscr_conn_fsm_cleanup(struct osmo_fsm_inst *fi, return; } + if (conn->via_iface == IFACE_IU) + iu_tx_release(conn->iu.ue_ctx, NULL); + /* FIXME: keep the conn until the Iu Release Outcome is + * received from the UE, or a timeout expires. For now, the log + * says "unknown UE" for each release outcome. */ + DEBUGP(DMM, "%s calling bsc_subscr_con_free(), owned_by_msc = true\n", vlr_subscr_name(conn->vsub)); gsm0808_clear(conn); diff --git a/openbsc/tests/db/db_test.c b/openbsc/tests/db/db_test.c index bf2e74599..2720b25e1 100644 --- a/openbsc/tests/db/db_test.c +++ b/openbsc/tests/db/db_test.c @@ -276,3 +276,6 @@ const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp) { return "0.0.0.0"; } uint32_t mgcpgw_client_remote_addr_n(struct mgcpgw_client *mgcp) { return 0; } +struct RANAP_Cause; +int iu_tx_release(struct ue_conn_ctx *ctx, const struct RANAP_Cause *cause) +{ return 0; } |