From 609994d1468af27d0af4427e6b57df580fc80a7a Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Mon, 12 Aug 2019 16:48:56 +0200 Subject: iu_client: introduce ranap_iu_free_ue() to free the UE connections When freeing the UE connection object, disconnect the SCCP connection. Change-Id: I6812edb4da487507ccf9f483de801c1c65c4b72b --- include/osmocom/ranap/iu_client.h | 4 ++++ src/iu_client.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/osmocom/ranap/iu_client.h b/include/osmocom/ranap/iu_client.h index 873b2d2..0cb84da 100644 --- a/include/osmocom/ranap/iu_client.h +++ b/include/osmocom/ranap/iu_client.h @@ -70,5 +70,9 @@ int ranap_iu_tx_sec_mode_cmd(struct ranap_ue_conn_ctx *uectx, struct osmo_auth_v int ranap_iu_tx_common_id(struct ranap_ue_conn_ctx *ue_ctx, const char *imsi); int ranap_iu_tx_release(struct ranap_ue_conn_ctx *ctx, const struct RANAP_Cause *cause); +/* freeing the UE will release all resources + * This will close the SCCP connection connected to the UE */ +void ranap_iu_free_ue(struct ranap_ue_conn_ctx *ue_ctx); + void ranap_iu_vty_init(int iu_parent_node, enum ranap_nsap_addr_enc *rab_assign_addr_enc); int ranap_iu_vty_config_write(struct vty *vty, const char *indent); diff --git a/src/iu_client.c b/src/iu_client.c index ce06f8a..c7ed341 100644 --- a/src/iu_client.c +++ b/src/iu_client.c @@ -131,6 +131,16 @@ static struct ranap_ue_conn_ctx *ue_conn_ctx_find(uint32_t conn_id) return NULL; } +void ranap_iu_free_ue(struct ranap_ue_conn_ctx *ue_ctx) +{ + if (!ue_ctx) + return; + + osmo_sccp_tx_disconn(g_scu, ue_ctx->conn_id, NULL, 0); + llist_del(&ue_ctx->list); + talloc_free(ue_ctx); +} + static struct ranap_iu_rnc *iu_rnc_alloc(uint16_t rnc_id, struct osmo_sccp_addr *addr) { struct ranap_iu_rnc *rnc = talloc_zero(talloc_iu_ctx, struct ranap_iu_rnc); -- cgit v1.2.3