2019-06-23 11:43:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
|
|
|
*
|
|
|
|
* This file is part of Open5GS.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2017-03-26 06:34:34 +00:00
|
|
|
|
2019-06-11 13:10:47 +00:00
|
|
|
#include "mme-event.h"
|
2019-07-20 14:06:54 +00:00
|
|
|
#include "mme-timer.h"
|
2019-06-11 13:10:47 +00:00
|
|
|
#include "mme-sm.h"
|
|
|
|
#include "mme-fd-path.h"
|
|
|
|
#include "emm-handler.h"
|
|
|
|
#include "esm-build.h"
|
|
|
|
#include "esm-handler.h"
|
|
|
|
#include "mme-s11-handler.h"
|
2020-11-08 02:25:53 +00:00
|
|
|
#include "s1ap-path.h"
|
2019-06-11 13:10:47 +00:00
|
|
|
#include "nas-path.h"
|
|
|
|
#include "mme-gtp-path.h"
|
2017-03-06 00:00:37 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
#undef OGS_LOG_DOMAIN
|
|
|
|
#define OGS_LOG_DOMAIN __esm_log_domain
|
|
|
|
|
2021-01-08 20:09:02 +00:00
|
|
|
static uint8_t gtp_cause_from_esm(uint8_t esm_cause)
|
|
|
|
{
|
|
|
|
switch (esm_cause) {
|
|
|
|
case ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION:
|
|
|
|
return OGS_GTP_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION;
|
|
|
|
case ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION:
|
|
|
|
return OGS_GTP_CAUSE_SYNTACTIC_ERROR_IN_THE_TFT_OPERATION;
|
|
|
|
case ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTERS:
|
|
|
|
return OGS_GTP_CAUSE_SYNTACTIC_ERRORS_IN_PACKET_FILTER;
|
|
|
|
case ESM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTERS:
|
|
|
|
return OGS_GTP_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTER;
|
|
|
|
default:
|
|
|
|
return OGS_GTP_CAUSE_SYSTEM_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OGS_GTP_CAUSE_SYSTEM_FAILURE;
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
void esm_state_initial(ogs_fsm_t *s, mme_event_t *e)
|
2017-03-05 07:49:57 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(s);
|
2017-03-05 07:49:57 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
mme_sm_debug(e);
|
2017-03-05 07:49:57 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
OGS_FSM_TRAN(s, &esm_state_inactive);
|
2017-03-05 07:49:57 +00:00
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
void esm_state_final(ogs_fsm_t *s, mme_event_t *e)
|
2017-03-05 07:49:57 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(s);
|
2017-03-05 07:49:57 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
mme_sm_debug(e);
|
2017-03-05 07:49:57 +00:00
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e)
|
2017-03-05 07:49:57 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
2017-09-03 15:06:39 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
2017-09-04 13:00:51 +00:00
|
|
|
mme_sess_t *sess = NULL;
|
|
|
|
mme_bearer_t *bearer = NULL;
|
2020-05-23 02:24:48 +00:00
|
|
|
ogs_nas_eps_message_t *message = NULL;
|
2020-11-08 02:25:53 +00:00
|
|
|
ogs_nas_security_header_type_t h;
|
2017-09-03 15:06:39 +00:00
|
|
|
|
2021-01-08 20:09:02 +00:00
|
|
|
ogs_nas_eps_activate_dedicated_eps_bearer_context_reject_t
|
|
|
|
*activate_dedicated_eps_bearer_context_reject = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(s);
|
|
|
|
ogs_assert(e);
|
2017-03-05 07:49:57 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
mme_sm_debug(e);
|
2017-03-05 07:49:57 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
bearer = e->bearer;
|
|
|
|
ogs_assert(bearer);
|
2017-09-04 13:00:51 +00:00
|
|
|
sess = bearer->sess;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(sess);
|
2017-09-03 15:06:39 +00:00
|
|
|
mme_ue = sess->mme_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(mme_ue);
|
2017-09-03 15:06:39 +00:00
|
|
|
|
2019-06-23 11:43:23 +00:00
|
|
|
switch (e->id) {
|
|
|
|
case OGS_FSM_ENTRY_SIG:
|
2019-07-20 14:06:54 +00:00
|
|
|
CLEAR_BEARER_ALL_TIMERS(bearer);
|
2019-06-23 11:43:23 +00:00
|
|
|
break;
|
|
|
|
case OGS_FSM_EXIT_SIG:
|
|
|
|
break;
|
|
|
|
case MME_EVT_ESM_MESSAGE:
|
|
|
|
message = e->nas_message;
|
|
|
|
ogs_assert(message);
|
|
|
|
|
|
|
|
switch (message->esm.h.message_type) {
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST:
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_debug("PDN Connectivity request");
|
2019-06-23 11:43:23 +00:00
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2019-06-23 11:43:23 +00:00
|
|
|
rv = esm_handle_pdn_connectivity_request(
|
|
|
|
bearer, &message->esm.pdn_connectivity_request);
|
|
|
|
if (rv != OGS_OK) {
|
|
|
|
OGS_FSM_TRAN(s, esm_state_exception);
|
|
|
|
break;
|
|
|
|
}
|
2017-03-05 07:49:57 +00:00
|
|
|
break;
|
2020-10-23 17:48:39 +00:00
|
|
|
case OGS_NAS_EPS_PDN_DISCONNECT_REQUEST:
|
2020-11-08 02:25:53 +00:00
|
|
|
ogs_debug("PDN disconnect request");
|
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-10-23 17:48:39 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
|
|
|
if (MME_HAVE_SGW_S1U_PATH(sess)) {
|
|
|
|
mme_gtp_send_delete_session_request(sess,
|
|
|
|
OGS_GTP_DELETE_SEND_DEACTIVATE_BEARER_CONTEXT_REQUEST);
|
|
|
|
} else {
|
|
|
|
nas_eps_send_deactivate_bearer_context_request(bearer);
|
|
|
|
}
|
|
|
|
OGS_FSM_TRAN(s, esm_state_pdn_will_disconnect);
|
|
|
|
break;
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_ESM_INFORMATION_RESPONSE:
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_debug("ESM information response");
|
2019-06-23 11:43:23 +00:00
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2019-07-20 14:06:54 +00:00
|
|
|
|
|
|
|
CLEAR_BEARER_TIMER(bearer->t3489);
|
2020-11-08 02:25:53 +00:00
|
|
|
|
|
|
|
h.type = e->nas_type;
|
|
|
|
if (h.integrity_protected == 0) {
|
|
|
|
ogs_error("[%s] No Integrity Protected", mme_ue->imsi_bcd);
|
|
|
|
nas_eps_send_attach_reject(mme_ue,
|
|
|
|
EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED,
|
|
|
|
ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
|
|
|
ogs_assert(mme_ue->enb_ue);
|
|
|
|
s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
|
|
|
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
|
|
|
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
|
|
|
OGS_FSM_TRAN(s, &esm_state_exception);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
|
|
|
ogs_warn("[%s] No Security Context", mme_ue->imsi_bcd);
|
|
|
|
nas_eps_send_attach_reject(mme_ue,
|
|
|
|
EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED,
|
|
|
|
ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
|
|
|
ogs_assert(mme_ue->enb_ue);
|
|
|
|
s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
|
|
|
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
|
|
|
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
|
|
|
OGS_FSM_TRAN(s, &esm_state_exception);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-06-23 11:43:23 +00:00
|
|
|
rv = esm_handle_information_response(
|
|
|
|
sess, &message->esm.esm_information_response);
|
|
|
|
if (rv != OGS_OK) {
|
|
|
|
OGS_FSM_TRAN(s, esm_state_exception);
|
|
|
|
break;
|
|
|
|
}
|
2017-03-05 07:49:57 +00:00
|
|
|
break;
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT:
|
2021-01-08 20:09:02 +00:00
|
|
|
ogs_debug("Activate default EPS bearer context accept");
|
2019-06-23 11:43:23 +00:00
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2019-06-23 11:43:23 +00:00
|
|
|
/* Check if Initial Context Setup Response or
|
|
|
|
* E-RAB Setup Response is received */
|
|
|
|
if (MME_HAVE_ENB_S1U_PATH(bearer)) {
|
2019-11-30 07:45:09 +00:00
|
|
|
mme_gtp_send_modify_bearer_request(bearer, 0);
|
2017-03-05 09:09:34 +00:00
|
|
|
}
|
2019-06-23 11:43:23 +00:00
|
|
|
|
2020-05-23 02:24:48 +00:00
|
|
|
nas_eps_send_activate_all_dedicated_bearers(bearer);
|
2019-06-23 11:43:23 +00:00
|
|
|
OGS_FSM_TRAN(s, esm_state_active);
|
2017-03-05 07:49:57 +00:00
|
|
|
break;
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT:
|
2021-01-08 20:09:02 +00:00
|
|
|
ogs_debug("Activate dedicated EPS bearer context accept");
|
2019-06-23 11:43:23 +00:00
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2019-06-23 11:43:23 +00:00
|
|
|
/* Check if Initial Context Setup Response or
|
|
|
|
* E-RAB Setup Response is received */
|
|
|
|
if (MME_HAVE_ENB_S1U_PATH(bearer)) {
|
2020-11-07 22:27:12 +00:00
|
|
|
mme_gtp_send_create_bearer_response(
|
|
|
|
bearer, OGS_GTP_CAUSE_REQUEST_ACCEPTED);
|
2019-06-23 11:43:23 +00:00
|
|
|
}
|
2017-03-05 07:49:57 +00:00
|
|
|
|
2019-06-23 11:43:23 +00:00
|
|
|
OGS_FSM_TRAN(s, esm_state_active);
|
|
|
|
break;
|
2021-01-08 20:09:02 +00:00
|
|
|
case OGS_NAS_EPS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT:
|
|
|
|
ogs_error("Activate dedicated EPS bearer context reject");
|
|
|
|
ogs_error(" IMSI[%s] PTI[%d] EBI[%d]",
|
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
|
|
|
activate_dedicated_eps_bearer_context_reject =
|
|
|
|
&message->esm.activate_dedicated_eps_bearer_context_reject;
|
|
|
|
ogs_assert(activate_dedicated_eps_bearer_context_reject);
|
|
|
|
mme_gtp_send_create_bearer_response(bearer,
|
|
|
|
gtp_cause_from_esm(
|
|
|
|
activate_dedicated_eps_bearer_context_reject->esm_cause));
|
|
|
|
OGS_FSM_TRAN(s, esm_state_bearer_deactivated);
|
|
|
|
break;
|
2017-03-05 07:49:57 +00:00
|
|
|
default:
|
2020-10-23 17:48:39 +00:00
|
|
|
ogs_error("Unknown message(type:%d)", message->esm.h.message_type);
|
2017-03-05 07:49:57 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-06-23 11:43:23 +00:00
|
|
|
break;
|
2019-07-20 14:06:54 +00:00
|
|
|
case MME_EVT_ESM_TIMER:
|
|
|
|
switch (e->timer_id) {
|
|
|
|
case MME_TIMER_T3489:
|
|
|
|
if (bearer->t3489.retry_count >=
|
|
|
|
mme_timer_cfg(MME_TIMER_T3489)->max_count) {
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_warn("Retransmission of IMSI[%s] failed. "
|
2019-07-20 14:06:54 +00:00
|
|
|
"Stop retransmission",
|
|
|
|
mme_ue->imsi_bcd);
|
|
|
|
OGS_FSM_TRAN(&bearer->sm, &esm_state_exception);
|
|
|
|
|
2020-05-23 02:24:48 +00:00
|
|
|
nas_eps_send_pdn_connectivity_reject(sess,
|
2019-07-20 14:06:54 +00:00
|
|
|
ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED);
|
|
|
|
} else {
|
|
|
|
bearer->t3489.retry_count++;
|
2020-05-23 02:24:48 +00:00
|
|
|
nas_eps_send_esm_information_request(bearer);
|
2019-07-20 14:06:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ogs_error("Unknown timer[%s:%d]",
|
|
|
|
mme_timer_get_name(e->timer_id), e->timer_id);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2019-06-23 11:43:23 +00:00
|
|
|
default:
|
|
|
|
ogs_error("Unknown event %s", mme_event_get_name(e));
|
|
|
|
break;
|
2017-03-05 07:49:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
void esm_state_active(ogs_fsm_t *s, mme_event_t *e)
|
2017-03-05 07:49:57 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
2017-09-05 03:37:27 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
|
|
|
mme_sess_t *sess = NULL;
|
|
|
|
mme_bearer_t *bearer = NULL;
|
2020-05-23 02:24:48 +00:00
|
|
|
ogs_nas_eps_message_t *message = NULL;
|
2017-09-05 03:37:27 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(s);
|
|
|
|
ogs_assert(e);
|
2017-03-05 07:49:57 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
mme_sm_debug(e);
|
2017-03-05 07:49:57 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
bearer = e->bearer;
|
|
|
|
ogs_assert(bearer);
|
2017-09-05 03:37:27 +00:00
|
|
|
sess = bearer->sess;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(sess);
|
2017-09-05 03:37:27 +00:00
|
|
|
mme_ue = sess->mme_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(mme_ue);
|
2017-09-05 03:37:27 +00:00
|
|
|
|
2019-06-23 11:43:23 +00:00
|
|
|
switch (e->id) {
|
|
|
|
case OGS_FSM_ENTRY_SIG:
|
|
|
|
break;
|
|
|
|
case OGS_FSM_EXIT_SIG:
|
|
|
|
break;
|
|
|
|
case MME_EVT_ESM_MESSAGE:
|
|
|
|
message = e->nas_message;
|
|
|
|
ogs_assert(message);
|
|
|
|
|
|
|
|
switch (message->esm.h.message_type) {
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST:
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_debug("PDN Connectivity request");
|
2019-06-23 11:43:23 +00:00
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2019-06-23 11:43:23 +00:00
|
|
|
rv = esm_handle_pdn_connectivity_request(
|
|
|
|
bearer, &message->esm.pdn_connectivity_request);
|
|
|
|
if (rv != OGS_OK) {
|
|
|
|
OGS_FSM_TRAN(s, esm_state_exception);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
OGS_FSM_TRAN(s, esm_state_inactive);
|
2017-03-05 07:49:57 +00:00
|
|
|
break;
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_PDN_DISCONNECT_REQUEST:
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_debug("PDN disconnect request");
|
2019-06-23 11:43:23 +00:00
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2019-06-23 11:43:23 +00:00
|
|
|
if (MME_HAVE_SGW_S1U_PATH(sess)) {
|
2020-10-22 21:53:13 +00:00
|
|
|
mme_gtp_send_delete_session_request(sess,
|
|
|
|
OGS_GTP_DELETE_SEND_DEACTIVATE_BEARER_CONTEXT_REQUEST);
|
2019-06-23 11:43:23 +00:00
|
|
|
} else {
|
2020-05-23 02:24:48 +00:00
|
|
|
nas_eps_send_deactivate_bearer_context_request(bearer);
|
2017-09-07 13:22:42 +00:00
|
|
|
}
|
2019-06-23 11:43:23 +00:00
|
|
|
OGS_FSM_TRAN(s, esm_state_pdn_will_disconnect);
|
2017-09-07 13:22:42 +00:00
|
|
|
break;
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT:
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_debug("Modify EPS bearer context accept");
|
2019-06-23 11:43:23 +00:00
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2017-09-07 13:22:42 +00:00
|
|
|
|
2020-11-07 22:27:12 +00:00
|
|
|
mme_gtp_send_update_bearer_response(
|
|
|
|
bearer, OGS_GTP_CAUSE_REQUEST_ACCEPTED);
|
2019-06-23 11:43:23 +00:00
|
|
|
break;
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT:
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_debug("Deactivate EPS bearer "
|
2019-06-23 11:43:23 +00:00
|
|
|
"context accept");
|
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2020-11-07 22:27:12 +00:00
|
|
|
mme_gtp_send_delete_bearer_response(
|
|
|
|
bearer, OGS_GTP_CAUSE_REQUEST_ACCEPTED);
|
2019-06-23 11:43:23 +00:00
|
|
|
OGS_FSM_TRAN(s, esm_state_bearer_deactivated);
|
|
|
|
break;
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_BEARER_RESOURCE_ALLOCATION_REQUEST:
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_debug("Bearer resource allocation request");
|
2019-12-28 12:46:30 +00:00
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2019-12-28 12:46:30 +00:00
|
|
|
esm_handle_bearer_resource_allocation_request(bearer, message);
|
|
|
|
break;
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_BEARER_RESOURCE_MODIFICATION_REQUEST:
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_debug("Bearer resource modification request");
|
2019-12-28 12:46:30 +00:00
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2019-12-28 12:46:30 +00:00
|
|
|
esm_handle_bearer_resource_modification_request(bearer, message);
|
|
|
|
break;
|
2017-09-07 13:22:42 +00:00
|
|
|
default:
|
2019-06-23 11:43:23 +00:00
|
|
|
ogs_error("Unknown message(type:%d)",
|
|
|
|
message->esm.h.message_type);
|
2017-09-07 13:22:42 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-06-23 11:43:23 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ogs_error("Unknown event %s", mme_event_get_name(e));
|
|
|
|
break;
|
2017-09-07 13:22:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
void esm_state_pdn_will_disconnect(ogs_fsm_t *s, mme_event_t *e)
|
2017-09-07 13:22:42 +00:00
|
|
|
{
|
2020-09-05 19:36:18 +00:00
|
|
|
int rv;
|
2017-09-07 13:22:42 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
|
|
|
mme_sess_t *sess = NULL;
|
|
|
|
mme_bearer_t *bearer = NULL;
|
2020-05-23 02:24:48 +00:00
|
|
|
ogs_nas_eps_message_t *message = NULL;
|
2017-09-07 13:22:42 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(s);
|
|
|
|
ogs_assert(e);
|
2017-09-07 13:22:42 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
mme_sm_debug(e);
|
2017-09-07 13:22:42 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
bearer = e->bearer;
|
|
|
|
ogs_assert(bearer);
|
2017-09-07 13:22:42 +00:00
|
|
|
sess = bearer->sess;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(sess);
|
2017-09-07 13:22:42 +00:00
|
|
|
mme_ue = sess->mme_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(mme_ue);
|
2017-09-07 13:22:42 +00:00
|
|
|
|
2019-06-23 11:43:23 +00:00
|
|
|
switch (e->id) {
|
|
|
|
case OGS_FSM_ENTRY_SIG:
|
|
|
|
break;
|
|
|
|
case OGS_FSM_EXIT_SIG:
|
|
|
|
break;
|
|
|
|
case MME_EVT_ESM_MESSAGE:
|
|
|
|
message = e->nas_message;
|
|
|
|
ogs_assert(message);
|
|
|
|
|
|
|
|
switch (message->esm.h.message_type) {
|
2020-05-23 02:24:48 +00:00
|
|
|
case OGS_NAS_EPS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT:
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_debug("[D] Deactivate EPS bearer "
|
2019-06-23 11:43:23 +00:00
|
|
|
"context accept");
|
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
2020-09-02 03:04:35 +00:00
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
2019-06-23 11:43:23 +00:00
|
|
|
OGS_FSM_TRAN(s, esm_state_pdn_did_disconnect);
|
2017-09-05 03:37:27 +00:00
|
|
|
break;
|
2020-09-05 19:36:18 +00:00
|
|
|
case OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST:
|
2020-10-01 17:27:58 +00:00
|
|
|
ogs_debug("PDN Connectivity request");
|
2020-09-05 19:36:18 +00:00
|
|
|
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
|
|
|
|
mme_ue->imsi_bcd, sess->pti, bearer->ebi);
|
|
|
|
rv = esm_handle_pdn_connectivity_request(
|
|
|
|
bearer, &message->esm.pdn_connectivity_request);
|
|
|
|
if (rv != OGS_OK) {
|
|
|
|
OGS_FSM_TRAN(s, esm_state_exception);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
OGS_FSM_TRAN(s, esm_state_inactive);
|
|
|
|
break;
|
2017-03-05 07:49:57 +00:00
|
|
|
default:
|
2019-06-23 11:43:23 +00:00
|
|
|
ogs_error("Unknown message(type:%d)",
|
|
|
|
message->esm.h.message_type);
|
2017-03-05 07:49:57 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-06-23 11:43:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ogs_error("Unknown event %s", mme_event_get_name(e));
|
|
|
|
break;
|
2017-03-05 07:49:57 +00:00
|
|
|
}
|
|
|
|
}
|
2017-09-05 03:37:27 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
void esm_state_pdn_did_disconnect(ogs_fsm_t *s, mme_event_t *e)
|
2018-01-16 13:14:59 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(e);
|
|
|
|
mme_sm_debug(e);
|
2018-01-16 13:14:59 +00:00
|
|
|
|
2019-06-23 11:43:23 +00:00
|
|
|
switch (e->id) {
|
|
|
|
case OGS_FSM_ENTRY_SIG:
|
|
|
|
break;
|
|
|
|
case OGS_FSM_EXIT_SIG:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ogs_error("Unknown event %s", mme_event_get_name(e));
|
|
|
|
break;
|
2018-01-16 13:14:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
void esm_state_bearer_deactivated(ogs_fsm_t *s, mme_event_t *e)
|
2017-09-06 15:37:16 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(e);
|
|
|
|
mme_sm_debug(e);
|
2017-09-11 09:41:14 +00:00
|
|
|
|
2019-06-23 11:43:23 +00:00
|
|
|
switch (e->id) {
|
|
|
|
case OGS_FSM_ENTRY_SIG:
|
|
|
|
break;
|
|
|
|
case OGS_FSM_EXIT_SIG:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ogs_error("Unknown event %s", mme_event_get_name(e));
|
|
|
|
break;
|
2017-09-06 15:37:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
void esm_state_exception(ogs_fsm_t *s, mme_event_t *e)
|
2017-09-06 15:37:16 +00:00
|
|
|
{
|
2019-07-20 14:06:54 +00:00
|
|
|
mme_bearer_t *bearer = NULL;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(e);
|
|
|
|
mme_sm_debug(e);
|
2017-09-11 09:41:14 +00:00
|
|
|
|
2019-07-20 14:06:54 +00:00
|
|
|
bearer = e->bearer;
|
|
|
|
|
2019-06-23 11:43:23 +00:00
|
|
|
switch (e->id) {
|
|
|
|
case OGS_FSM_ENTRY_SIG:
|
2019-07-20 14:06:54 +00:00
|
|
|
CLEAR_BEARER_ALL_TIMERS(bearer);
|
2019-06-23 11:43:23 +00:00
|
|
|
break;
|
|
|
|
case OGS_FSM_EXIT_SIG:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ogs_error("Unknown event %s", mme_event_get_name(e));
|
|
|
|
break;
|
2017-09-06 15:37:16 +00:00
|
|
|
}
|
|
|
|
}
|