[AMF] Accept Deregistration Notification from UDM only for registered UE (#1737)

Add additional check when receiving Deregistration Notification from
UDM. UE should already be in registered state before accepting the
request and deregistering the UE.

Also add additional check that PCF association policy exists before
sending a delete request to PCF.
This commit is contained in:
Bostjan Meglic 2022-09-06 12:47:42 +02:00 committed by GitHub
parent e55d4d8300
commit 51669d73a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -565,7 +565,8 @@ int amf_namf_callback_handle_dereg_notify(
*/
if (CM_CONNECTED(amf_ue))
if ((CM_CONNECTED(amf_ue)) &&
(OGS_FSM_CHECK(&amf_ue->sm, gmm_state_registered)))
{
amf_ue->network_initiated_de_reg = true;
@ -575,11 +576,14 @@ int amf_namf_callback_handle_dereg_notify(
amf_sbi_send_release_all_sessions(
amf_ue, AMF_RELEASE_SM_CONTEXT_NO_STATE);
if (ogs_list_count(&amf_ue->sess_list) == 0)
if ((ogs_list_count(&amf_ue->sess_list) == 0) &&
(PCF_AM_POLICY_ASSOCIATED(amf_ue)))
{
ogs_assert(true ==
amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL, NULL,
amf_npcf_am_policy_control_build_delete, amf_ue, NULL));
}
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_de_registered);
}
@ -587,6 +591,11 @@ int amf_namf_callback_handle_dereg_notify(
/* TODO: need to page UE */
/*ngap_send_paging(amf_ue);*/
}
else {
status = OGS_SBI_HTTP_STATUS_BAD_REQUEST;
ogs_error("[%s] Deregistration notification for UE in wrong state", amf_ue->supi);
goto cleanup;
}
cleanup:
memset(&sendmsg, 0, sizeof(sendmsg));