From b0d505d2e8492bbee330ba8205758089d07da624 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Mon, 27 Nov 2017 11:19:12 +0100
Subject: [PATCH] bugfix: always cancel Random Access Process

Even if the old UE is not found, we have to cancel the random access.
---
 openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index 343d391538..421eab7cd7 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -268,6 +268,9 @@ rx_sdu(const module_id_t enb_mod_idP,
 		      "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n",
 		      enb_mod_idP, frameP, subframeP, CC_idP, rx_ces[i], i,
 		      num_ce, old_rnti, old_UE_id);
+		/* receiving CRNTI means that the current rnti has to go away */
+		cancel_ra_proc(enb_mod_idP, CC_idP, frameP,
+			       current_rnti);
 		if (old_UE_id != -1) {
 		    /* TODO: if the UE did random access (followed by a MAC uplink with
 		     * CRNTI) because none of its scheduling request was granted, then
@@ -288,9 +291,6 @@ rx_sdu(const module_id_t enb_mod_idP,
 			mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP,
 					       subframeP, old_rnti);
 		    }
-		    /* receiving CRNTI means that the current rnti has to go away */
-		    cancel_ra_proc(enb_mod_idP, CC_idP, frameP,
-				   current_rnti);
 		    current_rnti = old_rnti;
 		}
 		crnti_rx = 1;
-- 
GitLab