Change in osmo-iuh[master]: ranap_iu_tx_release_free(): always trigger RANAP_IU_EVENT_IU_RELEASE ...

pespin gerrit-no-reply at
Thu Apr 15 14:30:42 UTC 2021

pespin has submitted this change. ( )

Change subject: ranap_iu_tx_release_free(): always trigger RANAP_IU_EVENT_IU_RELEASE as a result

ranap_iu_tx_release_free(): always trigger RANAP_IU_EVENT_IU_RELEASE as a result

This allows the SGSN always having feedback on the resolution of the
release, hence being able to stay in PMM CONNECTED state until the
resolution is received, then moving to PMM IDLE.

Related: SYS#5389
Change-Id: Iac822c74e56750dc40e94573eae0e20853ff68c0
M include/osmocom/ranap/iu_client.h
M src/iu_client.c
2 files changed, 13 insertions(+), 8 deletions(-)

  fixeria: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified

diff --git a/include/osmocom/ranap/iu_client.h b/include/osmocom/ranap/iu_client.h
index 24a5af9..2e72839 100644
--- a/include/osmocom/ranap/iu_client.h
+++ b/include/osmocom/ranap/iu_client.h
@@ -75,9 +75,9 @@
 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);
-/* transmit a Iu Release Command and free the ctx afterwards.
- * If a Release Complete is not received within timeout s,
- * release the SCCP connection. */
+/* Transmit a Iu Release Command and submit event RANAP_IU_EVENT_IU_RELEASE upon
+ * Release Complete or timeout. Caller is responsible to free the context and
+ * closing the SCCP connection (ranap_iu_free_ue) upon recieval of the event. */
 void ranap_iu_tx_release_free(struct ranap_ue_conn_ctx *ctx,
 			      const struct RANAP_Cause *cause,
 			      int timeout);
diff --git a/src/iu_client.c b/src/iu_client.c
index 06285ec..da433da 100644
--- a/src/iu_client.c
+++ b/src/iu_client.c
@@ -124,6 +124,12 @@
 	return global_iu_event_cb(ue_ctx, type, data);
+static void ue_conn_ctx_release_timeout_cb(void *ctx_)
+	struct ranap_ue_conn_ctx *ctx = (struct ranap_ue_conn_ctx *)ctx_;
+	global_iu_event(ctx, RANAP_IU_EVENT_IU_RELEASE, NULL);
 static struct ranap_ue_conn_ctx *ue_conn_ctx_alloc(struct ranap_iu_rnc *rnc, uint32_t conn_id)
 	struct ranap_ue_conn_ctx *ctx = talloc_zero(talloc_iu_ctx, struct ranap_ue_conn_ctx);
@@ -133,7 +139,7 @@
 	ctx->notification = true;
 	ctx->free_on_release = false;
-			 (void *)(void *) ranap_iu_free_ue,
+			 ue_conn_ctx_release_timeout_cb,
 	llist_add(&ctx->list, &ue_conn_ctx_list);
@@ -501,10 +507,9 @@
 	ctx->notification = false;
 	ctx->free_on_release = true;
 	int ret = ranap_iu_tx_release(ctx, cause);
-	if (ret) {
-		ranap_iu_free_ue(ctx);
-		return;
-	}
+	/* On Tx failure, trigger timeout immediately, as the response will never arrive */
+	if (ret)
+		timeout = 0;
 	osmo_timer_schedule(&ctx->release_timeout, timeout, 0);

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: Iac822c74e56750dc40e94573eae0e20853ff68c0
Gerrit-Change-Number: 23742
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at>
Gerrit-Reviewer: fixeria <vyanitskiy at>
Gerrit-Reviewer: laforge <laforge at>
Gerrit-Reviewer: lynxis lazus <lynxis at>
Gerrit-Reviewer: osmith <osmith at>
Gerrit-Reviewer: pespin <pespin at>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list