From d33d67b2af9a04ca25a2eaf302d36812ef8b2689 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Sun, 13 Aug 2023 11:16:06 +0900 Subject: [PATCH] [AMF/MME] Defaults 9 minutes for T3412/T3512 --- configs/310014.yaml.in | 2 ++ configs/csfb.yaml.in | 2 ++ configs/non3gpp.yaml.in | 2 ++ configs/open5gs/mme.yaml.in | 2 ++ configs/sample.yaml.in | 2 ++ configs/slice.yaml.in | 2 ++ configs/srsenb.yaml.in | 2 ++ configs/volte.yaml.in | 2 ++ configs/vonr.yaml.in | 2 ++ lib/nas/common/conv.c | 6 ++-- src/amf/context.c | 9 +++++- src/amf/gmm-build.c | 17 ++++++----- src/mme/emm-build.c | 14 ++++------ src/mme/emm-sm.c | 56 ++++++++++++++++++++++++++++++++++--- src/mme/mme-context.c | 10 ++++++- src/mme/s1ap-handler.c | 52 ++++++++++++++++++++++++++++++++++ 16 files changed, 155 insertions(+), 27 deletions(-) diff --git a/configs/310014.yaml.in b/configs/310014.yaml.in index aefd5ec06..0a6f9079b 100644 --- a/configs/310014.yaml.in +++ b/configs/310014.yaml.in @@ -255,5 +255,7 @@ udr: port: 7777 time: + t3412: + value: 540 # 9 mintues * 60 = 540 seconds t3512: value: 540 # 9 mintues * 60 = 540 seconds diff --git a/configs/csfb.yaml.in b/configs/csfb.yaml.in index 2ac2fa61c..3adfaccca 100644 --- a/configs/csfb.yaml.in +++ b/configs/csfb.yaml.in @@ -284,5 +284,7 @@ udr: port: 7777 time: + t3412: + value: 540 # 9 mintues * 60 = 540 seconds t3512: value: 540 # 9 mintues * 60 = 540 seconds diff --git a/configs/non3gpp.yaml.in b/configs/non3gpp.yaml.in index 8d51c8814..ba84c020d 100644 --- a/configs/non3gpp.yaml.in +++ b/configs/non3gpp.yaml.in @@ -253,5 +253,7 @@ udr: port: 7777 time: + t3412: + value: 540 # 9 mintues * 60 = 540 seconds t3512: value: 540 # 9 mintues * 60 = 540 seconds diff --git a/configs/open5gs/mme.yaml.in b/configs/open5gs/mme.yaml.in index d74af085a..5c3cfa149 100644 --- a/configs/open5gs/mme.yaml.in +++ b/configs/open5gs/mme.yaml.in @@ -581,3 +581,5 @@ usrsctp: # t3423: # value: 720 # 12 minutes * 60 = 720 seconds time: + t3412: + value: 540 # 9 mintues * 60 = 540 seconds diff --git a/configs/sample.yaml.in b/configs/sample.yaml.in index 47a3c1fd6..2dc3187c3 100644 --- a/configs/sample.yaml.in +++ b/configs/sample.yaml.in @@ -271,5 +271,7 @@ udr: port: 7777 time: + t3412: + value: 540 # 9 mintues * 60 = 540 seconds t3512: value: 540 # 9 mintues * 60 = 540 seconds diff --git a/configs/slice.yaml.in b/configs/slice.yaml.in index 9852526d8..1273c5d1b 100644 --- a/configs/slice.yaml.in +++ b/configs/slice.yaml.in @@ -264,5 +264,7 @@ udr: port: 7777 time: + t3412: + value: 540 # 9 mintues * 60 = 540 seconds t3512: value: 540 # 9 mintues * 60 = 540 seconds diff --git a/configs/srsenb.yaml.in b/configs/srsenb.yaml.in index 2ec2ed989..a24ef8504 100644 --- a/configs/srsenb.yaml.in +++ b/configs/srsenb.yaml.in @@ -250,5 +250,7 @@ udr: port: 7777 time: + t3412: + value: 540 # 9 mintues * 60 = 540 seconds t3512: value: 540 # 9 mintues * 60 = 540 seconds diff --git a/configs/volte.yaml.in b/configs/volte.yaml.in index 82149f2a2..45b100776 100644 --- a/configs/volte.yaml.in +++ b/configs/volte.yaml.in @@ -257,5 +257,7 @@ udr: port: 7777 time: + t3412: + value: 540 # 9 mintues * 60 = 540 seconds t3512: value: 540 # 9 mintues * 60 = 540 seconds diff --git a/configs/vonr.yaml.in b/configs/vonr.yaml.in index 316350307..e1c4c7ce1 100644 --- a/configs/vonr.yaml.in +++ b/configs/vonr.yaml.in @@ -265,5 +265,7 @@ udr: port: 7777 time: + t3412: + value: 540 # 9 mintues * 60 = 540 seconds t3512: value: 540 # 9 mintues * 60 = 540 seconds diff --git a/lib/nas/common/conv.c b/lib/nas/common/conv.c index 5c1c3a5c4..fe57c4abf 100644 --- a/lib/nas/common/conv.c +++ b/lib/nas/common/conv.c @@ -97,11 +97,11 @@ int ogs_nas_gprs_timer_from_sec( gprs_timer->unit = OGS_NAS_GPRS_TIMER_UNIT_MULTIPLES_OF_1_MM; gprs_timer->value = timer_value; } else { - if (timer_value%10 != 0) { - ogs_error("Not multiples of decihours(= 10 minutes)"); + if (timer_value%6 != 0) { + ogs_error("Not multiples of decihours(= 6 minutes)"); return OGS_ERROR; } - timer_value /= 10; /* multiples of decihours = 10 minutes */ + timer_value /= 6; /* multiples of decihours = 6 minutes */ if (timer_value <= 31) { gprs_timer->unit = OGS_NAS_GPRS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; gprs_timer->value = timer_value; diff --git a/src/amf/context.c b/src/amf/context.c index 08f8510dc..28a544951 100644 --- a/src/amf/context.c +++ b/src/amf/context.c @@ -172,7 +172,7 @@ static int amf_context_validation(void) } if (self.num_of_ciphering_order == 0) { - ogs_error("no amf.security.ciphering_order in '%s'", + ogs_error("No amf.security.ciphering_order in '%s'", ogs_app()->file); return OGS_ERROR; } @@ -181,6 +181,11 @@ static int amf_context_validation(void) ogs_error("Not support GPRS Timer 2 [%d]", (int)self.time.t3502.value); return OGS_ERROR; } + if (!self.time.t3512.value) { + ogs_error("No amf.time.t3512.value in '%s'", + ogs_app()->file); + return OGS_ERROR; + } if (ogs_nas_gprs_timer_3_from_sec(&gprs_timer, self.time.t3512.value) != OGS_OK) { ogs_error("Not support GPRS Timer 3 [%d]", (int)self.time.t3512.value); @@ -1024,6 +1029,8 @@ int amf_context_parse_config(void) } else ogs_warn("unknown key `%s`", t3512_key); } + } else if (!strcmp(time_key, "t3412")) { + /* handle config in mme */ } else if (!strcmp(time_key, "nf_instance")) { /* handle config in app library */ } else if (!strcmp(time_key, "subscription")) { diff --git a/src/amf/gmm-build.c b/src/amf/gmm-build.c index 4657ba304..831cc67de 100644 --- a/src/amf/gmm-build.c +++ b/src/amf/gmm-build.c @@ -129,15 +129,14 @@ ogs_pkbuf_t *gmm_build_registration_accept(amf_ue_t *amf_ue) network_feature_support-> ims_voice_over_ps_session_over_3gpp_access_indicator = 1; - /* Set T3512 */ - if (amf_self()->time.t3512.value) { - rv = ogs_nas_gprs_timer_3_from_sec( - &t3512_value->t, amf_self()->time.t3512.value); - ogs_assert(rv == OGS_OK); - registration_accept->presencemask |= - OGS_NAS_5GS_REGISTRATION_ACCEPT_T3512_VALUE_PRESENT; - t3512_value->length = 1; - } + /* Set T3512 : Mandatory in Open5GS */ + ogs_assert(amf_self()->time.t3512.value); + rv = ogs_nas_gprs_timer_3_from_sec( + &t3512_value->t, amf_self()->time.t3512.value); + ogs_assert(rv == OGS_OK); + registration_accept->presencemask |= + OGS_NAS_5GS_REGISTRATION_ACCEPT_T3512_VALUE_PRESENT; + t3512_value->length = 1; /* Set T3502 */ if (amf_self()->time.t3502.value) { diff --git a/src/mme/emm-build.c b/src/mme/emm-build.c index 17af992bd..4b2fb0880 100644 --- a/src/mme/emm-build.c +++ b/src/mme/emm-build.c @@ -138,15 +138,11 @@ ogs_pkbuf_t *emm_build_attach_accept( } } - /* Set T3412 */ - t3412_value->unit = OGS_NAS_GPRS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; - t3412_value->value = 9; - - if (mme_self()->time.t3412.value) { - rv = ogs_nas_gprs_timer_from_sec( - t3412_value, mme_self()->time.t3412.value); - ogs_assert(rv == OGS_OK); - } + /* Set T3412 : Mandatory in Open5GS */ + ogs_assert(mme_self()->time.t3412.value); + rv = ogs_nas_gprs_timer_from_sec( + t3412_value, mme_self()->time.t3412.value); + ogs_assert(rv == OGS_OK); ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]", ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id), diff --git a/src/mme/emm-sm.c b/src/mme/emm-sm.c index b738e7069..645f1089a 100644 --- a/src/mme/emm-sm.c +++ b/src/mme/emm-sm.c @@ -191,10 +191,58 @@ void emm_state_registered(ogs_fsm_t *s, mme_event_t *e) case MME_TIMER_MOBILE_REACHABLE: ogs_info("[%s] Mobile Reachable timer expired", mme_ue->imsi_bcd); CLEAR_MME_UE_TIMER(mme_ue->t_mobile_reachable); - /* TS 24.301 5.3.5 - * Upon expiry of the mobile reachable timer the network shall - * start the implicit detach timer. - */ + /* + * TS 24.301 + * Section 5.3.5 + * Handling of the periodic tracking area update timer and + * mobile reachable timer (S1 mode only) + * + * The periodic tracking area updating procedure is used to + * periodically notify the availability of the UE to the network. + * The procedure is controlled in the UE by timer T3412. + * The value of timer T3412 is sent by the network to the UE + * in the ATTACH ACCEPT message and can be sent in the TRACKING AREA + * UPDATE ACCEPT message. The UE shall apply this value in all tracking + * areas of the list of tracking areas assigned to the UE + * until a new value is received. + * + * If timer T3412 received by the UE in an ATTACH ACCEPT or TRACKING + * AREA UPDATE ACCEPT message contains an indication that the timer is + * deactivated or the timer value is zero, then timer T3412 is + * deactivated and the UE shall not perform the periodic tracking area + * updating procedure. + * + * Timer T3412 is reset and started with its initial value, + * when the UE changes from EMM-CONNECTED to EMM-IDLE mode. + * + * Timer T3412 is stopped when the UE enters EMM-CONNECTED mode or + * the EMM-DEREGISTERED state. If the UE is attached for emergency + * bearer services, and timer T3412 expires, the UE shall not initiate + * a periodic tracking area updating procedure, but shall locally detach + * from the network. When the UE is camping on a suitable cell, it may + * re-attach to regain normal service. + * + * When a UE is not attached for emergency bearer services, and timer + * T3412 expires, the periodic tracking area updating procedure shall + * be started and the timer shall be set to its initial value + * for the next start. + * + * If the UE is not attached for emergency bearer services, the mobile + * reachable timer shall be longer than T3412. In this case, by default, + * the mobile reachable timer is 4 minutes greater than timer T3412. + * + * Upon expiry of the mobile reachable timer the network shall start + * the implicit detach timer. The value of the implicit detach timer is + * network dependent. If ISR is activated, the default value of + * the implicit detach timer is 4 minutes greater than timer T3423. + * If the implicit detach timer expires before the UE contacts + * the network, the network shall implicitly detach the UE. If the MME + * includes timer T3346 in the TRACKING AREA UPDATE REJECT message or + * the SERVICE REJECT message and timer T3346 is greater than timer + * T3412, the MME sets the mobile reachable timer and the implicit + * detach timer such that the sum of the timer values is greater than + * timer T3346. + */ ogs_debug("[%s] Starting Implicit Detach timer", mme_ue->imsi_bcd); ogs_timer_start(mme_ue->t_implicit_detach.timer, diff --git a/src/mme/mme-context.c b/src/mme/mme-context.c index 54b767141..cd5ad1784 100644 --- a/src/mme/mme-context.c +++ b/src/mme/mme-context.c @@ -193,6 +193,9 @@ static int mme_context_prepare(void) self.diam_config->cnf_port = DIAMETER_PORT; self.diam_config->cnf_port_tls = DIAMETER_SECURE_PORT; + /* Set the default T3412 to 9 minutes for backward compatibility. */ + self.time.t3412.value = 540; + return OGS_OK; } @@ -267,7 +270,7 @@ static int mme_context_validation(void) return OGS_ERROR; } if (self.num_of_ciphering_order == 0) { - ogs_error("no mme.security.ciphering_order in '%s'", + ogs_error("No mme.security.ciphering_order in '%s'", ogs_app()->file); return OGS_ERROR; } @@ -276,6 +279,11 @@ static int mme_context_validation(void) ogs_error("Not support GPRS Timer [%d]", (int)self.time.t3402.value); return OGS_ERROR; } + if (!self.time.t3412.value) { + ogs_error("No mme.time.t3412.value in '%s'", + ogs_app()->file); + return OGS_ERROR; + } if (ogs_nas_gprs_timer_from_sec(&gprs_timer, self.time.t3412.value) != OGS_OK) { ogs_error("Not support GPRS Timer [%d]", (int)self.time.t3412.value); diff --git a/src/mme/s1ap-handler.c b/src/mme/s1ap-handler.c index ccc85af9c..982825f88 100644 --- a/src/mme/s1ap-handler.c +++ b/src/mme/s1ap-handler.c @@ -1712,6 +1712,58 @@ void s1ap_handle_ue_context_release_action(enb_ue_t *enb_ue) if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { ogs_debug("Mobile Reachable timer started for IMSI[%s]", mme_ue->imsi_bcd); + /* + * TS 24.301 + * Section 5.3.5 + * Handling of the periodic tracking area update timer and + * mobile reachable timer (S1 mode only) + * + * The periodic tracking area updating procedure is used to + * periodically notify the availability of the UE to the network. + * The procedure is controlled in the UE by timer T3412. + * The value of timer T3412 is sent by the network to the UE + * in the ATTACH ACCEPT message and can be sent in the TRACKING AREA + * UPDATE ACCEPT message. The UE shall apply this value in all tracking + * areas of the list of tracking areas assigned to the UE + * until a new value is received. + * + * If timer T3412 received by the UE in an ATTACH ACCEPT or TRACKING + * AREA UPDATE ACCEPT message contains an indication that the timer is + * deactivated or the timer value is zero, then timer T3412 is + * deactivated and the UE shall not perform the periodic tracking area + * updating procedure. + * + * Timer T3412 is reset and started with its initial value, + * when the UE changes from EMM-CONNECTED to EMM-IDLE mode. + * + * Timer T3412 is stopped when the UE enters EMM-CONNECTED mode or + * the EMM-DEREGISTERED state. If the UE is attached for emergency + * bearer services, and timer T3412 expires, the UE shall not initiate + * a periodic tracking area updating procedure, but shall locally detach + * from the network. When the UE is camping on a suitable cell, it may + * re-attach to regain normal service. + * + * When a UE is not attached for emergency bearer services, and timer + * T3412 expires, the periodic tracking area updating procedure shall + * be started and the timer shall be set to its initial value + * for the next start. + * + * If the UE is not attached for emergency bearer services, the mobile + * reachable timer shall be longer than T3412. In this case, by default, + * the mobile reachable timer is 4 minutes greater than timer T3412. + * + * Upon expiry of the mobile reachable timer the network shall start + * the implicit detach timer. The value of the implicit detach timer is + * network dependent. If ISR is activated, the default value of + * the implicit detach timer is 4 minutes greater than timer T3423. + * If the implicit detach timer expires before the UE contacts + * the network, the network shall implicitly detach the UE. If the MME + * includes timer T3346 in the TRACKING AREA UPDATE REJECT message or + * the SERVICE REJECT message and timer T3346 is greater than timer + * T3412, the MME sets the mobile reachable timer and the implicit + * detach timer such that the sum of the timer values is greater than + * timer T3346. + */ ogs_timer_start(mme_ue->t_mobile_reachable.timer, ogs_time_from_sec(mme_self()->time.t3412.value + 240)); }