forked from acouzens/open5gs
[AMF] Implicit Network-initiated Deregistration
Two timers are introduced (both with duration of T3512 + 4 min): -MOBILE_REACHABLE -IMPLICIT_DEREGISTRATION MOBILE_REACHABLE is set when NAS connection for the UE is released. IMPLICIT_DEREGISTRATION is set when MOBILE_REACHABLE expires. On MOBILE_REACHABLE expiry Paging is ignored. On IMPLICIT_DEREGISTRATION expiry: -UE's RM_State is set to DEREGISTERED -UE is Nudm_SDM_Unsubscribed -UE is Nudm_UECM_Deregistered -PDU sessions are released -AM policies are deleted Existing flag amf_ue->network_initiated_de_reg is used.
This commit is contained in:
parent
8553c77733
commit
bfd5cefe53
|
@ -1177,6 +1177,28 @@ void ran_ue_remove(ran_ue_t *ran_ue)
|
|||
ogs_pool_free(&ran_ue_pool, ran_ue);
|
||||
|
||||
stats_remove_ran_ue();
|
||||
if (ran_ue->amf_ue) {
|
||||
if (ran_ue->amf_ue->rm_state == RM_STATE_REGISTERED) {
|
||||
/* Start AMF_TIMER_MOBILE_REACHABLE
|
||||
* TS 24.501
|
||||
* 5.3.7 Handling of the periodic registration update timer and
|
||||
* mobile reachable timer
|
||||
* The network supervises the periodic registration update procedure
|
||||
* of the UE by means of the mobile reachable timer.
|
||||
* If the UE is not registered for emergency services,
|
||||
* the mobile reachable timer shall be longer than the value of timer
|
||||
* T3512. In this case, by default, the mobile reachable timer is
|
||||
* 4 minutes greater than the value of timer T3512.
|
||||
* The mobile reachable timer shall be reset and started with the
|
||||
* value as indicated above, when the AMF releases the NAS signalling
|
||||
* connection for the UE.
|
||||
* TODO: If the UE is registered for emergency services, the AMF shall
|
||||
* set the mobile reachable timer with a value equal to timer T3512.
|
||||
*/
|
||||
ogs_timer_start(ran_ue->amf_ue->mobile_reachable.timer,
|
||||
ogs_time_from_sec(amf_self()->time.t3512.value + 240));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ran_ue_switch_to_gnb(ran_ue_t *ran_ue, amf_gnb_t *new_gnb)
|
||||
|
@ -1378,6 +1400,22 @@ amf_ue_t *amf_ue_add(ran_ue_t *ran_ue)
|
|||
return NULL;
|
||||
}
|
||||
amf_ue->t3570.pkbuf = NULL;
|
||||
amf_ue->mobile_reachable.timer = ogs_timer_add(
|
||||
ogs_app()->timer_mgr, amf_timer_mobile_reachable_expire, amf_ue);
|
||||
if (!amf_ue->mobile_reachable.timer) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
return NULL;
|
||||
}
|
||||
amf_ue->mobile_reachable.pkbuf = NULL;
|
||||
amf_ue->implicit_deregistration.timer = ogs_timer_add(
|
||||
ogs_app()->timer_mgr, amf_timer_implicit_deregistration_expire, amf_ue);
|
||||
if (!amf_ue->implicit_deregistration.timer) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
return NULL;
|
||||
}
|
||||
amf_ue->implicit_deregistration.pkbuf = NULL;
|
||||
|
||||
/* SBI Type */
|
||||
amf_ue->sbi.type = OGS_SBI_OBJ_UE_TYPE;
|
||||
|
@ -1482,6 +1520,8 @@ void amf_ue_remove(amf_ue_t *amf_ue)
|
|||
ogs_timer_delete(amf_ue->t3555.timer);
|
||||
ogs_timer_delete(amf_ue->t3560.timer);
|
||||
ogs_timer_delete(amf_ue->t3570.timer);
|
||||
ogs_timer_delete(amf_ue->mobile_reachable.timer);
|
||||
ogs_timer_delete(amf_ue->implicit_deregistration.timer);
|
||||
|
||||
/* Free SBI object memory */
|
||||
ogs_sbi_object_free(&amf_ue->sbi);
|
||||
|
@ -1827,6 +1867,18 @@ void amf_ue_associate_ran_ue(amf_ue_t *amf_ue, ran_ue_t *ran_ue)
|
|||
|
||||
amf_ue->ran_ue = ran_ue;
|
||||
ran_ue->amf_ue = amf_ue;
|
||||
|
||||
/* Clear mobile_reachable and implicit_deregistration Timers
|
||||
* TS 24.501
|
||||
* 5.3.7 Handling of the periodic registration update timer and
|
||||
* mobile reachable timer
|
||||
* The mobile reachable timer shall be stopped when a NAS signalling
|
||||
* connection is established for the UE.
|
||||
* The implicit de-registration timer shall be stopped when a NAS
|
||||
* signalling connection is established for the UE.
|
||||
*/
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->mobile_reachable);
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->implicit_deregistration);
|
||||
}
|
||||
|
||||
void ran_ue_deassociate(ran_ue_t *ran_ue)
|
||||
|
|
|
@ -368,6 +368,8 @@ struct amf_ue_s {
|
|||
CLEAR_AMF_UE_TIMER((__aMF)->t3555); \
|
||||
CLEAR_AMF_UE_TIMER((__aMF)->t3560); \
|
||||
CLEAR_AMF_UE_TIMER((__aMF)->t3570); \
|
||||
CLEAR_AMF_UE_TIMER((__aMF)->mobile_reachable); \
|
||||
CLEAR_AMF_UE_TIMER((__aMF)->implicit_deregistration); \
|
||||
} while(0);
|
||||
#define CLEAR_AMF_UE_TIMER(__aMF_UE_TIMER) \
|
||||
do { \
|
||||
|
@ -382,7 +384,7 @@ struct amf_ue_s {
|
|||
ogs_pkbuf_t *pkbuf;
|
||||
ogs_timer_t *timer;
|
||||
uint32_t retry_count;;
|
||||
} t3513, t3522, t3550, t3555, t3560, t3570;
|
||||
} t3513, t3522, t3550, t3555, t3560, t3570, mobile_reachable, implicit_deregistration;
|
||||
|
||||
/* UE Radio Capability */
|
||||
OCTET_STRING_t ueRadioCapability;
|
||||
|
|
|
@ -197,11 +197,24 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_free(amf_ue->data_change_subscription_id);
|
||||
amf_ue->data_change_subscription_id = NULL;
|
||||
}
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate_delete,
|
||||
amf_ue, NULL));
|
||||
if (amf_ue->network_initiated_de_reg) {
|
||||
amf_sbi_send_release_all_sessions(
|
||||
amf_ue, AMF_RELEASE_SM_CONTEXT_NO_STATE);
|
||||
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));
|
||||
}
|
||||
} else {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate_delete,
|
||||
amf_ue, NULL));
|
||||
}
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_warn("Ignoring invalid resource name [%s]",
|
||||
|
@ -274,6 +287,7 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_de_registration_accept(amf_ue));
|
||||
|
||||
amf_ue->network_initiated_de_reg = false;
|
||||
PCF_AM_POLICY_CLEAR(amf_ue);
|
||||
break;
|
||||
|
||||
|
@ -403,6 +417,46 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
}
|
||||
break;
|
||||
|
||||
case AMF_TIMER_MOBILE_REACHABLE:
|
||||
ogs_info("[%s] Mobile Reachable timer expired", amf_ue->supi);
|
||||
/* Clear mobile_reachable Timers */
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->mobile_reachable);
|
||||
/* Start AMF_TIMER_IMPLICIT_DEREGISTRATION
|
||||
* TS 24.501
|
||||
* 5.3.7 Handling of the periodic registration update timer and
|
||||
* mobile reachable timer
|
||||
* Upon expiry of the mobile reachable timer the network shall
|
||||
* start the implicit de-registration timer over 3GPP access.
|
||||
* The default value of the implicit de-registration timer over
|
||||
* 3GPP access is 4 minutes greater than the value of timer T3512.
|
||||
*/
|
||||
ogs_timer_start(amf_ue->implicit_deregistration.timer,
|
||||
ogs_time_from_sec(amf_self()->time.t3512.value + 240));
|
||||
break;
|
||||
case AMF_TIMER_IMPLICIT_DEREGISTRATION:
|
||||
ogs_info("[%s] Implicit de-reg timer expired, de-register UE",
|
||||
amf_ue->supi);
|
||||
/* Clear implicit_deregistration Timers */
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->implicit_deregistration);
|
||||
/* Implicitly de-register UE
|
||||
* TS 24.501
|
||||
* 5.3.7 Handling of the periodic registration update timer and
|
||||
* mobile reachable timer
|
||||
* If the implicit de-registration timer expires before the UE
|
||||
* contacts the network, the network shall implicitly de-register
|
||||
* the UE.
|
||||
* TS 23.502
|
||||
* 4.2.2.3.3 Network-initiated Deregistration
|
||||
* The AMF does not send the Deregistration Request message to the UE
|
||||
* for Implicit Deregistration.
|
||||
*/
|
||||
ogs_assert(true == amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_subscription_delete, amf_ue, NULL));
|
||||
amf_ue->network_initiated_de_reg = true;
|
||||
amf_ue->rm_state = RM_STATE_DEREGISTERED;
|
||||
OGS_FSM_TRAN(s, &gmm_state_de_registered);
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown timer[%s:%d]",
|
||||
amf_timer_get_name(e->h.timer_id), e->h.timer_id);
|
||||
|
|
|
@ -369,6 +369,30 @@ int ngap_send_paging(amf_ue_t *amf_ue)
|
|||
int i, j;
|
||||
int rv;
|
||||
|
||||
if (amf_ue->implicit_deregistration.timer->running) {
|
||||
/* Mobile Reachable timer has expired if implicit de-registration
|
||||
* timer is running
|
||||
* TS 24.501
|
||||
* 5.3.7 Handling of the periodic registration update timer and
|
||||
* mobile reachable timer
|
||||
* The network behaviour upon expiry of the mobile reachable timer
|
||||
* is network dependent, but typically the network stops sending
|
||||
* paging messages to the UE on the first expiry
|
||||
*/
|
||||
ogs_info("[%s] Paging ignored due to Mobile Reachable timer expiration",
|
||||
amf_ue->supi);
|
||||
/* Clear Paging Info */
|
||||
AMF_UE_CLEAR_PAGING_INFO(amf_ue);
|
||||
|
||||
/* Clear N2 Transfer */
|
||||
AMF_UE_CLEAR_N2_TRANSFER(
|
||||
amf_ue, pdu_session_resource_setup_request);
|
||||
|
||||
/* Clear 5GSM Message */
|
||||
AMF_UE_CLEAR_5GSM_MESSAGE(amf_ue);
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
ogs_list_for_each(&amf_self()->gnb_list, gnb) {
|
||||
for (i = 0; i < gnb->num_of_supported_ta_list; i++) {
|
||||
for (j = 0; j < gnb->supported_ta_list[i].num_of_bplmn_list; j++) {
|
||||
|
|
|
@ -93,6 +93,10 @@ const char *amf_timer_get_name(int timer_id)
|
|||
return "AMF_TIMER_T3570";
|
||||
case AMF_TIMER_NG_HOLDING:
|
||||
return "AMF_TIMER_NG_HOLDING";
|
||||
case AMF_TIMER_MOBILE_REACHABLE:
|
||||
return "AMF_TIMER_MOBILE_REACHABLE";
|
||||
case AMF_TIMER_IMPLICIT_DEREGISTRATION:
|
||||
return "AMF_TIMER_IMPLICIT_DEREGISTRATION";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -183,3 +187,13 @@ void amf_timer_ng_holding_timer_expire(void *data)
|
|||
ogs_event_free(e);
|
||||
}
|
||||
}
|
||||
|
||||
void amf_timer_mobile_reachable_expire(void *data)
|
||||
{
|
||||
gmm_timer_event_send(AMF_TIMER_MOBILE_REACHABLE, data);
|
||||
}
|
||||
|
||||
void amf_timer_implicit_deregistration_expire(void *data)
|
||||
{
|
||||
gmm_timer_event_send(AMF_TIMER_IMPLICIT_DEREGISTRATION, data);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ typedef enum {
|
|||
AMF_TIMER_T3555,
|
||||
AMF_TIMER_T3560,
|
||||
AMF_TIMER_T3570,
|
||||
AMF_TIMER_MOBILE_REACHABLE,
|
||||
AMF_TIMER_IMPLICIT_DEREGISTRATION,
|
||||
|
||||
MAX_NUM_OF_AMF_TIMER,
|
||||
|
||||
|
@ -65,6 +67,9 @@ void amf_timer_t3570_expire(void *data);
|
|||
|
||||
void amf_timer_ng_holding_timer_expire(void *data);
|
||||
|
||||
void amf_timer_mobile_reachable_expire(void *data);
|
||||
void amf_timer_implicit_deregistration_expire(void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue