From 8973a0bfdc442c7d9e91063932b679c0f18f95fc Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Tue, 7 Feb 2023 22:29:53 +0900 Subject: [PATCH] [AMF] Delete UERadioCapability (#2040, #1917) 23.501 (5G NAS stage 2) 5.4.4.1: "When the AMF receives Registration Request with the Registration type set to Initial Registration or when it receives the first Registration Request after E-UTRA/EPC Attach with Registration type set to Mobility Registration Update, the AMF deletes the UE radio capability." --- src/amf/gmm-handler.c | 76 +++++++++++++++++++++++++++++++++++++++++++ src/amf/gmm-sm.c | 11 +++++++ 2 files changed, 87 insertions(+) diff --git a/src/amf/gmm-handler.c b/src/amf/gmm-handler.c index 9632bfcf5..f6fd2c246 100644 --- a/src/amf/gmm-handler.c +++ b/src/amf/gmm-handler.c @@ -174,6 +174,41 @@ ogs_nas_5gmm_cause_t gmm_handle_registration_request(amf_ue_t *amf_ue, sizeof(ogs_nas_5gs_registration_type_t)); amf_ue->nas.message_type = OGS_NAS_5GS_REGISTRATION_REQUEST; + if (registration_type->value == OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL) { + /* + * Issue #2040 + * + * TS23.501 + * 5.4.4 UE Radio Capability handling + * 5.4.4.1 UE radio capability information storage in the AMF + * + * The AMF deletes the UE radio capability when the UE RM state + * in the AMF transitions to RM-DEREGISTERED. When the AMF receives + * Registration Request with the Registration type set to Initial + * Registration or when it receives the first Registration Request + * after E-UTRA/EPC Attach with Registration type set to Mobility + * Registration Update, the AMF deletes the UE radio capability. + * + * TS24.501 + * 5.5.2 De-registration procedure + * 5.5.2.1 General + * + * When the AMF enters the state 5GMM-DEREGISTERED for 3GPP access, + * the AMF shall delete the stored UE radio capability information + * or the UE radio capability ID, if any. + * + * (DEPRECATED) Issue #1917 (from Switch-Off to De-Registration) + * + * When the UE sends a De-registration Request with Switch-Off, + * AMF should remove the the stored UE Radio Capability. + * + * Otherwise, the Radio Capability will not match + * because the gNB will not query the Radio Capability + * when the UE changes USIM. + */ + OGS_ASN_CLEAR_DATA(&amf_ue->ueRadioCapability); + } + amf_ue->nas.ue.tsc = registration_type->tsc; amf_ue->nas.ue.ksi = registration_type->ksi; ogs_debug(" OLD TSC[UE:%d,AMF:%d] KSI[UE:%d,AMF:%d]", @@ -291,6 +326,7 @@ ogs_nas_5gmm_cause_t gmm_handle_registration_update(amf_ue_t *amf_ue, ogs_nas_5gs_tracking_area_identity_t *last_visited_registered_tai = NULL; ogs_nas_uplink_data_status_t *uplink_data_status = NULL; ogs_nas_pdu_session_status_t *pdu_session_status = NULL; + ogs_nas_5gs_update_type_t *update_type = NULL; ogs_assert(amf_ue); ogs_assert(registration_request); @@ -302,6 +338,8 @@ ogs_nas_5gmm_cause_t gmm_handle_registration_update(amf_ue_t *amf_ue, ogs_assert(uplink_data_status); pdu_session_status = ®istration_request->pdu_session_status; ogs_assert(pdu_session_status); + update_type = ®istration_request->update_type; + ogs_assert(update_type); if (registration_request->presencemask & OGS_NAS_5GS_REGISTRATION_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT) { @@ -427,6 +465,44 @@ ogs_nas_5gmm_cause_t gmm_handle_registration_update(amf_ue_t *amf_ue, } } + if (registration_request->presencemask & + OGS_NAS_5GS_REGISTRATION_REQUEST_5GS_UPDATE_TYPE_PRESENT) { + if (update_type->ng_ran_radio_capability_update_needed == 1) { + /* + * Issue #2040 + * + * TS23.501 + * 5.4.4 UE Radio Capability handling + * 5.4.4.1 UE radio capability information storage in the AMF + * + * The AMF deletes the UE radio capability when the UE RM state + * in the AMF transitions to RM-DEREGISTERED. When the AMF receives + * Registration Request with the Registration type set to Initial + * Registration or when it receives the first Registration Request + * after E-UTRA/EPC Attach with Registration type set to Mobility + * Registration Update, the AMF deletes the UE radio capability. + * + * TS24.501 + * 5.5.2 De-registration procedure + * 5.5.2.1 General + * + * When the AMF enters the state 5GMM-DEREGISTERED for 3GPP access, + * the AMF shall delete the stored UE radio capability information + * or the UE radio capability ID, if any. + * + * (DEPRECATED) Issue #1917 (from Switch-Off to De-Registration) + * + * When the UE sends a De-registration Request with Switch-Off, + * AMF should remove the the stored UE Radio Capability. + * + * Otherwise, the Radio Capability will not match + * because the gNB will not query the Radio Capability + * when the UE changes USIM. + */ + OGS_ASN_CLEAR_DATA(&amf_ue->ueRadioCapability); + } + } + return OGS_5GMM_CAUSE_REQUEST_ACCEPTED; } diff --git a/src/amf/gmm-sm.c b/src/amf/gmm-sm.c index b9bfe591b..3921b776c 100644 --- a/src/amf/gmm-sm.c +++ b/src/amf/gmm-sm.c @@ -84,6 +84,17 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e) /* * Issue #2040 * + * TS23.501 + * 5.4.4 UE Radio Capability handling + * 5.4.4.1 UE radio capability information storage in the AMF + * + * The AMF deletes the UE radio capability when the UE RM state + * in the AMF transitions to RM-DEREGISTERED. When the AMF receives + * Registration Request with the Registration type set to Initial + * Registration or when it receives the first Registration Request + * after E-UTRA/EPC Attach with Registration type set to Mobility + * Registration Update, the AMF deletes the UE radio capability. + * * TS24.501 * 5.5.2 De-registration procedure * 5.5.2.1 General