From f1db9cb1580aaab9406bb8f82b3d880ccb7175c6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 12 Jan 2026 17:47:55 +0100 Subject: [PATCH] Forward AMF UE NGAP ID to RRC on DL NAS Message In the Initial Context Setup message, the NGAP forwards the AMF UE ID, but not in the DL NAS Message, although 38.413 says, in $8.3.1.2 either > The NG-RAN node shall use the AMF UE NGAP ID IE and RAN UE NGAP ID IE > received in the INITIAL CONTEXT SETUP REQUEST message as identification > of the logical connection or in $8.6.2.2 > The NG-RAN node shall use the AMF UE NGAP ID IE and RAN UE NGAP ID IE > received in the DOWNLINK NAS TRANSPORT message as identification of the > logical connection So forward in both cases for harmonization. --- openair2/COMMON/ngap_messages_types.h | 2 ++ openair2/RRC/NR/rrc_gNB_NGAP.c | 1 + openair3/NGAP/ngap_gNB_itti_messaging.c | 3 ++- openair3/NGAP/ngap_gNB_itti_messaging.h | 6 +++++- openair3/NGAP/ngap_gNB_nas_procedures.c | 6 +++++- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/openair2/COMMON/ngap_messages_types.h b/openair2/COMMON/ngap_messages_types.h index 3bfd2e20a2..0aad7b8598 100644 --- a/openair2/COMMON/ngap_messages_types.h +++ b/openair2/COMMON/ngap_messages_types.h @@ -737,6 +737,8 @@ typedef struct ngap_ue_ctxt_modification_resp_s { typedef struct ngap_downlink_nas_s { /* UE id for initial connection to NGAP */ uint32_t gNB_ue_ngap_id; + /* UE id at AMF */ + uint64_t amf_ue_ngap_id; /* NAS pdu */ byte_array_t nas_pdu; } ngap_downlink_nas_t; diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 65991f714d..19bab47b67 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -717,6 +717,7 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu } gNB_RRC_UE_t *UE = &ue_context_p->ue_context; + UE->amf_ue_ngap_id = req->amf_ue_ngap_id; UE->nas_pdu = req->nas_pdu; rrc_forward_ue_nas_message(rrc, UE); return 0; diff --git a/openair3/NGAP/ngap_gNB_itti_messaging.c b/openair3/NGAP/ngap_gNB_itti_messaging.c index b640f2e556..1e03192599 100644 --- a/openair3/NGAP/ngap_gNB_itti_messaging.c +++ b/openair3/NGAP/ngap_gNB_itti_messaging.c @@ -54,7 +54,7 @@ void ngap_gNB_itti_send_sctp_data_req(instance_t instance, itti_send_msg_to_task(TASK_SCTP, instance, message_p); } -void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ngap_id, uint8_t *nas_pdu, uint32_t nas_pdu_length) +void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ngap_id, uint64_t amf_ue_ngap_id, uint8_t *nas_pdu, uint32_t nas_pdu_length) { MessageDef *message_p; ngap_downlink_nas_t *ngap_downlink_nas; @@ -64,6 +64,7 @@ void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ng ngap_downlink_nas = &message_p->ittiMsg.ngap_downlink_nas; ngap_downlink_nas->gNB_ue_ngap_id = gNB_ue_ngap_id; + ngap_downlink_nas->amf_ue_ngap_id = amf_ue_ngap_id; ngap_downlink_nas->nas_pdu = create_byte_array(nas_pdu_length, nas_pdu); itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p); diff --git a/openair3/NGAP/ngap_gNB_itti_messaging.h b/openair3/NGAP/ngap_gNB_itti_messaging.h index 67054761e3..09ae4d6480 100644 --- a/openair3/NGAP/ngap_gNB_itti_messaging.h +++ b/openair3/NGAP/ngap_gNB_itti_messaging.h @@ -40,7 +40,11 @@ void ngap_gNB_itti_send_sctp_data_req(instance_t instance, uint32_t buffer_length, uint16_t stream); -void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ngap_id, uint8_t *nas_pdu, uint32_t nas_pdu_length); +void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, + uint32_t gNB_ue_ngap_id, + uint64_t amf_ue_ngap_id, + uint8_t *nas_pdu, + uint32_t nas_pdu_length); void ngap_gNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index 2218155c61..7bf7753668 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -361,7 +361,11 @@ int ngap_gNB_handle_nas_downlink(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NG NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkNASTransport_IEs_t, ie, container, NGAP_ProtocolIE_ID_id_NAS_PDU, true); /* Forward the NAS PDU to NR-RRC */ - ngap_gNB_itti_send_nas_downlink_ind(ngap_gNB_instance->instance, ue_desc_p->gNB_ue_ngap_id, ie->value.choice.NAS_PDU.buf, ie->value.choice.NAS_PDU.size); + ngap_gNB_itti_send_nas_downlink_ind(ngap_gNB_instance->instance, + ue_desc_p->gNB_ue_ngap_id, + ue_desc_p->amf_ue_ngap_id, + ie->value.choice.NAS_PDU.buf, + ie->value.choice.NAS_PDU.size); return 0; }