From df11c946f91a6547c4e7bfc66a9fb49a91aaf426 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Tue, 20 Jan 2026 16:54:08 +0100 Subject: [PATCH] Paging (NGAP): fix stream handling to comply with TS 38.412 Paging messages are classified as non-UE-associated signalling per 3GPP TS 38.412 clause 7 (TL), which requires them to be sent on stream 0 (or a reserved stream pair). Paging message is received when UE is in RRC_IDLE or RRC_INACTIVE state, as the RAN has no active UE context and paging targets the UE by 5G-S-TMSI rather than RAN-UE-NGAP-ID. The previous implementation incorrectly rejected paging messages received on stream 0, causing paging failures when using Open5GS AMF. Changes: - Accept paging on stream 0 (non-UE-associated signalling) - Reject paging on non-zero streams (UE-associated streams) - Add documentation --- openair3/NGAP/ngap_gNB_handlers.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index fc87bd2d45..9113f850ca 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -1098,6 +1098,12 @@ static int ngap_gNB_handle_handover_cancel_ack(sctp_assoc_t assoc_id, uint32_t s return 0; } +/** + * @brief Handle NGAP Paging message from AMF + * @param assoc_id SCTP association ID + * @param stream SCTP stream ID (must be 0 for paging per TS 38.412 Clause 7) + * @param pdu NGAP PDU containing Paging message + * @return 0 on success, -1 on failure */ static int ngap_gNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { ngap_gNB_amf_data_t *amf_desc_p = NULL; @@ -1106,10 +1112,14 @@ static int ngap_gNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, NGAP_N // received Paging Message from AMF NGAP_DEBUG("[SCTP %u] Received Paging Message From AMF\n",assoc_id); - /* Paging procedure -> stream != 0 */ - if (stream == 0) { - LOG_W(NGAP,"[SCTP %d] Received Paging procedure on stream (%d)\n", - assoc_id, stream); + /* Per 3GPP TS 38.412 Clause 7 (Transport layer): + * Paging is classified as "non-UE-associated signalling" because: + * - UE is in RRC_IDLE or RRC_INACTIVE state + * - No active UE context exists in the RAN + * - Paging targets UE by 5G-S-TMSI, not by RAN-UE-NGAP-ID + * Non-UE-associated signalling MUST use stream 0 (or a reserved stream pair) */ + if (stream != 0) { + LOG_W(NGAP,"[SCTP %d] Received Paging procedure on stream != 0 (expected stream 0 per TS 38.412)\n", assoc_id); return -1; }