From 922684f318802395f319fbc5f81badc9f63bd754 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 14 Apr 2021 12:42:00 +0200 Subject: gprs_ranap.c: Clean up code path releasing IU conn Let's always send the event to the FSM and keep logic of whether it's a good event to sent or not inside the FSM, not in the caller. The logic is kept the same: if the event is not expected (not handled), keep forcing free of the IU connection. In theory this should never happen since only a PMM in Connected state should have a established connection (hence only a PMM in Connected state can have it released). In any case let's keep the safety check, but let the FSM receive the event and log an error about unexpected event, which is more interesting from debug point of view. While at it, clean up the related logging line: There's no need to print the imsi explicitly, since LOGMMCTXP already does it. Furthermore, print the exact low level event which triggered the code path. Related: SYS#5389 Change-Id: I45017562ea7f27c2248b7de56f99ce7ca88e89b2 --- src/sgsn/gprs_ranap.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/sgsn/gprs_ranap.c b/src/sgsn/gprs_ranap.c index 2d2d3aa34..e8addd7ec 100644 --- a/src/sgsn/gprs_ranap.c +++ b/src/sgsn/gprs_ranap.c @@ -134,10 +134,9 @@ int sgsn_ranap_iu_event(struct ranap_ue_conn_ctx *ctx, enum ranap_iu_event_type /* fall thru */ case RANAP_IU_EVENT_LINK_INVALIDATED: /* Clean up ranap_ue_conn_ctx here */ - LOGMMCTXP(LOGL_INFO, mm, "IU release for imsi %s\n", mm->imsi); - if (mm->iu.mm_state_fsm->state == ST_PMM_CONNECTED) - osmo_fsm_inst_dispatch(mm->iu.mm_state_fsm, E_PMM_PS_CONN_RELEASE, NULL); - else + LOGMMCTXP(LOGL_INFO, mm, "IU release (cause=%s)\n", ranap_iu_event_type_str(type)); + rc = osmo_fsm_inst_dispatch(mm->iu.mm_state_fsm, E_PMM_PS_CONN_RELEASE, NULL); + if (rc < 0) sgsn_ranap_iu_free(mm); /* TODO: move this into FSM */ -- cgit v1.2.3