From 42756add130428faba9c5f72e605f69633e0832a Mon Sep 17 00:00:00 2001 From: kkoutlia Date: Fri, 26 May 2023 17:03:54 +0200 Subject: [PATCH] lte: (fixes #885) Don't send RAR when UE context is not created --- src/lte/model/lte-enb-mac.cc | 8 ++++++++ src/lte/model/lte-enb-rrc.cc | 1 + 2 files changed, 9 insertions(+) diff --git a/src/lte/model/lte-enb-mac.cc b/src/lte/model/lte-enb-mac.cc index 7ec881cbe..40799edba 100644 --- a/src/lte/model/lte-enb-mac.cc +++ b/src/lte/model/lte-enb-mac.cc @@ -526,6 +526,14 @@ LteEnbMac::DoSubframeIndication(uint32_t frameNo, uint32_t subframeNo) else { rnti = m_cmacSapUser->AllocateTemporaryCellRnti(); + + if (rnti == 0) + { + // If rnti = 0, UE context was not created (not enough SRS) + // Therefore don't send RAR for this preamble + NS_LOG_INFO("UE Context not created, no RAR is send"); + continue; + } NS_LOG_INFO("preambleId " << (uint32_t)it->first << ": allocated T-C-RNTI " << (uint32_t)rnti << ", sending RAR"); } diff --git a/src/lte/model/lte-enb-rrc.cc b/src/lte/model/lte-enb-rrc.cc index ebf990012..04801a464 100644 --- a/src/lte/model/lte-enb-rrc.cc +++ b/src/lte/model/lte-enb-rrc.cc @@ -3123,6 +3123,7 @@ LteEnbRrc::DoAllocateTemporaryCellRnti(uint8_t componentCarrierId) // if no SRS index is available, then do not create a new UE context. if (IsMaxSrsReached()) { + NS_LOG_WARN("Not enough SRS configuration index, UE context not created"); return 0; // return 0 since new RNTI was not assigned for the received preamble } return AddUe(UeManager::INITIAL_RANDOM_ACCESS, componentCarrierId);