aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2019-09-10 19:09:30 +0200
committerlynxis lazus <lynxis@fe80.eu>2019-09-16 13:57:50 +0000
commit32fc82a803dbfe61d8dcc382ca47b8ae46147702 (patch)
treed4e85a7fbbbdd760ab36649c2982bb14196b0f7e
parentff79699b48c45ecf0fa6e2a9c014bd6ece886f0f (diff)
iu_client: introduce UE field free_on_release
Allow to free UE ctx when receiving a Iu Release Complete. In preparation of ranap_iu_tx_release_free() it requires a field to free the Iu ctx on it's own without depending on the upstream user. Change-Id: Iac41cd3cce3232d01b2f7ede0cc46226c2cfb6c0
-rw-r--r--TODO-RELEASE1
-rw-r--r--include/osmocom/ranap/iu_client.h2
-rw-r--r--src/iu_client.c9
3 files changed, 12 insertions, 0 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE
index bcbf5de..b967e56 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,3 +9,4 @@
#library what description / commit summary line
libranap iu_client.h struct ranap_ue_conn_ctx: add field notification
libranap iu_client.h struct ranap_ue_conn_ctx: add field release_timeout
+libranap iu_client.h struct ranap_ue_conn_ctx: add field free_on_release
diff --git a/include/osmocom/ranap/iu_client.h b/include/osmocom/ranap/iu_client.h
index a93fff3..24a5af9 100644
--- a/include/osmocom/ranap/iu_client.h
+++ b/include/osmocom/ranap/iu_client.h
@@ -31,6 +31,8 @@ struct ranap_ue_conn_ctx {
struct gprs_ra_id ra_id;
enum ranap_nsap_addr_enc rab_assign_addr_enc;
bool notification; /* send notification to the upstream user */
+ /* if true the ue_ctx will be free on Iu release complete */
+ bool free_on_release;
/* Will be set when the Iu Release Command has been sent */
struct osmo_timer_list release_timeout;
};
diff --git a/src/iu_client.c b/src/iu_client.c
index e4eb83e..c309ce4 100644
--- a/src/iu_client.c
+++ b/src/iu_client.c
@@ -129,6 +129,7 @@ static struct ranap_ue_conn_ctx *ue_conn_ctx_alloc(struct ranap_iu_rnc *rnc, uin
ctx->rnc = rnc;
ctx->conn_id = conn_id;
ctx->notification = true;
+ ctx->free_on_release = false;
osmo_timer_setup(&ctx->release_timeout,
(void *)(void *) ranap_iu_free_ue,
ctx);
@@ -500,6 +501,7 @@ void ranap_iu_tx_release_free(struct ranap_ue_conn_ctx *ctx,
int timeout)
{
ctx->notification = false;
+ ctx->free_on_release = true;
int ret = ranap_iu_tx_release(ctx, cause);
if (ret) {
ranap_iu_free_ue(ctx);
@@ -851,6 +853,13 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *_scu)
break;
global_iu_event(ue, RANAP_IU_EVENT_LINK_INVALIDATED, NULL);
+
+ /* A RANAP_IU_EVENT_LINK_INVALIDATED, can lead to a free */
+ ue = ue_conn_ctx_find(prim->u.disconnect.conn_id);
+ if (!ue)
+ break;
+ if (ue->free_on_release)
+ ranap_iu_free_ue(ue);
break;
case OSMO_PRIM(OSMO_SCU_PRIM_N_DATA, PRIM_OP_INDICATION):
/* connection-oriented data received */