From 389d7a0246a4ab824060673c5ada031c0b531ca7 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Fri, 17 Apr 2026 16:11:38 +0200 Subject: [PATCH] fix (RRC): do not trigger N2 HO when no active PDU sessions are present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevent triggering N2 handover when the UE has no active PDU session by adding an early check in nr_rrc_trigger_n2_ho(), so we avoid building an invalid HO Required. This aligns with 3GPP TS 38.413 (§9.2.3.1), where HANDOVER REQUIRED carries a PDU Session Resource List with at least one PDU Session Resource Item (range 1..maxnoofPDUSessions). --- openair2/RRC/NR/rrc_gNB_mobility.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/openair2/RRC/NR/rrc_gNB_mobility.c b/openair2/RRC/NR/rrc_gNB_mobility.c index fdbc2d66af..86c2c42239 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.c +++ b/openair2/RRC/NR/rrc_gNB_mobility.c @@ -552,6 +552,21 @@ void nr_rrc_trigger_n2_ho_target(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue) * 2) send NGAP Handover Required message */ void nr_rrc_trigger_n2_ho(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue, const nr_neighbour_cell_t *neighbour_config) { + bool has_active_pdu_session = false; + FOR_EACH_SEQ_ARR (rrc_pdu_session_param_t *, pduSession, &ue->pduSessions) { + if (pduSession->status == PDU_SESSION_STATUS_DONE || pduSession->status == PDU_SESSION_STATUS_ESTABLISHED) { + has_active_pdu_session = true; + break; + } + } + /* If there are no active PDU sessions, we can't send the Handover Preparation information + * message to the source gNB (3GPP TS 38.413 §9.2.3.1): Handover Required must carry a PDU + * Session Resource List with at least one PDU Session Resource Item */ + if (!has_active_pdu_session) { + LOG_W(NR_RRC, "N2 HO not triggered for UE %u: no active PDU sessions\n", ue->rrc_ue_id); + return; + } + byte_array_t hoPrepInfo = rrc_gNB_generate_HandoverPreparationInformation(rrc, ue); if (hoPrepInfo.len < 0) { free_byte_array(hoPrepInfo);