mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
RRCReestablishmentRequest: add C-RNTI constants and fix spec compliance
Replace hardcoded C-RNTI range values (0x1, 0xffef) with named constants NR_C_RNTI_MIN and NR_C_RNTI_MAX. Correct maximum value to 0xfff2 per TS 38.321 Table 7.1-1. Change invalid C-RNTI handling to return early instead of fallback to RRCSetup for spec compliance. Fallback to RRCSetup only occurs when UE context cannot be retrieved, not for validation errors, which for out-of-range values could come from malicious UEs. Major changes: - Add NR_C_RNTI_MIN (0x0001) and NR_C_RNTI_MAX (0xfff2) constants to common/platform_constants.h - Replace magic numbers in C-RNTI validation with named constants - Change error path from fallback_rrc_setup to return for invalid C-RNTI - Early validation before further processing Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
This commit is contained in:
committed by
Guido Casati
parent
d568920466
commit
cde7d98a61
@@ -97,6 +97,10 @@ mui_t rrc_gNB_mui = 0;
|
||||
/* Per-transaction max_delays counter to limit retry attempts */
|
||||
#define MAX_DELAYS 100
|
||||
|
||||
/* C-RNTI range (0001-FFF2) (TS 38.321 Table 7.1-1, Rel-16+) */
|
||||
#define NR_C_RNTI_MIN 0x0001
|
||||
#define NR_C_RNTI_MAX 0xfff2
|
||||
|
||||
/** @brief clone and re-enqueue an NGAP message after delaying
|
||||
* delays the ongoing transaction (in msg_p) by setting a timer to wait
|
||||
* 10ms; upon expiry, delivers to RRC, which sends the message to itself */
|
||||
@@ -1462,6 +1466,12 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc,
|
||||
return;
|
||||
}
|
||||
|
||||
/* TS 38.321 Table 7.1-1: out-of-range C-RNTI, ignore request */
|
||||
if (old_rnti < NR_C_RNTI_MIN || old_rnti > NR_C_RNTI_MAX) {
|
||||
LOG_E(NR_RRC, "C-RNTI %04x out of range (%#04x-%#04x): rejecting RRCReestablishmentRequest\n", old_rnti, NR_C_RNTI_MIN, NR_C_RNTI_MAX);
|
||||
return;
|
||||
}
|
||||
|
||||
const nr_rrc_du_container_t *du = get_du_by_assoc_id(rrc, assoc_id);
|
||||
if (du == NULL) {
|
||||
LOG_E(RRC, "received CCCH message, but no corresponding DU found\n");
|
||||
@@ -1478,12 +1488,6 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc,
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate C-RNTI range (3GPP TS 38.321 version 15.13.0 Section 7.1 Table 7.1-1)
|
||||
if (old_rnti < 0x1 || old_rnti > 0xffef) {
|
||||
LOG_E(NR_RRC, "NR_RRCReestablishmentRequest c_RNTI %04x range error, fallback to RRC setup\n", old_rnti);
|
||||
goto fallback_rrc_setup;
|
||||
}
|
||||
|
||||
if (current_cell->mtc == NULL) {
|
||||
// some UEs don't send MeasurementTimingConfiguration, so we don't know the
|
||||
// SSB ARFCN and can't do reestablishment. handle it gracefully by doing
|
||||
|
||||
Reference in New Issue
Block a user