diff --git a/configs/open5gs/mme.yaml.in b/configs/open5gs/mme.yaml.in index 0dd137f7f..871c7006c 100644 --- a/configs/open5gs/mme.yaml.in +++ b/configs/open5gs/mme.yaml.in @@ -432,15 +432,9 @@ usrsctp: # # o Timers of EPS mobility/session management # t3402: -# value: 720 # 12 minutes * 60 = 720 seconds +# value: 720 # 12 minutes * 60 = 720 seconds # t3412: -# value: 3240 # 54 minutes * 60 = 3240 seconds +# value: 3240 # 54 minutes * 60 = 3240 seconds # t3423: -# value: 720 # 12 minutes * 60 = 720 seconds -# mobile_reachable: -# value: 3480 # 54 minutes * 60 + 240 = 3480 seconds -# implicit_detach: -# value: 240 # 4 minutes * 60 = 240 seconds -# purge_ue: -# value: 86400 # 24 hours * 60 minutes * 60 = 86400 seconds +# value: 720 # 12 minutes * 60 = 720 seconds time: diff --git a/lib/app/ogs-context.c b/lib/app/ogs-context.c index 87e4abe2f..f315df558 100644 --- a/lib/app/ogs-context.c +++ b/lib/app/ogs-context.c @@ -525,12 +525,6 @@ int ogs_app_context_parse_config(void) /* handle config in mme */ } else if (!strcmp(time_key, "t3423")) { /* handle config in mme */ - } else if (!strcmp(time_key, "mobile_reachable")) { - /* handle config in mme */ - } else if (!strcmp(time_key, "implicit_detach")) { - /* handle config in mme */ - } else if (!strcmp(time_key, "purge_ue")) { - /* handle config in mme */ } else ogs_warn("unknown key `%s`", time_key); } diff --git a/src/mme/emm-sm.c b/src/mme/emm-sm.c index a58efe6da..12b57c27c 100644 --- a/src/mme/emm-sm.c +++ b/src/mme/emm-sm.c @@ -70,13 +70,6 @@ void emm_state_de_registered(ogs_fsm_t *s, mme_event_t *e) case OGS_FSM_ENTRY_SIG: CLEAR_SERVICE_INDICATOR(mme_ue); CLEAR_MME_UE_ALL_TIMERS(mme_ue); - - if (mme_self()->time.purge_ue.value > 0) { - ogs_debug("DB Purge Timer started for IMSI[%s]", mme_ue->imsi_bcd); - ogs_timer_start(mme_ue->t_purge_ue.timer, - ogs_time_from_sec(mme_self()->time.purge_ue.value)); - } - break; case OGS_FSM_EXIT_SIG: break; @@ -105,17 +98,6 @@ void emm_state_de_registered(ogs_fsm_t *s, mme_event_t *e) } break; - case MME_TIMER_PURGE_UE: - ogs_info("[%s] Purge Timer expired, removing UE", mme_ue->imsi_bcd); - CLEAR_MME_UE_TIMER(mme_ue->t_purge_ue); - if (mme_ue->location_updated_but_not_canceled_yet == true) { - mme_s6a_send_pur(mme_ue); - } else { - mme_ue_hash_remove(mme_ue); - mme_ue_remove(mme_ue); - } - break; - default: ogs_error("Unknown timer[%s:%d]", mme_timer_get_name(e->timer_id), e->timer_id); @@ -141,7 +123,6 @@ void emm_state_registered(ogs_fsm_t *s, mme_event_t *e) switch (e->id) { case OGS_FSM_ENTRY_SIG: - CLEAR_MME_UE_TIMER(mme_ue->t_purge_ue); break; case OGS_FSM_EXIT_SIG: break; @@ -216,12 +197,10 @@ void emm_state_registered(ogs_fsm_t *s, mme_event_t *e) * Upon expiry of the mobile reachable timer the network shall * start the implicit detach timer. */ - if (mme_self()->time.implicit_detach.value > 0) { - ogs_debug("[%s] Starting Implicit Detach timer", - mme_ue->imsi_bcd); - ogs_timer_start(mme_ue->t_implicit_detach.timer, - ogs_time_from_sec(mme_self()->time.implicit_detach.value)); - } + ogs_debug("[%s] Starting Implicit Detach timer", + mme_ue->imsi_bcd); + ogs_timer_start(mme_ue->t_implicit_detach.timer, + ogs_time_from_sec(mme_self()->time.t3412.value + 240)); break; case MME_TIMER_IMPLICIT_DETACH: @@ -790,7 +769,6 @@ void emm_state_authentication(ogs_fsm_t *s, mme_event_t *e) switch (e->id) { case OGS_FSM_ENTRY_SIG: - CLEAR_MME_UE_TIMER(mme_ue->t_purge_ue); break; case OGS_FSM_EXIT_SIG: break; @@ -960,7 +938,6 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e) switch (e->id) { case OGS_FSM_ENTRY_SIG: CLEAR_MME_UE_TIMER(mme_ue->t3460); - CLEAR_MME_UE_TIMER(mme_ue->t_purge_ue); ogs_assert(OGS_OK == nas_eps_send_security_mode_command(mme_ue)); break; @@ -1138,7 +1115,6 @@ void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e) switch (e->id) { case OGS_FSM_ENTRY_SIG: - CLEAR_MME_UE_TIMER(mme_ue->t_purge_ue); break; case OGS_FSM_EXIT_SIG: break; @@ -1351,7 +1327,6 @@ void emm_state_exception(ogs_fsm_t *s, mme_event_t *e) case OGS_FSM_ENTRY_SIG: CLEAR_SERVICE_INDICATOR(mme_ue); CLEAR_MME_UE_ALL_TIMERS(mme_ue); - CLEAR_MME_UE_TIMER(mme_ue->t_purge_ue); break; case OGS_FSM_EXIT_SIG: break; diff --git a/src/mme/mme-context.c b/src/mme/mme-context.c index 292a11808..29ece1301 100644 --- a/src/mme/mme-context.c +++ b/src/mme/mme-context.c @@ -173,10 +173,6 @@ static int mme_context_prepare(void) self.diam_config->cnf_port = DIAMETER_PORT; self.diam_config->cnf_port_tls = DIAMETER_SECURE_PORT; - self.time.mobile_reachable.value = (54 * 60) + 240; - self.time.implicit_detach.value = 4 * 60; - self.time.purge_ue.value = 60 * 60 * 24; - return OGS_OK; } @@ -1619,54 +1615,6 @@ int mme_context_parse_config() } else ogs_warn("unknown key `%s`", t3423_key); } - } else if (!strcmp(time_key, "mobile_reachable")) { - ogs_yaml_iter_t mobile_reachable_iter; - ogs_yaml_iter_recurse(&time_iter, &mobile_reachable_iter); - - while (ogs_yaml_iter_next(&mobile_reachable_iter)) { - const char *mobile_reachable_key = - ogs_yaml_iter_key(&mobile_reachable_iter); - ogs_assert(mobile_reachable_key); - - if (!strcmp(mobile_reachable_key, "value")) { - const char *v = ogs_yaml_iter_value(&mobile_reachable_iter); - if (v) - self.time.mobile_reachable.value = atoll(v); - } else - ogs_warn("unknown key `%s`", mobile_reachable_key); - } - } else if (!strcmp(time_key, "implicit_detach")) { - ogs_yaml_iter_t implicit_detach_iter; - ogs_yaml_iter_recurse(&time_iter, &implicit_detach_iter); - - while (ogs_yaml_iter_next(&implicit_detach_iter)) { - const char *implicit_detach_key = - ogs_yaml_iter_key(&implicit_detach_iter); - ogs_assert(implicit_detach_key); - - if (!strcmp(implicit_detach_key, "value")) { - const char *v = ogs_yaml_iter_value(&implicit_detach_iter); - if (v) - self.time.implicit_detach.value = atoll(v); - } else - ogs_warn("unknown key `%s`", implicit_detach_key); - } - } else if (!strcmp(time_key, "purge_ue")) { - ogs_yaml_iter_t purge_ue_iter; - ogs_yaml_iter_recurse(&time_iter, &purge_ue_iter); - - while (ogs_yaml_iter_next(&purge_ue_iter)) { - const char *purge_ue_key = - ogs_yaml_iter_key(&purge_ue_iter); - ogs_assert(purge_ue_key); - - if (!strcmp(purge_ue_key, "value")) { - const char *v = ogs_yaml_iter_value(&purge_ue_iter); - if (v) - self.time.purge_ue.value = atoll(v); - } else - ogs_warn("unknown key `%s`", purge_ue_key); - } } else if (!strcmp(time_key, "t3512")) { /* handle config in amf */ } else if (!strcmp(time_key, "nf_instance")) { @@ -2470,14 +2418,6 @@ mme_ue_t *mme_ue_add(enb_ue_t *enb_ue) return NULL; } mme_ue->t_implicit_detach.pkbuf = NULL; - mme_ue->t_purge_ue.timer = ogs_timer_add( - ogs_app()->timer_mgr, mme_timer_purge_ue_expire, mme_ue); - if (!mme_ue->t_purge_ue.timer) { - ogs_error("ogs_timer_add() failed"); - ogs_pool_free(&mme_ue_pool, mme_ue); - return NULL; - } - mme_ue->t_purge_ue.pkbuf = NULL; mme_ebi_pool_init(mme_ue); @@ -2571,7 +2511,6 @@ void mme_ue_remove(mme_ue_t *mme_ue) ogs_timer_delete(mme_ue->t3470.timer); ogs_timer_delete(mme_ue->t_mobile_reachable.timer); ogs_timer_delete(mme_ue->t_implicit_detach.timer); - ogs_timer_delete(mme_ue->t_purge_ue.timer); enb_ue_unlink(mme_ue); diff --git a/src/mme/mme-context.h b/src/mme/mme-context.h index 78a23d735..182c5bbfe 100644 --- a/src/mme/mme-context.h +++ b/src/mme/mme-context.h @@ -149,7 +149,7 @@ typedef struct mme_context_s { struct { struct { ogs_time_t value; /* Timer Value(Seconds) */ - } t3402, t3412, t3423, mobile_reachable, implicit_detach, purge_ue; + } t3402, t3412, t3423; } time; } mme_context_t; @@ -540,7 +540,7 @@ struct mme_ue_s { ogs_timer_t *timer; uint32_t retry_count;; } t3413, t3422, t3450, t3460, t3470, t_mobile_reachable, - t_implicit_detach, t_purge_ue; + t_implicit_detach; #define CLEAR_SERVICE_INDICATOR(__mME) \ do { \ diff --git a/src/mme/mme-path.c b/src/mme/mme-path.c index 0950097fe..d2a2fbb95 100644 --- a/src/mme/mme-path.c +++ b/src/mme/mme-path.c @@ -22,6 +22,7 @@ #include "sgsap-path.h" #include "mme-gtp-path.h" #include "mme-path.h" +#include "mme-fd-path.h" #include "mme-sm.h" void mme_send_delete_session_or_detach(mme_ue_t *mme_ue) @@ -65,22 +66,23 @@ void mme_send_delete_session_or_detach(mme_ue_t *mme_ue) case MME_DETACH_TYPE_MME_IMPLICIT: ogs_debug("Implicit MME Detach"); if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) { - if (ECM_IDLE(mme_ue)) { - mme_gtp_send_delete_all_sessions(mme_ue, - OGS_GTP_DELETE_NO_ACTION); - } else { - mme_gtp_send_delete_all_sessions(mme_ue, - OGS_GTP_DELETE_SEND_RELEASE_WITH_S1_REMOVE_AND_UNLINK); - } + mme_gtp_send_delete_all_sessions(mme_ue, + OGS_GTP_DELETE_SEND_RELEASE_WITH_UE_CONTEXT_REMOVE); } else { enb_ue_t *enb_ue = enb_ue_cycle(mme_ue->enb_ue); if (enb_ue) { ogs_assert(OGS_OK == s1ap_send_ue_context_release_command(enb_ue, S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release, - S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK, 0)); - } else - ogs_error("ENB-S1 Context has already been removed"); + S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0)); + } else { + if (mme_ue->location_updated_but_not_canceled_yet == true) { + mme_s6a_send_pur(mme_ue); + } else { + mme_ue_hash_remove(mme_ue); + mme_ue_remove(mme_ue); + } + } } break; @@ -276,26 +278,3 @@ cleanup: CLEAR_SERVICE_INDICATOR(mme_ue); MME_CLEAR_PAGING_INFO(mme_ue); } - -int mme_s1ap_page_if_attached(mme_ue_t *mme_ue, S1AP_CNDomain_t cn_domain) -{ - if (ogs_timer_running(mme_ue->t_implicit_detach.timer)) { - /* - * TS 24.301 5.3.7 - * If ISR is not activated, 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, and may take other appropriate actions - */ - ogs_debug("[%s] Paging ignored due to Mobile Reachable timer expiry", - mme_ue->imsi_bcd); - - MME_CLEAR_PAGING_INFO(mme_ue); - - return OGS_ERROR; - } else { - ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, cn_domain)); - } - - return OGS_OK; -} diff --git a/src/mme/mme-path.h b/src/mme/mme-path.h index 8f4694cda..afc6f13e8 100644 --- a/src/mme/mme-path.h +++ b/src/mme/mme-path.h @@ -32,8 +32,6 @@ void mme_send_release_access_bearer_or_ue_context_release(enb_ue_t *enb_ue); void mme_send_after_paging(mme_ue_t *mme_ue, bool failed); -int mme_s1ap_page_if_attached(mme_ue_t *mme_ue, S1AP_CNDomain_t cn_domain); - #ifdef __cplusplus } #endif diff --git a/src/mme/mme-s11-handler.c b/src/mme/mme-s11-handler.c index 2f7bc8bb5..024d065a4 100644 --- a/src/mme/mme-s11-handler.c +++ b/src/mme/mme-s11-handler.c @@ -701,7 +701,6 @@ void mme_s11_handle_create_bearer_request( ogs_gtp_xact_t *xact, mme_ue_t *mme_ue, ogs_gtp2_create_bearer_request_t *req) { - int rv; uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE; mme_bearer_t *bearer = NULL, *default_bearer = NULL; mme_sess_t *sess = NULL; @@ -862,13 +861,25 @@ void mme_s11_handle_create_bearer_request( if (OGS_FSM_CHECK(&default_bearer->sm, esm_state_active)) { if (ECM_IDLE(mme_ue)) { - MME_STORE_PAGING_INFO(mme_ue, - MME_PAGING_TYPE_CREATE_BEARER, bearer); - rv = mme_s1ap_page_if_attached(mme_ue, S1AP_CNDomain_ps); - if (rv != OGS_OK) { + if (ogs_timer_running(mme_ue->t_implicit_detach.timer)) { + /* + * TS 24.301 5.3.7 + * If ISR is not activated, 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, and may take other appropriate actions + */ + ogs_debug("[%s] Paging stopped: Mobile Reachable timer expiry", + mme_ue->imsi_bcd); + ogs_assert(OGS_OK == mme_gtp_send_create_bearer_response( bearer, OGS_GTP2_CAUSE_UNABLE_TO_PAGE_UE)); + } else { + MME_STORE_PAGING_INFO(mme_ue, + MME_PAGING_TYPE_CREATE_BEARER, bearer); + ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, + S1AP_CNDomain_ps)); } } else { ogs_assert(OGS_OK == @@ -886,7 +897,6 @@ void mme_s11_handle_update_bearer_request( ogs_gtp_xact_t *xact, mme_ue_t *mme_ue, ogs_gtp2_update_bearer_request_t *req) { - int rv; uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE; mme_bearer_t *bearer = NULL; mme_sess_t *sess = NULL; @@ -993,13 +1003,25 @@ void mme_s11_handle_update_bearer_request( if (req->bearer_contexts.bearer_level_qos.presence == 1 || req->bearer_contexts.tft.presence == 1) { if (ECM_IDLE(mme_ue)) { - MME_STORE_PAGING_INFO(mme_ue, - MME_PAGING_TYPE_UPDATE_BEARER, bearer); - rv = mme_s1ap_page_if_attached(mme_ue, S1AP_CNDomain_ps); - if (rv != OGS_OK) { + if (ogs_timer_running(mme_ue->t_implicit_detach.timer)) { + /* + * TS 24.301 5.3.7 + * If ISR is not activated, 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, and may take other appropriate actions + */ + ogs_debug("[%s] Paging stopped: Mobile Reachable timer expiry", + mme_ue->imsi_bcd); + ogs_assert(OGS_OK == mme_gtp_send_update_bearer_response( bearer, OGS_GTP2_CAUSE_UNABLE_TO_PAGE_UE)); + } else { + MME_STORE_PAGING_INFO(mme_ue, + MME_PAGING_TYPE_UPDATE_BEARER, bearer); + ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, + S1AP_CNDomain_ps)); } } else { ogs_assert(OGS_OK == @@ -1029,7 +1051,6 @@ void mme_s11_handle_delete_bearer_request( ogs_gtp_xact_t *xact, mme_ue_t *mme_ue, ogs_gtp2_delete_bearer_request_t *req) { - int rv; uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE; mme_bearer_t *bearer = NULL; @@ -1133,12 +1154,25 @@ void mme_s11_handle_delete_bearer_request( bearer->delete.xact = xact; if (ECM_IDLE(mme_ue)) { - MME_STORE_PAGING_INFO(mme_ue, MME_PAGING_TYPE_DELETE_BEARER, bearer); - rv = mme_s1ap_page_if_attached(mme_ue, S1AP_CNDomain_ps); - if (rv != OGS_OK) { + if (ogs_timer_running(mme_ue->t_implicit_detach.timer)) { + /* + * TS 24.301 5.3.7 + * If ISR is not activated, 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, and may take other appropriate actions + */ + ogs_debug("[%s] Paging stopped: Mobile Reachable timer expiry", + mme_ue->imsi_bcd); + ogs_assert(OGS_OK == mme_gtp_send_delete_bearer_response( bearer, OGS_GTP2_CAUSE_UNABLE_TO_PAGE_UE)); + } else { + MME_STORE_PAGING_INFO(mme_ue, + MME_PAGING_TYPE_DELETE_BEARER, bearer); + ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, + S1AP_CNDomain_ps)); } } else { ogs_assert(OGS_OK == @@ -1301,7 +1335,6 @@ void mme_s11_handle_downlink_data_notification( ogs_gtp_xact_t *xact, mme_ue_t *mme_ue, ogs_gtp2_downlink_data_notification_t *noti) { - int rv; uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE; mme_bearer_t *bearer = NULL; @@ -1387,15 +1420,26 @@ void mme_s11_handle_downlink_data_notification( * before step 9, the MME shall not send S1 interface paging messages */ if (ECM_IDLE(mme_ue)) { - MME_STORE_PAGING_INFO(mme_ue, - MME_PAGING_TYPE_DOWNLINK_DATA_NOTIFICATION, bearer); - rv = mme_s1ap_page_if_attached(mme_ue, S1AP_CNDomain_ps); - if (rv != OGS_OK) { + if (ogs_timer_running(mme_ue->t_implicit_detach.timer)) { + /* + * TS 24.301 5.3.7 + * If ISR is not activated, 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, and may take other appropriate actions + */ + ogs_debug("[%s] Paging stopped: Mobile Reachable timer expiry", + mme_ue->imsi_bcd); + ogs_assert(OGS_OK == mme_gtp_send_downlink_data_notification_ack( bearer, OGS_GTP2_CAUSE_UNABLE_TO_PAGE_UE)); + } else { + MME_STORE_PAGING_INFO(mme_ue, + MME_PAGING_TYPE_DOWNLINK_DATA_NOTIFICATION, bearer); + ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, + S1AP_CNDomain_ps)); } - } else if (ECM_CONNECTED(mme_ue)) { if (cause_value == OGS_GTP2_CAUSE_ERROR_INDICATION_RECEIVED) { diff --git a/src/mme/mme-s6a-handler.c b/src/mme/mme-s6a-handler.c index 64c254ef6..23c9a43e0 100644 --- a/src/mme/mme-s6a-handler.c +++ b/src/mme/mme-s6a-handler.c @@ -259,8 +259,27 @@ void mme_s6a_handle_clr(mme_ue_t *mme_ue, ogs_diam_s6a_message_t *s6a_message) * we need to check whether UE is IDLE or not. */ if (ECM_IDLE(mme_ue)) { - MME_STORE_PAGING_INFO(mme_ue, MME_PAGING_TYPE_DETACH_TO_UE, NULL); - mme_s1ap_page_if_attached(mme_ue, S1AP_CNDomain_ps); + if (ogs_timer_running(mme_ue->t_implicit_detach.timer)) { + /* + * TS 24.301 5.3.7 + * If ISR is not activated, 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, and may take other appropriate actions + */ + ogs_debug("[%s] Paging stopped: Mobile Reachable timer expiry", + mme_ue->imsi_bcd); + if (MME_P_TMSI_IS_AVAILABLE(mme_ue)) { + ogs_assert(OGS_OK == sgsap_send_detach_indication(mme_ue)); + } else { + mme_send_delete_session_or_detach(mme_ue); + } + } else { + MME_STORE_PAGING_INFO(mme_ue, + MME_PAGING_TYPE_DETACH_TO_UE, NULL); + ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, + S1AP_CNDomain_ps)); + } } else { ogs_assert(OGS_OK == nas_eps_send_detach_request(mme_ue)); if (MME_P_TMSI_IS_AVAILABLE(mme_ue)) { diff --git a/src/mme/mme-timer.c b/src/mme/mme-timer.c index 0a980d2fd..f2b6204f7 100644 --- a/src/mme/mme-timer.c +++ b/src/mme/mme-timer.c @@ -96,8 +96,6 @@ const char *mme_timer_get_name(mme_timer_e id) return "MME_TIMER_MOBILE_REACHABLE"; case MME_TIMER_IMPLICIT_DETACH: return "MME_TIMER_IMPLICIT_DETACH"; - case MME_TIMER_PURGE_UE: - return "MME_TIMER_PURGE_UE"; case MME_TIMER_SGS_CLI_CONN_TO_SRV: return "MME_TIMER_SGS_CLI_CONN_TO_SRV"; case MME_TIMER_S1_HOLDING: @@ -174,10 +172,6 @@ void mme_timer_implicit_detach_expire(void *data) { emm_timer_event_send(MME_TIMER_IMPLICIT_DETACH, data); } -void mme_timer_purge_ue_expire(void *data) -{ - emm_timer_event_send(MME_TIMER_PURGE_UE, data); -} static void esm_timer_event_send( mme_timer_e timer_id, mme_bearer_t *bearer) diff --git a/src/mme/mme-timer.h b/src/mme/mme-timer.h index 739117d3e..f7cdf415c 100644 --- a/src/mme/mme-timer.h +++ b/src/mme/mme-timer.h @@ -42,7 +42,6 @@ typedef enum { MME_TIMER_MOBILE_REACHABLE, MME_TIMER_IMPLICIT_DETACH, - MME_TIMER_PURGE_UE, MME_TIMER_S11_HOLDING, @@ -73,7 +72,6 @@ void mme_timer_t3489_expire(void *data); void mme_timer_mobile_reachable_expire(void *data); void mme_timer_implicit_detach_expire(void *data); -void mme_timer_purge_ue_expire(void *data); void mme_timer_sgs_cli_conn_to_srv(void *data); void mme_timer_s1_holding_timer_expire(void *data); diff --git a/src/mme/s1ap-handler.c b/src/mme/s1ap-handler.c index 6d291b3a9..317fa3c91 100644 --- a/src/mme/s1ap-handler.c +++ b/src/mme/s1ap-handler.c @@ -1471,13 +1471,11 @@ void s1ap_handle_ue_context_release_action(enb_ue_t *enb_ue) */ CLEAR_MME_UE_ALL_TIMERS(mme_ue); - if (mme_self()->time.mobile_reachable.value > 0) { - if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { - ogs_debug("Mobile Reachable timer started for IMSI[%s]", - mme_ue->imsi_bcd); - ogs_timer_start(mme_ue->t_mobile_reachable.timer, - ogs_time_from_sec(mme_self()->time.mobile_reachable.value)); - } + if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) { + ogs_debug("Mobile Reachable timer started for IMSI[%s]", + mme_ue->imsi_bcd); + ogs_timer_start(mme_ue->t_mobile_reachable.timer, + ogs_time_from_sec(mme_self()->time.t3412.value + 240)); } } @@ -1563,7 +1561,7 @@ void s1ap_handle_ue_context_release_action(enb_ue_t *enb_ue) ogs_expect_or_return(mme_ue); enb_ue_unlink(mme_ue); - mme_s1ap_page_if_attached(mme_ue, S1AP_CNDomain_ps); + s1ap_send_paging(mme_ue, S1AP_CNDomain_ps); break; default: ogs_error("Invalid Action[%d]", enb_ue->ue_ctx_rel_action); diff --git a/src/mme/sgsap-handler.c b/src/mme/sgsap-handler.c index c7bbbb4f4..c95c2751c 100644 --- a/src/mme/sgsap-handler.c +++ b/src/mme/sgsap-handler.c @@ -277,7 +277,6 @@ void sgsap_handle_detach_ack(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf) void sgsap_handle_paging_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf) { - int rv; ogs_tlv_t *root = NULL, *iter = NULL; mme_ue_t *mme_ue = NULL; @@ -352,25 +351,50 @@ void sgsap_handle_paging_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf) if (ECM_IDLE(mme_ue)) { if (CS_CALL_SERVICE_INDICATOR(mme_ue)) { - /* UE will respond Extended Service Request in PS CNDomain*/ - MME_STORE_PAGING_INFO(mme_ue, - MME_PAGING_TYPE_CS_CALL_SERVICE, NULL); - rv = mme_s1ap_page_if_attached(mme_ue, S1AP_CNDomain_cs); - if (rv != OGS_OK) { - ogs_assert(OGS_OK == - sgsap_send_paging_reject( - mme_ue, SGSAP_SGS_CAUSE_UE_UNREACHABLE)); - } + if (ogs_timer_running(mme_ue->t_implicit_detach.timer)) { + /* + * TS 24.301 5.3.7 + * If ISR is not activated, 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, and may take other appropriate + * actions + */ + ogs_debug("[%s] Paging stopped: Mobile Reachable timeout", + mme_ue->imsi_bcd); - } else if (SMS_SERVICE_INDICATOR(mme_ue)) { - /* UE will respond Service Request in PS CNDomain*/ - MME_STORE_PAGING_INFO(mme_ue, - MME_PAGING_TYPE_SMS_SERVICE, NULL); - rv = mme_s1ap_page_if_attached(mme_ue, S1AP_CNDomain_ps); - if (rv != OGS_OK) { ogs_assert(OGS_OK == sgsap_send_paging_reject( mme_ue, SGSAP_SGS_CAUSE_UE_UNREACHABLE)); + } else { + /* UE will respond Extended Service Request in PS CNDomain*/ + MME_STORE_PAGING_INFO(mme_ue, + MME_PAGING_TYPE_CS_CALL_SERVICE, NULL); + ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, + S1AP_CNDomain_cs)); + } + } else if (SMS_SERVICE_INDICATOR(mme_ue)) { + if (ogs_timer_running(mme_ue->t_implicit_detach.timer)) { + /* + * TS 24.301 5.3.7 + * If ISR is not activated, 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, and may take other appropriate + * actions + */ + ogs_debug("[%s] Paging stopped: Mobile Reachable timer expiry", + mme_ue->imsi_bcd); + + ogs_assert(OGS_OK == + sgsap_send_paging_reject( + mme_ue, SGSAP_SGS_CAUSE_UE_UNREACHABLE)); + } else { + /* UE will respond Service Request in PS CNDomain*/ + MME_STORE_PAGING_INFO(mme_ue, + MME_PAGING_TYPE_SMS_SERVICE, NULL); + ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, + S1AP_CNDomain_ps)); } } else goto paging_reject;