diff --git a/src/mme/emm_build.c b/src/mme/emm_build.c index b3ba79dc1..3efb7f5f8 100644 --- a/src/mme/emm_build.c +++ b/src/mme/emm_build.c @@ -25,7 +25,6 @@ status_t emm_build_attach_accept( &attach_accept->eps_network_feature_support; d_assert(mme_ue, return CORE_ERROR, "Null param"); - d_assert(mme_ue->enb_ue, return CORE_ERROR, "Null param"); d_assert(esmbuf, return CORE_ERROR, "Null param"); d_trace(3, "[EMM] Attach accept\n"); diff --git a/src/mme/mme_context.h b/src/mme/mme_context.h index 22ba99a1d..9b1e5e626 100644 --- a/src/mme/mme_context.h +++ b/src/mme/mme_context.h @@ -304,10 +304,10 @@ struct _mme_ue_t { c_uint8_t ebi; /* EPS Bearer ID generator */ list_t sess_list; -#define ECM_IDLE(__mME) \ - ((__mME) && ((__mME)->enb_ue == NULL)) #define ECM_CONNECTED(__mME) \ - ((__mME) && ((__mME)->enb_ue != NULL)) + ((__mME) && ((__mME)->enb_ue != NULL) && \ + enb_ue_find((__mME)->enb_ue->index)) +#define ECM_IDLE(__mME) (!ECM_CONNECTED(__mME)) /* S1 UE context */ enb_ue_t *enb_ue; diff --git a/src/mme/mme_sm.c b/src/mme/mme_sm.c index 3ae5ba58e..752a83c7b 100644 --- a/src/mme/mme_sm.c +++ b/src/mme/mme_sm.c @@ -275,19 +275,9 @@ void mme_state_operational(fsm_t *s, event_t *e) /* If NAS(mme_ue_t) has already been associated with * older S1(enb_ue_t) context */ - if (mme_ue->enb_ue) + if (ECM_CONNECTED(mme_ue)) { -#if SEND_UE_CTX_REL_CMD_IMMEDIATELY - /* Send UE context release command to - * older S1 context immediately. */ - d_trace(5, "OLD ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", - mme_ue->enb_ue->enb_ue_s1ap_id, - mme_ue->enb_ue->mme_ue_s1ap_id); - rv = s1ap_send_ue_context_release_command(mme_ue->enb_ue, - S1ap_Cause_PR_nas, S1ap_CauseNas_normal_release, - S1AP_UE_CTX_REL_NO_ACTION, 0); - d_assert(rv == CORE_OK, return, "s1ap send error"); -#elif IMPLICIT_S1_RELEASE +#if IMPLICIT_S1_RELEASE /* Implcit S1 release */ d_warn("Implicit S1 release"); d_warn(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", diff --git a/src/mme/s1ap_handler.c b/src/mme/s1ap_handler.c index bcdfc262b..ead0fcc5e 100644 --- a/src/mme/s1ap_handler.c +++ b/src/mme/s1ap_handler.c @@ -161,19 +161,9 @@ void s1ap_handle_initial_ue_message(mme_enb_t *enb, s1ap_message_t *message) /* If NAS(mme_ue_t) has already been associated with * older S1(enb_ue_t) context */ - if (mme_ue->enb_ue) + if (ECM_CONNECTED(mme_ue)) { -#if SEND_UE_CTX_REL_CMD_IMMEDIATELY - /* Send UE context release command to - * older S1 context immediately. */ - d_trace(5, "OLD ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n", - mme_ue->enb_ue->enb_ue_s1ap_id, - mme_ue->enb_ue->mme_ue_s1ap_id); - rv = s1ap_send_ue_context_release_command(mme_ue->enb_ue, - S1ap_Cause_PR_nas, S1ap_CauseNas_normal_release, - S1AP_UE_CTX_REL_NO_ACTION, 0); - d_assert(rv == CORE_OK, return, "s1ap send error"); -#elif IMPLICIT_S1_RELEASE +#if IMPLICIT_S1_RELEASE /* Implcit S1 release */ d_warn("Implicit S1 release"); d_warn(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]", @@ -563,7 +553,6 @@ void s1ap_handle_ue_context_release_request( enb_ue = enb_ue_find_by_mme_ue_s1ap_id(ies->mme_ue_s1ap_id); if (!enb_ue) { - d_assert(0,,); d_warn("No ENB UE Context : MME_UE_S1AP_ID[%d]", ies->mme_ue_s1ap_id); rv = s1ap_send_error_indication(enb, S1AP_ERRORINDICATIONIES_MME_UE_S1AP_ID_PRESENT | diff --git a/test/attach_test.c b/test/attach_test.c index 5f93512a9..5c219b46f 100644 --- a/test/attach_test.c +++ b/test/attach_test.c @@ -322,6 +322,12 @@ static void attach_test1(abts_case *tc, void *data) rv = tests1ap_enb_send(sock, sendbuf); ABTS_INT_EQUAL(tc, CORE_OK, rv); + /* Receive Error Indicaation */ + recvbuf = pkbuf_alloc(0, MAX_SDU_LEN); + rv = tests1ap_enb_read(sock, recvbuf); + ABTS_INT_EQUAL(tc, CORE_OK, rv); + pkbuf_free(recvbuf); + #else /* S1_HOLDING_TIMER */ /* Send UE Context Release Request */ rv = tests1ap_build_ue_context_release_request(&sendbuf, msgindex);