From e6f229fa0386ab82b5485de483d66bf4d37980b9 Mon Sep 17 00:00:00 2001 From: Lionel Gauthier <lionel.gauthier@eurecom.fr> Date: Tue, 21 Apr 2015 13:07:14 +0000 Subject: [PATCH] msc traces git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7240 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair-cn/MME_APP/mme_app_authentication.c | 28 +++++++ openair-cn/MME_APP/mme_app_bearer.c | 66 +++++++++++++++- openair-cn/MME_APP/mme_app_itti_messaging.h | 16 ++++ openair-cn/MME_APP/mme_app_location.c | 11 +++ openair-cn/MME_APP/mme_app_main.c | 1 + .../NAS/EURECOM-NAS/src/emm/Authentication.c | 33 ++++++++ openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c | 13 +++- .../NAS/EURECOM-NAS/src/emm/Identification.c | 30 +++++++ .../EURECOM-NAS/src/emm/SecurityModeControl.c | 31 ++++++++ .../NAS/EURECOM-NAS/src/emm/sap/emm_as.c | 34 ++++++++ openair-cn/NAS/EURECOM-NAS/src/nas_proc.c | 55 +++++++++++++ openair-cn/NAS/nas_itti_messaging.c | 30 +++++++ openair-cn/NAS/nas_itti_messaging.h | 30 +++++++ openair-cn/S1AP/s1ap_mme_handlers.c | 49 +++++++++++- openair-cn/S1AP/s1ap_mme_itti_messaging.c | 16 ++++ openair-cn/S1AP/s1ap_mme_itti_messaging.h | 22 ++++++ openair-cn/S1AP/s1ap_mme_nas_procedures.c | 28 +++++++ openair-cn/S6A/s6a_auth_info.c | 8 +- openair-cn/SGW-LITE/sgw_lite_handlers.c | 78 +++++++++++++++++++ openair-cn/UTILS/mme_config.c | 10 ++- 20 files changed, 583 insertions(+), 6 deletions(-) diff --git a/openair-cn/MME_APP/mme_app_authentication.c b/openair-cn/MME_APP/mme_app_authentication.c index 80e39658b7..12561986a5 100644 --- a/openair-cn/MME_APP/mme_app_authentication.c +++ b/openair-cn/MME_APP/mme_app_authentication.c @@ -33,6 +33,7 @@ #include <string.h> #include <unistd.h> +#include "msc.h" #include "intertask_interface.h" #include "mme_app_itti_messaging.h" @@ -97,6 +98,13 @@ int mme_app_request_authentication_info(const char *imsi, memset(auth_info_req->auts, 0, sizeof(auth_info_req->auts)); } + MSC_LOG_TX_MESSAGE( + MSC_MMEAPP_MME, + MSC_S6A_MME, + NULL,0, + "0 S6A_AUTH_INFO_REQ IMSI %s visited_plmn %02X%02X%02X re_sync %u", + imsi,ptr[0],ptr[1],ptr[2],auth_info_req->re_synchronization); + return itti_send_msg_to_task(TASK_S6A, INSTANCE_DEFAULT, message_p); } @@ -111,9 +119,13 @@ int mme_app_handle_nas_auth_resp(const nas_auth_resp_t * const nas_auth_resp_pP) MME_APP_DEBUG("Handling imsi %"IMSI_FORMAT"\n", imsi); + if ((ue_context = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts, imsi)) == NULL) { MME_APP_ERROR("That's embarrassing as we don't know this IMSI\n"); + MSC_LOG_EVENT( + MSC_MMEAPP_MME, + "NAS_AUTH_RESP Unknown imsi %"IMSI_FORMAT,imsi); AssertFatal(0, "That's embarrassing as we don't know this IMSI\n"); return -1; } @@ -142,6 +154,13 @@ int mme_app_handle_nas_auth_resp(const nas_auth_resp_t * const nas_auth_resp_pP) /* Check if we already have UE data */ s6a_ulr->skip_subscriber_data = 0; + MSC_LOG_TX_MESSAGE( + MSC_MMEAPP_MME, + MSC_S6A_MME, + NULL,0, + " S6A_UPDATE_LOCATION_REQ IMSI %s RAT_EUTRAN", + imsi); + return itti_send_msg_to_task(TASK_S6A, INSTANCE_DEFAULT, message_p); } return -1; @@ -160,9 +179,13 @@ mme_app_handle_authentication_info_answer( MME_APP_DEBUG("Handling imsi %"IMSI_FORMAT"\n", imsi); + if ((ue_context = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts, imsi)) == NULL) { MME_APP_ERROR("That's embarrassing as we don't know this IMSI\n"); + MSC_LOG_EVENT( + MSC_MMEAPP_MME, + "S6A_AUTH_INFO_ANS Unknown imsi %"IMSI_FORMAT,imsi); return -1; } @@ -203,6 +226,11 @@ mme_app_handle_authentication_info_answer( &s6a_auth_info_ans_pP->auth_info.eutran_vector); } else { MME_APP_ERROR("INFORMING NAS ABOUT AUTH RESP ERROR CODE\n"); + MSC_LOG_EVENT( + MSC_MMEAPP_MME, + "S6A_AUTH_INFO_ANS S6A Failure imsi %"IMSI_FORMAT,imsi); + + /* Inform NAS layer with the right failure */ if (s6a_auth_info_ans_pP->result.present == S6A_RESULT_BASE) { diff --git a/openair-cn/MME_APP/mme_app_bearer.c b/openair-cn/MME_APP/mme_app_bearer.c index 1b05b52f0a..9383bbcfab 100644 --- a/openair-cn/MME_APP/mme_app_bearer.c +++ b/openair-cn/MME_APP/mme_app_bearer.c @@ -48,6 +48,7 @@ #include "assertions.h" #include "common_types.h" +#include "msc.h" @@ -213,6 +214,13 @@ mme_app_send_s11_create_session_req( session_request_p->serving_network.mnc[2] = ue_context_pP->e_utran_cgi.plmn.MNCdigit3; session_request_p->selection_mode = MS_O_N_P_APN_S_V; + + MSC_LOG_TX_MESSAGE( + MSC_MMEAPP_MME, + (to_task == TASK_S11) ? MSC_S11_MME:MSC_SP_GWAPP_MME, + NULL,0, + "0 SGW_CREATE_SESSION_REQUEST imsi %"IMSI_FORMAT,ue_context_pP->imsi); + return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } @@ -232,9 +240,13 @@ mme_app_handle_nas_pdn_connectivity_req( MME_APP_DEBUG("Handling imsi %"IMSI_FORMAT"\n", imsi); + if ((ue_context_p = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts, imsi)) == NULL) { - MME_APP_ERROR("That's embarrassing as we don't know this IMSI\n"); + MSC_LOG_EVENT( + MSC_MMEAPP_MME, + "NAS_PDN_CONNECTIVITY_REQ Unknown imsi %"IMSI_FORMAT,imsi); + MME_APP_ERROR("That's embarrassing as we don't know this IMSI\n"); return -1; } @@ -298,8 +310,12 @@ mme_app_handle_conn_est_cnf( ue_context_p = mme_ue_context_exists_nas_ue_id(&mme_app_desc.mme_ue_contexts, nas_conn_est_cnf_pP->UEid); + if (ue_context_p == NULL) { - MME_APP_ERROR("UE context doesn't exist for UE 0x%08X/dec%u\n", + MSC_LOG_EVENT( + MSC_MMEAPP_MME, + "NAS_CONNECTION_ESTABLISHMENT_CNF Unknown ue %u",nas_conn_est_cnf_pP->UEid); + MME_APP_ERROR("UE context doesn't exist for UE 0x%08X/dec%u\n", nas_conn_est_cnf_pP->UEid, nas_conn_est_cnf_pP->UEid); return; @@ -353,6 +369,18 @@ mme_app_handle_conn_est_cnf( derive_keNB(ue_context_p->vector_in_use->kasme, nas_conn_est_cnf_pP->ul_nas_count, keNB); //156 memcpy(establishment_cnf_p->keNB, keNB, 32); + MSC_LOG_TX_MESSAGE( + MSC_MMEAPP_MME, + MSC_S1AP_MME, + NULL,0, + "0 MME_APP_CONNECTION_ESTABLISHMENT_CNF ebi %u s1u_sgw teid %u qci %u prio level %u sea 0x%x sia 0x%x", + establishment_cnf_p->eps_bearer_id, + establishment_cnf_p->bearer_s1u_sgw_fteid.teid, + establishment_cnf_p->bearer_qos_qci, + establishment_cnf_p->bearer_qos_prio_level, + establishment_cnf_p->security_capabilities_encryption_algorithms, + establishment_cnf_p->security_capabilities_integrity_algorithms); + itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p); } @@ -372,6 +400,8 @@ mme_app_handle_conn_est_ind( &mme_app_desc.mme_ue_contexts, conn_est_ind_pP->mme_ue_s1ap_id); + + if (ue_context_p == NULL) { MME_APP_DEBUG("We didn't find this mme_ue_s1ap_id in list of UE: 0x%08x/dec%u\n", conn_est_ind_pP->mme_ue_s1ap_id, @@ -406,6 +436,13 @@ mme_app_handle_conn_est_ind( &conn_est_ind_pP->nas, sizeof (nas_establish_ind_t)); + + MSC_LOG_TX_MESSAGE( + MSC_MMEAPP_MME, + MSC_NAS_MME, + NULL,0, + "0 NAS_CONNECTION_ESTABLISHMENT_IND"); + itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); } @@ -428,6 +465,7 @@ mme_app_handle_create_sess_resp( ue_context_p = mme_ue_context_exists_s11_teid(&mme_app_desc.mme_ue_contexts, create_sess_resp_pP->teid); + if (ue_context_p == NULL) { MME_APP_DEBUG("We didn't find this teid in list of UE: %08x\n", create_sess_resp_pP->teid); @@ -668,6 +706,16 @@ mme_app_handle_create_sess_resp( NAS_PDN_CONNECTIVITY_RSP(message_p).ambr.br_dl = ue_context_p->subscribed_ambr.br_dl; + MSC_LOG_TX_MESSAGE( + MSC_MMEAPP_MME, + MSC_NAS_MME, + NULL,0, + "0 NAS_PDN_CONNECTIVITY_RSP sgw_s1u_teid %u ebi %u qci %u prio %u", + current_bearer_p->s_gw_teid, + bearer_id, + current_bearer_p->qci, + current_bearer_p->prio_level); + return itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); } return 0; @@ -689,10 +737,14 @@ mme_app_handle_initial_context_setup_rsp( &mme_app_desc.mme_ue_contexts, initial_ctxt_setup_rsp_pP->mme_ue_s1ap_id); + if (ue_context_p == NULL) { MME_APP_DEBUG("We didn't find this mme_ue_s1ap_id in list of UE: %08x %d(dec)\n", initial_ctxt_setup_rsp_pP->mme_ue_s1ap_id, initial_ctxt_setup_rsp_pP->mme_ue_s1ap_id); + MSC_LOG_EVENT( + MSC_MMEAPP_MME, + "MME_APP_INITIAL_CONTEXT_SETUP_RSP Unknown ue %u",initial_ctxt_setup_rsp_pP->mme_ue_s1ap_id); return; } @@ -727,6 +779,16 @@ mme_app_handle_initial_context_setup_rsp( /* S11 stack specific parameter. Not used in standalone epc mode */ SGW_MODIFY_BEARER_REQUEST(message_p).trxn = NULL; + + MSC_LOG_TX_MESSAGE( + MSC_MMEAPP_MME, + (to_task == TASK_S11) ? MSC_S11_MME:MSC_SP_GWAPP_MME, + NULL,0, + "0 SGW_MODIFY_BEARER_REQUEST teid %u ebi %u", + SGW_MODIFY_BEARER_REQUEST(message_p).teid, + SGW_MODIFY_BEARER_REQUEST(message_p).bearer_context_to_modify.eps_bearer_id); + + itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } diff --git a/openair-cn/MME_APP/mme_app_itti_messaging.h b/openair-cn/MME_APP/mme_app_itti_messaging.h index 3805837f2f..f4cbab06b2 100644 --- a/openair-cn/MME_APP/mme_app_itti_messaging.h +++ b/openair-cn/MME_APP/mme_app_itti_messaging.h @@ -38,11 +38,21 @@ mme_app_itti_auth_fail( { MessageDef *message_p; + MSC_LOG_TX_MESSAGE(MSC_MMEAPP_MME, MSC_NAS_MME,NULL,0, + "NAS_AUTHENTICATION_PARAM_FAIL ue %u cause %u",ue_id, cause); + message_p = itti_alloc_new_message(TASK_MME_APP, NAS_AUTHENTICATION_PARAM_FAIL); NAS_AUTHENTICATION_PARAM_FAIL(message_p).ue_id = ue_id; NAS_AUTHENTICATION_PARAM_FAIL(message_p).cause = cause; + MSC_LOG_TX_MESSAGE( + MSC_MMEAPP_MME, + MSC_NAS_MME, + NULL,0, + "0 NAS_AUTHENTICATION_PARAM_FAIL ue_id %u cause %u", + ue_id, cause); + itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); } @@ -61,6 +71,12 @@ static inline void mme_app_itti_auth_rsp( NAS_AUTHENTICATION_PARAM_RSP(message_p).nb_vectors = nb_vectors; memcpy(&NAS_AUTHENTICATION_PARAM_RSP(message_p).vector, vector, sizeof(*vector)); + MSC_LOG_TX_MESSAGE( + MSC_MMEAPP_MME, + MSC_NAS_MME, + NULL,0, + "0 NAS_AUTHENTICATION_PARAM_RSP ue_id %u nb_vectors %u", + ue_id, nb_vectors); itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); } diff --git a/openair-cn/MME_APP/mme_app_location.c b/openair-cn/MME_APP/mme_app_location.c index 7b9f4da97c..969b7b6ffb 100755 --- a/openair-cn/MME_APP/mme_app_location.c +++ b/openair-cn/MME_APP/mme_app_location.c @@ -50,6 +50,7 @@ #include "assertions.h" #include "common_types.h" +#include "msc.h" int @@ -89,6 +90,12 @@ mme_app_send_s6a_update_location_req( /* Check if we already have UE data */ s6a_ulr_p->skip_subscriber_data = 0; + MSC_LOG_TX_MESSAGE( + MSC_MMEAPP_MME, + MSC_S6A_MME, + NULL,0, + "0 S6A_UPDATE_LOCATION_REQ imsi %"IMSI_FORMAT,imsi); + return itti_send_msg_to_task(TASK_S6A, INSTANCE_DEFAULT, message_p); } @@ -123,8 +130,12 @@ mme_app_handle_s6a_update_location_ans( MME_APP_DEBUG("%s Handling imsi %"IMSI_FORMAT"\n", __FUNCTION__, imsi); + if ((ue_context_p = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts, imsi)) == NULL) { MME_APP_ERROR("That's embarrassing as we don't know this IMSI\n"); + MSC_LOG_EVENT( + MSC_MMEAPP_MME, + "0 S6A_UPDATE_LOCATION unknown imsi %"IMSI_FORMAT,imsi); return -1; } diff --git a/openair-cn/MME_APP/mme_app_main.c b/openair-cn/MME_APP/mme_app_main.c index 5d6dca3831..8c4ffc3698 100644 --- a/openair-cn/MME_APP/mme_app_main.c +++ b/openair-cn/MME_APP/mme_app_main.c @@ -42,6 +42,7 @@ #include "mme_app_statistics.h" #include "assertions.h" +#include "msc.h" mme_app_desc_t mme_app_desc; diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Authentication.c b/openair-cn/NAS/EURECOM-NAS/src/emm/Authentication.c index 3aacc3f798..a2d0c76347 100644 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/Authentication.c +++ b/openair-cn/NAS/EURECOM-NAS/src/emm/Authentication.c @@ -79,6 +79,7 @@ Description Defines the authentication EMM procedure executed by the # if defined(NAS_BUILT_IN_EPC) # include "nas_itti_messaging.h" # endif +#include "msc.h" #endif /****************************************************************************/ @@ -642,6 +643,14 @@ int emm_proc_authentication(void *ctx, unsigned int ueid, int ksi, /* * Notify EMM that common procedure has been initiated */ + + + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_REQ ue id %u (authentication)", ueid); + emm_sap_t emm_sap; emm_sap.primitive = EMMREG_COMMON_PROC_REQ; emm_sap.u.emm_reg.ueid = ueid; @@ -745,6 +754,10 @@ int emm_proc_authentication_complete(unsigned int ueid, int emm_cause, /* USIM has detected a mismatch in SQN. * Ask for a new vector. */ + MSC_LOG_EVENT( + MSC_NAS_EMM_MME, + "SQN SYNCH_FAILURE ue id %u", ueid); + LOG_TRACE(DEBUG, "EMM-PROC - USIM has detected a mismatch in SQN Ask for a new vector"); nas_itti_auth_info_req(ueid, emm_ctx->imsi, 0, res->value); @@ -762,6 +775,13 @@ int emm_proc_authentication_complete(unsigned int ueid, int emm_cause, /* * Notify EMM that the authentication procedure failed */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_REJ ue id %u", ueid); + + emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -771,6 +791,12 @@ int emm_proc_authentication_complete(unsigned int ueid, int emm_cause, /* * Notify EMM that the authentication procedure successfully completed */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_CNF ue id %u", ueid); + LOG_TRACE(DEBUG, "EMM-PROC - Notify EMM that the authentication procedure successfully completed"); emm_sap.primitive = EMMREG_COMMON_PROC_CNF; emm_sap.u.emm_reg.ueid = ueid; @@ -1417,6 +1443,13 @@ int _authentication_request(authentication_data_t *data) /* Setup EPS NAS security data */ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, emm_ctx->security, FALSE, TRUE); + + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMAS_SECURITY_REQ ue id %u", data->ueid); + rc = emm_sap_send(&emm_sap); if (rc != RETURNerror) { diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c b/openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c index cba18d5a8f..1de5764549 100644 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c +++ b/openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c @@ -59,6 +59,7 @@ Description Defines the detach related EMM procedure executed by the #include "emm_sap.h" #include "esm_sap.h" +#include "msc.h" #include <stdlib.h> // free @@ -548,7 +549,12 @@ int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type, * Notify ESM that all EPS bearer contexts allocated for this UE have * to be locally deactivated */ - esm_sap_t esm_sap; + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_ESM_MME, + NULL,0, + "0 ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ ue id %u", ueid); + esm_sap_t esm_sap; esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ; esm_sap.ueid = ueid; esm_sap.ctx = emm_ctx; @@ -560,6 +566,11 @@ int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type, /* * Notify EMM that the UE has been implicitly detached */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_DETACH_REQ ue id %u", ueid); emm_sap.primitive = EMMREG_DETACH_REQ; emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ctx = emm_ctx; diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Identification.c b/openair-cn/NAS/EURECOM-NAS/src/emm/Identification.c index faafc527e3..dc46782679 100644 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/Identification.c +++ b/openair-cn/NAS/EURECOM-NAS/src/emm/Identification.c @@ -55,6 +55,7 @@ Description Defines the identification EMM procedure executed by the #include "emmData.h" #include "emm_sap.h" +#include "msc.h" #include <stdlib.h> // malloc, free #include <string.h> // memcpy @@ -326,6 +327,12 @@ int emm_proc_identification(unsigned int ueid, /* * Notify EMM that common procedure has been initiated */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_REQ ue id %u (identification)", ueid); + emm_sap_t emm_sap; emm_sap.primitive = EMMREG_COMMON_PROC_REQ; emm_sap.u.emm_reg.ueid = ueid; @@ -433,6 +440,12 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi, /* * Notify EMM that the identification procedure successfully completed */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_CNF ue id %u", ueid); + emm_sap.primitive = EMMREG_COMMON_PROC_CNF; emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -442,6 +455,12 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi, /* * Notify EMM that the identification procedure failed */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_REJ ue id %u", ueid); + emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -545,6 +564,12 @@ int _identification_request(identification_data_t *data) * Notify EMM-AS SAP that Identity Request message has to be sent * to the UE */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMAS_SECURITY_REQ ue id %u", data->ueid); + emm_sap.primitive = EMMAS_SECURITY_REQ; emm_sap.u.emm_as.u.security.guti = NULL; emm_sap.u.emm_as.u.security.ueid = data->ueid; @@ -628,6 +653,11 @@ static int _identification_abort(void *args) * Notify EMM that the identification procedure failed */ if (notify_failure) { + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_REJ ue id %u", ueid); emm_sap_t emm_sap; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ueid = ueid; diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/SecurityModeControl.c b/openair-cn/NAS/EURECOM-NAS/src/emm/SecurityModeControl.c index f1bad591dd..319556dc93 100644 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/SecurityModeControl.c +++ b/openair-cn/NAS/EURECOM-NAS/src/emm/SecurityModeControl.c @@ -72,6 +72,7 @@ Description Defines the security mode control EMM procedure executed by the # include "assertions.h" #endif #include "secu_defs.h" +#include "msc.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -582,6 +583,11 @@ int emm_proc_security_mode_control(unsigned int ueid, int ksi, /* * Notify EMM that common procedure has been initiated */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_REQ ue id %u (security mode control)", ueid); emm_sap_t emm_sap; emm_sap.primitive = EMMREG_COMMON_PROC_REQ; emm_sap.u.emm_reg.ueid = ueid; @@ -656,6 +662,11 @@ int emm_proc_security_mode_complete(unsigned int ueid) /* * Notify EMM that the authentication procedure successfully completed */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_CNF ue id %u (security mode complete)", ueid); emm_sap.primitive = EMMREG_COMMON_PROC_CNF; emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -665,6 +676,11 @@ int emm_proc_security_mode_complete(unsigned int ueid) /* * Notify EMM that the authentication procedure failed */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_REJ ue id %u (security mode complete)", ueid); emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ueid = ueid; emm_sap.u.emm_reg.ctx = emm_ctx; @@ -750,6 +766,11 @@ int emm_proc_security_mode_reject(unsigned int ueid) /* * Notify EMM that the authentication procedure failed */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_REJ ue id %u (security mode reject)", ueid); emm_sap_t emm_sap; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ueid = ueid; @@ -1091,6 +1112,11 @@ int _security_request(security_data_t *data, int is_new) /* Setup EPS NAS security data */ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, emm_ctx->security, is_new, FALSE); + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMAS_SECURITY_REQ ue id %u", data->ueid); rc = emm_sap_send(&emm_sap); if (rc != RETURNerror) { @@ -1152,6 +1178,11 @@ static int _security_abort(void *args) * Notify EMM that the security mode control procedure failed */ if (notify_failure) { + MSC_LOG_TX_MESSAGE( + MSC_NAS_EMM_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMREG_COMMON_PROC_REJ ue id %u (security abort)", data->ueid); emm_sap_t emm_sap; emm_sap.primitive = EMMREG_COMMON_PROC_REJ; emm_sap.u.emm_reg.ueid = ueid; diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c index bdc03f6c92..04dd2e4c7c 100644 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c +++ b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c @@ -66,6 +66,7 @@ Description Defines the EMMAS Service Access Point that provides #if (defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(NAS_BUILT_IN_UE) && defined(NAS_UE)) # include "nas_itti_messaging.h" #endif +#include "msc.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -1892,16 +1893,31 @@ static int _emm_as_security_req(const emm_as_security_t *msg, /* Setup the NAS security message */ if (emm_msg != NULL) switch (msg->msgType) { case EMM_AS_MSG_TYPE_IDENT: + if (msg->guti) { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send IDENTITY_REQUEST to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); + } else { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send IDENTITY_REQUEST to ue id %u ", as_msg->UEid); + } size = emm_send_identity_request(msg, &emm_msg->identity_request); break; case EMM_AS_MSG_TYPE_AUTH: + if (msg->guti) { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REQUEST to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); + } else { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REQUEST to ue id %u ", as_msg->UEid); + } size = emm_send_authentication_request(msg, &emm_msg->authentication_request); break; case EMM_AS_MSG_TYPE_SMC: + if (msg->guti) { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send SECURITY_MODE_COMMAND to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); + } else { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send SECURITY_MODE_COMMAND to ue id %u ", as_msg->UEid); + } size = emm_send_security_mode_command(msg, &emm_msg->security_mode_command); break; @@ -1992,6 +2008,11 @@ static int _emm_as_security_rej(const emm_as_security_t *msg, /* Setup the NAS security message */ if (emm_msg != NULL) switch (msg->msgType) { case EMM_AS_MSG_TYPE_AUTH: + if (msg->guti) { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); + } else { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REJECT to ue id %u ", as_msg->UEid); + } size = emm_send_authentication_reject( &emm_msg->authentication_reject); break; @@ -2087,6 +2108,9 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg, LOG_TRACE(WARNING, "EMMAS-SAP - emm_as_establish.nasMSG.length=%d", msg->NASmsg.length); + + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_ACCEPT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); + size = emm_send_attach_accept(msg, &emm_msg->attach_accept); break; @@ -2200,10 +2224,20 @@ static int _emm_as_establish_rej(const emm_as_establish_t *msg, /* Setup the NAS information message */ if (emm_msg != NULL) switch (msg->NASinfo) { case EMM_AS_NAS_INFO_ATTACH: + if (msg->UEid.guti) { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); + } else { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_REJECT to ue id %u ", as_msg->UEid); + } size = emm_send_attach_reject(msg, &emm_msg->attach_reject); break; case EMM_AS_NAS_INFO_TAU: + if (msg->UEid.guti) { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send TRACKING_AREA_UPDATE_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); + } else { + MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send TRACKING_AREA_UPDATE_REJECT to ue id %u ", as_msg->UEid); + } size = emm_send_tracking_area_update_reject(msg, &emm_msg->tracking_area_update_reject); break; diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_proc.c b/openair-cn/NAS/EURECOM-NAS/src/nas_proc.c index 5a76131060..2d504afb80 100644 --- a/openair-cn/NAS/EURECOM-NAS/src/nas_proc.c +++ b/openair-cn/NAS/EURECOM-NAS/src/nas_proc.c @@ -51,6 +51,7 @@ Description NAS procedure call manager #include "esm_main.h" #include "esm_sap.h" +#include "msc.h" #include <stdio.h> // sprintf @@ -1353,6 +1354,12 @@ int nas_proc_establish_ind(UInt32_t ueid, tac_t tac, if (len > 0) { emm_sap_t emm_sap; + + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMAS_ESTABLISH_REQ ue id %u tac %u", ueid, tac); /* * Notify the EMM procedure call manager that NAS signalling * connection establishment indication message has been received @@ -1391,6 +1398,12 @@ int nas_proc_dl_transfer_cnf(UInt32_t ueid) emm_sap_t emm_sap; int rc; + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMAS_DATA_IND dl_transfer_conf ue id %u", ueid); + /* * Notify the EMM procedure call manager that downlink NAS message * has been successfully delivered to the NAS sublayer on the @@ -1428,6 +1441,12 @@ int nas_proc_dl_transfer_rej(UInt32_t ueid) emm_sap_t emm_sap; int rc; + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMAS_DATA_IND dl_transfer_reject ue id %u", ueid); + /* * Notify the EMM procedure call manager that transmission * failure of downlink NAS message indication has been received @@ -1471,6 +1490,12 @@ int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t *data, UInt32_t len) * Notify the EMM procedure call manager that data transfer * indication has been received from the Access-Stratum sublayer */ + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMAS_DATA_IND ue id %u len %u", ueid, len); + emm_sap.primitive = EMMAS_DATA_IND; emm_sap.u.emm_as.u.data.ueid = ueid; emm_sap.u.emm_as.u.data.delivered = TRUE; @@ -1490,6 +1515,12 @@ int nas_proc_auth_param_res(emm_cn_auth_res_t *emm_cn_auth_res) LOG_FUNC_IN; + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMCN_AUTHENTICATION_PARAM_RES"); + emm_sap.primitive = EMMCN_AUTHENTICATION_PARAM_RES; emm_sap.u.emm_cn.u.auth_res = emm_cn_auth_res; @@ -1505,6 +1536,12 @@ int nas_proc_auth_param_fail(emm_cn_auth_fail_t *emm_cn_auth_fail) LOG_FUNC_IN; + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMCN_AUTHENTICATION_PARAM_FAIL"); + emm_sap.primitive = EMMCN_AUTHENTICATION_PARAM_FAIL; emm_sap.u.emm_cn.u.auth_fail = emm_cn_auth_fail; @@ -1520,6 +1557,12 @@ int nas_proc_deregister_ue(UInt32_t ue_id) LOG_FUNC_IN; + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMCN_DEREGISTER_UE ue_id %u",ue_id); + emm_sap.primitive = EMMCN_DEREGISTER_UE; emm_sap.u.emm_cn.u.deregister.UEid = ue_id; @@ -1535,6 +1578,12 @@ int nas_proc_pdn_connectivity_res(emm_cn_pdn_res_t *emm_cn_pdn_res) LOG_FUNC_IN; + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMCN_PDN_CONNECTIVITY_RES"); + emm_sap.primitive = EMMCN_PDN_CONNECTIVITY_RES; emm_sap.u.emm_cn.u.emm_cn_pdn_res = emm_cn_pdn_res; @@ -1550,6 +1599,12 @@ int nas_proc_pdn_connectivity_fail(emm_cn_pdn_fail_t *emm_cn_pdn_fail) LOG_FUNC_IN; + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_NAS_EMM_MME, + NULL,0, + "0 EMMCN_PDN_CONNECTIVITY_FAIL"); + emm_sap.primitive = EMMCN_PDN_CONNECTIVITY_FAIL; emm_sap.u.emm_cn.u.emm_cn_pdn_fail = emm_cn_pdn_fail; diff --git a/openair-cn/NAS/nas_itti_messaging.c b/openair-cn/NAS/nas_itti_messaging.c index 4e7ea4b929..cbe9def44d 100644 --- a/openair-cn/NAS/nas_itti_messaging.c +++ b/openair-cn/NAS/nas_itti_messaging.c @@ -30,6 +30,7 @@ #include "intertask_interface.h" #include "nas_itti_messaging.h" +#include "msc.h" #if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) # if (defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) @@ -200,6 +201,12 @@ int nas_itti_dl_data_req(const uint32_t ue_id, void *const data, NAS_DL_DATA_REQ(message_p).nasMsg.data = data; NAS_DL_DATA_REQ(message_p).nasMsg.length = length; + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_S1AP_MME, + NULL,0, + "0 NAS_DOWNLINK_DATA_REQ ue id %u len %u", ue_id, length); + return itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p); } @@ -217,6 +224,14 @@ int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat) NAS_CELL_SELECTION_REQ(message_p).plmnID = plmnID; NAS_CELL_SELECTION_REQ(message_p).rat = rat; + MSC_LOG_TX_MESSAGE( + MSC_NAS_UE, + MSC_RRC_UE, + NULL,0, + "0 NAS_CELL_SELECTION_REQ PLMN %X%X%X.%X%X%X", + plmnID.MCCdigit1, plmnID.MCCdigit2, plmnID.MCCdigit3, + plmnID.MNCdigit1, plmnID.MNCdigit2, plmnID.MNCdigit3); + return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + 0 /* TODO to be virtualized */, message_p); } @@ -233,6 +248,15 @@ int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.data = data; NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.length = length; + MSC_LOG_TX_MESSAGE( + MSC_NAS_UE, + MSC_RRC_UE, + NULL,0, + "0 NAS_CONN_ESTABLI_REQ MME code %u m-TMSI %u PLMN %X%X%X.%X%X%X", + s_tmsi.MMEcode, s_tmsi.m_tmsi, + plmnID.MCCdigit1, plmnID.MCCdigit2, plmnID.MCCdigit3, + plmnID.MNCdigit1, plmnID.MNCdigit2, plmnID.MNCdigit3); + return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + 0 /* TODO to be virtualized */, message_p); } @@ -259,6 +283,12 @@ int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID, NAS_RAB_ESTABLI_RSP(message_p).rabID = rabID; NAS_RAB_ESTABLI_RSP(message_p).errCode = errCode; + MSC_LOG_TX_MESSAGE( + MSC_NAS_UE, + MSC_RRC_UE, + NULL,0, + "0 NAS_RAB_ESTABLI_RSP MME code %u m-TMSI %u rb id %u status %u", + s_tmsi.MMEcode, s_tmsi.m_tmsi,rabID, errCode ); return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + 0 /* TODO to be virtualized */, message_p); } #endif diff --git a/openair-cn/NAS/nas_itti_messaging.h b/openair-cn/NAS/nas_itti_messaging.h index 7293cd6632..7e3634af91 100644 --- a/openair-cn/NAS/nas_itti_messaging.h +++ b/openair-cn/NAS/nas_itti_messaging.h @@ -33,6 +33,7 @@ #include "assertions.h" #include "intertask_interface.h" #include "esm_proc.h" +#include "msc.h" #ifndef NAS_ITTI_MESSAGING_H_ #define NAS_ITTI_MESSAGING_H_ @@ -123,6 +124,14 @@ static inline void nas_itti_pdn_connectivity_req( NAS_PDN_CONNECTIVITY_REQ(message_p).proc_data = proc_data_pP; NAS_PDN_CONNECTIVITY_REQ(message_p).request_type = request_typeP; + + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_MMEAPP_MME, + NULL,0, + "0 NAS_PDN_CONNECTIVITY_REQ ue id %u IMSI %X", + ueidP, NAS_PDN_CONNECTIVITY_REQ(message_p).imsi); + itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); } @@ -149,6 +158,13 @@ static inline void nas_itti_establish_cnf( NAS_CONNECTION_ESTABLISHMENT_CNF(message_p).selected_encryption_algorithm = selected_encryption_algorithmP; NAS_CONNECTION_ESTABLISHMENT_CNF(message_p).selected_integrity_algorithm = selected_integrity_algorithmP; + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_MMEAPP_MME, + NULL,0, + "0 NAS_CONNECTION_ESTABLISHMENT_CNF ue id %u len %u sea %x sia %x ", + ue_idP, lengthP, selected_encryption_algorithmP, selected_integrity_algorithmP); + itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); } @@ -189,6 +205,13 @@ static inline void nas_itti_auth_info_req( memset(NAS_AUTHENTICATION_PARAM_REQ(message_p).auts, 0, AUTS_LENGTH); } + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_MMEAPP_MME, + NULL,0, + "0 NAS_AUTHENTICATION_PARAM_REQ ue id %u IMSI %s ", + ue_idP, NAS_AUTHENTICATION_PARAM_REQ(message_p).imsi); + itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); } @@ -219,6 +242,13 @@ static inline void nas_itti_establish_rej( NAS_AUTHENTICATION_PARAM_REQ(message_p).initial_req = initial_reqP; NAS_AUTHENTICATION_PARAM_REQ(message_p).ue_id = ue_idP; + MSC_LOG_TX_MESSAGE( + MSC_NAS_MME, + MSC_MMEAPP_MME, + NULL,0, + "0 NAS_AUTHENTICATION_PARAM_REQ ue id %u IMSI %s (establish reject)", + ue_idP, NAS_AUTHENTICATION_PARAM_REQ(message_p).imsi); + itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); } # endif diff --git a/openair-cn/S1AP/s1ap_mme_handlers.c b/openair-cn/S1AP/s1ap_mme_handlers.c index 8885daa594..dbd2063ffb 100644 --- a/openair-cn/S1AP/s1ap_mme_handlers.c +++ b/openair-cn/S1AP/s1ap_mme_handlers.c @@ -45,6 +45,7 @@ #include "s1ap_mme.h" #include "s1ap_mme_ta.h" +#include "msc.h" static int s1ap_generate_s1_setup_response(eNB_description_t *eNB_association); static int s1ap_mme_generate_ue_context_release_command( @@ -211,7 +212,12 @@ int s1ap_mme_generate_s1_setup_failure( S1AP_ERROR("Failed to encode s1 setup failure\n"); return -1; } - + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_S1AP_ENB, + NULL,0, + "0 SETUP_FAILURE assoc_id %u cause %u value %u", + assoc_id, cause_type, cause_value); return s1ap_mme_itti_send_sctp_request(buffer_p, length, assoc_id, 0); } @@ -432,6 +438,12 @@ int s1ap_generate_s1_setup_response(eNB_description_t *eNB_association) eNB_association->s1_state = S1AP_READY; } + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_S1AP_ENB, + NULL,0, + "0 SETUP_RESPONSE assoc_id %u", + eNB_association->sctp_assoc_id); /* Non-UE signalling -> stream 0 */ return s1ap_mme_itti_send_sctp_request(buffer, length, eNB_association->sctp_assoc_id, 0); @@ -489,6 +501,15 @@ int s1ap_mme_handle_ue_cap_indication(uint32_t assoc_id, uint32_t stream, ue_cap_ind_p->radio_capabilities_length = ue_cap_p->ueRadioCapability.size; + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_MMEAPP_MME, + NULL,0, + "0 S1AP_UE_CAPABILITIES_IND eNB_ue_s1ap_id %u mme_ue_s1ap_id %u len %u", + ue_cap_ind_p->eNB_ue_s1ap_id, + ue_cap_ind_p->mme_ue_s1ap_id, + ue_cap_ind_p->radio_capabilities_length); + return itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); } return 0; @@ -558,6 +579,17 @@ int s1ap_mme_handle_initial_context_setup_response( memcpy(&MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).bearer_s1u_enb_fteid.ipv4_address, eRABSetupItemCtxtSURes_p->transportLayerAddress.buf, 4); + + + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_MMEAPP_MME, + NULL,0, + "0 MME_APP_INITIAL_CONTEXT_SETUP_RSP mme_ue_s1ap_id %u ebi %u s1u enb teid %u", + MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).mme_ue_s1ap_id, + MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).eps_bearer_id, + MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).bearer_s1u_enb_fteid.teid); + return itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); } @@ -760,6 +792,10 @@ int s1ap_handle_sctp_deconnection(uint32_t assoc_id) assoc_id); return -1; } + MSC_LOG_EVENT( + MSC_S1AP_MME, + "Event SCTP_CLOSE_ASSOCIATION assoc_id: %d", + assoc_id); STAILQ_FOREACH(ue_ref, &eNB_association->ue_list_head, ue_entries) { /* Ask for a release of each UE context associated to the eNB */ @@ -785,6 +821,13 @@ int s1ap_handle_sctp_deconnection(uint32_t assoc_id) S1AP_ENB_DEREGISTERED_IND(message_p).mme_ue_s1ap_id[current_ue_index] = 0; } + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_NAS_MME, + NULL,0, + "0 S1AP_ENB_DEREGISTERED_IND num ue to deregister %u", + S1AP_ENB_DEREGISTERED_IND(message_p).nb_ue_to_deregister); + itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); } @@ -830,6 +873,10 @@ int s1ap_handle_new_association(sctp_new_peer_t *sctp_new_peer_p) * ue associated signalling. */ eNB_association->next_sctp_stream = 1; + MSC_LOG_EVENT( + MSC_S1AP_MME, + "Event SCTP_NEW_ASSOCIATION assoc_id: %d", + eNB_association->sctp_assoc_id); return 0; } diff --git a/openair-cn/S1AP/s1ap_mme_itti_messaging.c b/openair-cn/S1AP/s1ap_mme_itti_messaging.c index cccd83f10a..4a58400899 100644 --- a/openair-cn/S1AP/s1ap_mme_itti_messaging.c +++ b/openair-cn/S1AP/s1ap_mme_itti_messaging.c @@ -55,6 +55,14 @@ int s1ap_mme_itti_nas_uplink_ind(const uint32_t ue_id, uint8_t * const buffer, NAS_UL_DATA_IND(message_p).nasMsg.data = buffer; NAS_UL_DATA_IND(message_p).nasMsg.length = length; + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_NAS_MME, + NULL,0, + "0 NAS_UPLINK_DATA_IND ue_id %u len %u", + NAS_UL_DATA_IND(message_p).UEid, + NAS_UL_DATA_IND(message_p).nasMsg.length); + return itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); } @@ -68,5 +76,13 @@ int s1ap_mme_itti_nas_downlink_cnf(const uint32_t ue_id, NAS_DL_DATA_CNF(message_p).UEid = ue_id; NAS_DL_DATA_CNF(message_p).errCode = error_code; + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_NAS_MME, + NULL,0, + "0 NAS_DOWNLINK_DATA_CNF ue_id %u errCode %u", + NAS_DL_DATA_CNF(message_p).UEid, + NAS_DL_DATA_CNF(message_p).errCode); + return itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); } diff --git a/openair-cn/S1AP/s1ap_mme_itti_messaging.h b/openair-cn/S1AP/s1ap_mme_itti_messaging.h index 7cdd0cb233..16dd514ea4 100644 --- a/openair-cn/S1AP/s1ap_mme_itti_messaging.h +++ b/openair-cn/S1AP/s1ap_mme_itti_messaging.h @@ -31,6 +31,7 @@ #include <string.h> #include "intertask_interface.h" +#include "msc.h" #ifndef S1AP_MME_ITTI_MESSAGING_H_ #define S1AP_MME_ITTI_MESSAGING_H_ @@ -67,6 +68,16 @@ static inline void s1ap_mme_itti_mme_app_establish_ind( MME_APP_CONNECTION_ESTABLISHMENT_IND(message_p).nas.initialNasMsg.data = malloc(sizeof(uint8_t) * nas_msg_length); memcpy(MME_APP_CONNECTION_ESTABLISHMENT_IND(message_p).nas.initialNasMsg.data, nas_msg, nas_msg_length); + + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_MMEAPP_MME, + NULL,0, + "0 MME_APP_CONNECTION_ESTABLISHMENT_IND ue_id %u as cause %u tac %u len %u", + ue_id, + MME_APP_CONNECTION_ESTABLISHMENT_IND(message_p).nas.asCause, + MME_APP_CONNECTION_ESTABLISHMENT_IND(message_p).nas.tac, + MME_APP_CONNECTION_ESTABLISHMENT_IND(message_p).nas.initialNasMsg.length); // should be sent to MME_APP, but this one would forward it to NAS_MME, so send it directly to NAS_MME // but let's see itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); @@ -91,6 +102,17 @@ static inline void s1ap_mme_itti_nas_establish_ind( NAS_CONN_EST_IND(message_p).nas.initialNasMsg.data = malloc(sizeof(uint8_t) * nas_msg_length); memcpy(NAS_CONN_EST_IND(message_p).nas.initialNasMsg.data, nas_msg, nas_msg_length); + + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_NAS_MME, + NULL,0, + "0 NAS_CONNECTION_ESTABLISHMENT_IND ue_id %u as cause %u tac %u len %u", + ue_id, + NAS_CONN_EST_IND(message_p).nas.asCause, + NAS_CONN_EST_IND(message_p).nas.tac, + NAS_CONN_EST_IND(message_p).nas.initialNasMsg.length); + // should be sent to MME_APP, but this one would forward it to NAS_MME, so send it directly to NAS_MME // but let's see itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); diff --git a/openair-cn/S1AP/s1ap_mme_nas_procedures.c b/openair-cn/S1AP/s1ap_mme_nas_procedures.c index aa60b94be4..737461d7c0 100644 --- a/openair-cn/S1AP/s1ap_mme_nas_procedures.c +++ b/openair-cn/S1AP/s1ap_mme_nas_procedures.c @@ -47,6 +47,7 @@ #include "assertions.h" #include "conversions.h" +#include "msc.h" /* Every time a new UE is associated, increment this variable. * But care if it wraps to increment also the mme_ue_s1ap_id_has_wrapped @@ -163,6 +164,15 @@ int s1ap_mme_handle_uplink_nas_transport(uint32_t assoc_id, uint32_t stream, uplinkNASTransport_p = &message->msg.s1ap_UplinkNASTransportIEs; + MSC_LOG_RX_MESSAGE( + MSC_S1AP_MME, + MSC_S1AP_ENB, + NULL,0, + "0 UPLINK_NAS_TRANSPORT mme_ue_s1ap_id %u eNB_ue_s1ap_id %u nas len %u", + uplinkNASTransport_p->mme_ue_s1ap_id, + uplinkNASTransport_p->eNB_UE_S1AP_ID, + uplinkNASTransport_p->nas_pdu.size); + if ((ue_ref = s1ap_is_ue_mme_id_in_list(uplinkNASTransport_p->mme_ue_s1ap_id)) == NULL) { S1AP_DEBUG("No UE is attached to this mme UE s1ap id: %d\n", @@ -249,6 +259,16 @@ int s1ap_generate_downlink_nas_transport(const uint32_t ue_id, void * const data downlinkNasTransport->mme_ue_s1ap_id, downlinkNasTransport->eNB_UE_S1AP_ID); + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_S1AP_ENB, + NULL,0, + "0 DOWNLINK_NAS_TRANSPORT ue_id %u mme_ue_s1ap_id %u eNB_ue_s1ap_id %u nas length %u", + ue_id, + downlinkNasTransport->mme_ue_s1ap_id, + downlinkNasTransport->eNB_UE_S1AP_ID, + size); + s1ap_mme_itti_send_sctp_request(buffer_p, length, ue_ref->eNB->sctp_assoc_id, ue_ref->sctp_stream_send); @@ -685,6 +705,14 @@ void s1ap_handle_conn_est_cnf(const mme_app_connection_establishment_cnf_t * con free(conn_est_cnf_pP->nas_conn_est_cnf.nasMsg.data); + MSC_LOG_TX_MESSAGE( + MSC_S1AP_MME, + MSC_S1AP_ENB, + NULL,0, + "0 INITIAL_CONTEXT_SETUP mme_ue_s1ap_id %u eNB_ue_s1ap_id %u nas length %u", + initialContextSetupRequest_p->mme_ue_s1ap_id, + initialContextSetupRequest_p->eNB_UE_S1AP_ID, + nas_pdu.size); s1ap_mme_itti_send_sctp_request( buffer_p, length, diff --git a/openair-cn/S6A/s6a_auth_info.c b/openair-cn/S6A/s6a_auth_info.c index 529dc3c889..1fbeba8856 100644 --- a/openair-cn/S6A/s6a_auth_info.c +++ b/openair-cn/S6A/s6a_auth_info.c @@ -39,6 +39,7 @@ #include "security_types.h" #include "s6a_defs.h" #include "s6a_messages.h" +#include "msc.h" static int s6a_parse_rand(struct avp_hdr *hdr, uint8_t *rand_p) @@ -276,7 +277,12 @@ int s6a_aia_cb(struct msg **msg, struct avp *paramavp, DevMessage("We requested E-UTRAN vectors with an immediate response...\n"); } } - + MSC_LOG_TX_MESSAGE( + MSC_S6A_MME, + MSC_MMEAPP_MME, + NULL,0, + "0 S6A_AUTH_INFO_ANS imsi %s", + s6a_auth_info_ans_p->imsi); itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); err: return 0; diff --git a/openair-cn/SGW-LITE/sgw_lite_handlers.c b/openair-cn/SGW-LITE/sgw_lite_handlers.c index bb38ebe7b6..eef43d1a1f 100644 --- a/openair-cn/SGW-LITE/sgw_lite_handlers.c +++ b/openair-cn/SGW-LITE/sgw_lite_handlers.c @@ -53,6 +53,7 @@ #include "sgw_lite.h" #include "pgw_lite_paa.h" #include "spgw_config.h" +#include "msc.h" extern sgw_app_t sgw_app; extern spgw_config_t spgw_config; @@ -335,6 +336,19 @@ sgw_lite_handle_sgi_endpoint_created( create_session_response_p->bearer_context_created.s1u_sgw_fteid.ipv4_address, create_session_response_p->bearer_context_created.eps_bearer_id, create_session_response_p->bearer_context_created.cause); + + MSC_LOG_TX_MESSAGE( + MSC_SP_GWAPP_MME, + (to_task == TASK_MME_APP) ? MSC_MMEAPP_MME:MSC_S11_MME, + NULL,0, + "0 SGW_CREATE_SESSION_RESPONSE S11 MME teid %u S11 S-GW teid %u S1U teid %u S1U@ 0x%x ebi %u status %d", + create_session_response_p->teid, + create_session_response_p->s11_sgw_teid.teid, + create_session_response_p->bearer_context_created.s1u_sgw_fteid.teid, + create_session_response_p->bearer_context_created.s1u_sgw_fteid.ipv4_address, + create_session_response_p->bearer_context_created.eps_bearer_id, + create_session_response_p->bearer_context_created.cause); + return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } @@ -542,6 +556,13 @@ sgw_lite_handle_gtpv1uCreateTunnelResp( memset(create_session_response_p, 0, sizeof(SgwCreateSessionResponse)); create_session_response_p->cause = CONTEXT_NOT_FOUND; create_session_response_p->bearer_context_created.cause = CONTEXT_NOT_FOUND; + + + MSC_LOG_TX_MESSAGE( + MSC_SP_GWAPP_MME, + (to_task == TASK_MME_APP) ? MSC_MMEAPP_MME:MSC_S11_MME, + NULL,0, + "0 SGW_CREATE_SESSION_RESPONSE teid %u CONTEXT_NOT_FOUND", endpoint_created_pP->context_teid); return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } } @@ -635,6 +656,15 @@ sgw_lite_handle_gtpv1uUpdateTunnelResp( modify_response_p->bearer_choice.bearer_for_removal.cause = CONTEXT_NOT_FOUND; modify_response_p->cause = CONTEXT_NOT_FOUND; modify_response_p->trxn = new_bearer_ctxt_info_p->sgw_eps_bearer_context_information.trxn; + + MSC_LOG_TX_MESSAGE( + MSC_SP_GWAPP_MME, + (to_task == TASK_MME_APP) ? MSC_MMEAPP_MME:MSC_S11_MME, + NULL,0, + "0 SGW_MODIFY_BEARER_RESPONSE ebi %u CONTEXT_NOT_FOUND trxn %u", + modify_response_p->bearer_choice.bearer_for_removal.eps_bearer_id, + modify_response_p->trxn); + return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } @@ -700,6 +730,14 @@ sgw_lite_handle_sgi_endpoint_updated( modify_response_p->cause = CONTEXT_NOT_FOUND; modify_response_p->trxn = 0; + MSC_LOG_TX_MESSAGE( + MSC_SP_GWAPP_MME, + (to_task == TASK_MME_APP) ? MSC_MMEAPP_MME:MSC_S11_MME, + NULL,0, + "0 SGW_MODIFY_BEARER_RESPONSE ebi %u CONTEXT_NOT_FOUND trxn %u", + modify_response_p->bearer_choice.bearer_for_removal.eps_bearer_id, + modify_response_p->trxn); + return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } else if (hash_rc == HASH_TABLE_OK) { SPGW_APP_DEBUG("Rx SGI_UPDATE_ENDPOINT_RESPONSE: REQUEST_ACCEPTED\n"); @@ -817,6 +855,13 @@ sgw_lite_handle_sgi_endpoint_updated( #endif } + MSC_LOG_TX_MESSAGE( + MSC_SP_GWAPP_MME, + (to_task == TASK_MME_APP) ? MSC_MMEAPP_MME:MSC_S11_MME, + NULL,0, + "0 SGW_MODIFY_BEARER_RESPONSE ebi %u trxn %u", + modify_response_p->bearer_choice.bearer_contexts_modified.eps_bearer_id, + modify_response_p->trxn); return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } else { @@ -829,6 +874,13 @@ sgw_lite_handle_sgi_endpoint_updated( modify_response_p->cause = CONTEXT_NOT_FOUND; modify_response_p->trxn = 0; + MSC_LOG_TX_MESSAGE( + MSC_SP_GWAPP_MME, + (to_task == TASK_MME_APP) ? MSC_MMEAPP_MME:MSC_S11_MME, + NULL,0, + "0 SGW_MODIFY_BEARER_RESPONSE ebi %u CONTEXT_NOT_FOUND trxn %u", + modify_response_p->bearer_choice.bearer_contexts_modified.eps_bearer_id, + modify_response_p->trxn); return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } } @@ -890,6 +942,15 @@ sgw_lite_handle_modify_bearer_request( modify_response_p->trxn = modify_bearer_pP->trxn; SPGW_APP_DEBUG("Rx MODIFY_BEARER_REQUEST, eps_bearer_id %u CONTEXT_NOT_FOUND\n", modify_bearer_pP->bearer_context_to_modify.eps_bearer_id); + + MSC_LOG_TX_MESSAGE( + MSC_SP_GWAPP_MME, + (to_task == TASK_MME_APP) ? MSC_MMEAPP_MME:MSC_S11_MME, + NULL,0, + "0 SGW_MODIFY_BEARER_RESPONSE ebi %u CONTEXT_NOT_FOUND trxn %u", + modify_response_p->bearer_choice.bearer_for_removal.eps_bearer_id, + modify_response_p->trxn); + return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } else if (hash_rc == HASH_TABLE_OK) { // TO DO @@ -1015,6 +1076,16 @@ sgw_lite_handle_delete_session_request( delete_session_resp_p->trxn = delete_session_req_pP->trxn; delete_session_resp_p->peer_ip = delete_session_req_pP->peer_ip; + MSC_LOG_TX_MESSAGE( + MSC_SP_GWAPP_MME, + (to_task == TASK_MME_APP) ? MSC_MMEAPP_MME:MSC_S11_MME, + NULL,0, + "0 SGW_DELETE_SESSION_RESPONSE teid %u cause %u trxn %u", + delete_session_resp_p->teid, + delete_session_resp_p->cause, + delete_session_resp_p->trxn); + + return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } else { /* Context not found... set the cause to CONTEXT_NOT_FOUND @@ -1039,6 +1110,13 @@ sgw_lite_handle_delete_session_request( delete_session_resp_p->trxn = delete_session_req_pP->trxn; delete_session_resp_p->peer_ip = delete_session_req_pP->peer_ip; + MSC_LOG_TX_MESSAGE( + MSC_SP_GWAPP_MME, + (to_task == TASK_MME_APP) ? MSC_MMEAPP_MME:MSC_S11_MME, + NULL,0, + "0 SGW_DELETE_SESSION_RESPONSE CONTEXT_NOT_FOUND trxn %u", + delete_session_resp_p->trxn); + return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p); } diff --git a/openair-cn/UTILS/mme_config.c b/openair-cn/UTILS/mme_config.c index 093224b11e..743b7daf0c 100644 --- a/openair-cn/UTILS/mme_config.c +++ b/openair-cn/UTILS/mme_config.c @@ -42,6 +42,7 @@ #include <arpa/inet.h> /* To provide inet_addr */ #include "assertions.h" +#include "msc.h" #include "mme_config.h" #include "spgw_config.h" #include "intertask_interface_conf.h" @@ -652,6 +653,8 @@ static void usage(void) fprintf(stdout, "-h Print this help and return\n"); fprintf(stdout, "-i<interface name>\n"); fprintf(stdout, " Set the network card to use for IPv4 forwarding\n"); + fprintf(stdout, "-m\n"); + fprintf(stdout, " Use mscgen dump trace tool\n"); fprintf(stdout, "-c<path>\n"); fprintf(stdout, " Set the configuration file for mme\n"); fprintf(stdout, " See template in UTILS/CONF\n"); @@ -672,7 +675,7 @@ int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config_p) mme_config_init(mme_config_p); /* Parsing command line */ - while ((c = getopt (argc, argv, "O:c:hi:K:v:V")) != -1) { + while ((c = getopt (argc, argv, "O:c:hi:K:m:v:V")) != -1) { switch (c) { case 'O': case 'c': { @@ -687,6 +690,11 @@ int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config_p) } break; + case 'm': { + MSC_INIT(MSC_EPC); + } + break; + /*case 'i': { int interface_len = 0; -- GitLab