forked from acouzens/open5gs
Error Indication is added
This commit is contained in:
parent
f37b3cbfd3
commit
831b3e8985
|
@ -56,6 +56,9 @@ static inline int s1ap_encode_handover_preparation_failure(
|
|||
static inline int s1ap_encode_mme_status_transfer(
|
||||
s1ap_message_t *message_p, pkbuf_t *pkbuf);
|
||||
|
||||
static inline int s1ap_encode_error_indication(
|
||||
s1ap_message_t *message_p, pkbuf_t *pkbuf);
|
||||
|
||||
static void s1ap_encode_xer_print_message(
|
||||
asn_enc_rval_t (*func)(asn_app_consume_bytes_f *cb,
|
||||
void *app_key, s1ap_message_t *message_p),
|
||||
|
@ -182,6 +185,12 @@ static inline int s1ap_encode_initiating_message(
|
|||
ret = s1ap_encode_mme_status_transfer(message_p, pkbuf);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_ErrorIndication:
|
||||
s1ap_encode_xer_print_message(s1ap_xer_print_s1ap_errorindication,
|
||||
s1ap_xer__print2sp, message_p);
|
||||
ret = s1ap_encode_error_indication(message_p, pkbuf);
|
||||
break;
|
||||
|
||||
default:
|
||||
d_warn("Unknown procedure ID (%d) for initiating message_p\n",
|
||||
(int)message_p->procedureCode);
|
||||
|
@ -1079,6 +1088,43 @@ static inline int s1ap_encode_mme_status_transfer(
|
|||
return enc_ret.encoded;
|
||||
}
|
||||
|
||||
static inline int s1ap_encode_error_indication(
|
||||
s1ap_message_t *message_p, pkbuf_t *pkbuf)
|
||||
{
|
||||
asn_enc_rval_t enc_ret = {0};
|
||||
|
||||
S1AP_PDU_t pdu;
|
||||
S1ap_ErrorIndication_t error;
|
||||
asn_TYPE_descriptor_t *td = &asn_DEF_S1ap_ErrorIndication;
|
||||
|
||||
memset(&error, 0, sizeof(S1ap_ErrorIndication_t));
|
||||
if (s1ap_encode_s1ap_errorindicationies(
|
||||
&error, &message_p->s1ap_ErrorIndicationIEs) < 0)
|
||||
{
|
||||
d_error("Encoding of %s failed", td->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(&pdu, 0, sizeof (S1AP_PDU_t));
|
||||
pdu.present = S1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage.procedureCode = message_p->procedureCode;
|
||||
pdu.choice.initiatingMessage.criticality = S1ap_Criticality_ignore;
|
||||
ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, &error);
|
||||
|
||||
enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU,
|
||||
&pdu, pkbuf->payload, MAX_SDU_LEN);
|
||||
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &error);
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu);
|
||||
|
||||
if (enc_ret.encoded < 0)
|
||||
{
|
||||
d_error("Encoding of %s failed", td->name);
|
||||
}
|
||||
|
||||
return enc_ret.encoded;
|
||||
}
|
||||
|
||||
static void s1ap_encode_xer_print_message(
|
||||
asn_enc_rval_t (*func)(asn_app_consume_bytes_f *cb,
|
||||
void *app_key, s1ap_message_t *message_p),
|
||||
|
|
|
@ -375,10 +375,10 @@ status_t emm_handle_tau_request(
|
|||
|
||||
if (mme_ue->nas_eps.update.active_flag)
|
||||
d_trace(5, " Active flag[UPD:0x%x]\n",
|
||||
mme_ue->nas_eps.update.active_flag);
|
||||
mme_ue->nas_eps.update);
|
||||
else
|
||||
d_trace(5, " No Active flag[UPD:0x%x]\n",
|
||||
mme_ue->nas_eps.update.active_flag);
|
||||
mme_ue->nas_eps.update);
|
||||
|
||||
d_trace(5, " OLD TAI[PLMN_ID:0x%x,TAC:%d]\n",
|
||||
mme_ue->tai.plmn_id, mme_ue->tai.tac);
|
||||
|
|
|
@ -398,21 +398,15 @@ status_t nas_send_tau_accept(mme_ue_t *mme_ue)
|
|||
|
||||
d_trace(3, "[EMM] Tracking area update accept\n");
|
||||
d_trace(5, " IMSI[%s]\n", mme_ue->imsi_bcd);
|
||||
|
||||
if (ECM_CONNECTED(mme_ue))
|
||||
{
|
||||
d_trace(5, " ECM-Connected\n");
|
||||
bearer_establishment_requested = 1;
|
||||
}
|
||||
else
|
||||
d_trace(5, " ECM-Idle\n");
|
||||
|
||||
if (mme_ue->nas_eps.update.active_flag)
|
||||
{
|
||||
d_trace(5, " Active flag\n");
|
||||
bearer_establishment_requested = 1;
|
||||
}
|
||||
else
|
||||
d_trace(5, " No Active flag\n");
|
||||
|
||||
d_trace(5, " Bearer Establiashment Requested[%d]\n",
|
||||
bearer_establishment_requested);
|
||||
|
||||
rv = emm_build_tau_accept(&emmbuf, mme_ue);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "emm build error");
|
||||
|
|
|
@ -1108,3 +1108,41 @@ status_t s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf,
|
|||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s1ap_build_error_indication(
|
||||
pkbuf_t **s1apbuf, c_uint16_t presenceMask,
|
||||
c_uint32_t enb_ue_s1ap_id, c_uint32_t mme_ue_s1ap_id,
|
||||
S1ap_Cause_PR group, long cause)
|
||||
{
|
||||
int encoded;
|
||||
s1ap_message_t message;
|
||||
S1ap_ErrorIndicationIEs_t *ies = &message.s1ap_ErrorIndicationIEs;
|
||||
|
||||
d_assert(presenceMask, return CORE_ERROR,
|
||||
"Invalid PresenceMask[0x%x]", presenceMask);
|
||||
|
||||
d_trace(3, "[MME] Error Indication\n");
|
||||
|
||||
memset(&message, 0, sizeof(s1ap_message_t));
|
||||
|
||||
ies->presenceMask = presenceMask;
|
||||
ies->mme_ue_s1ap_id = mme_ue_s1ap_id;
|
||||
ies->eNB_UE_S1AP_ID = enb_ue_s1ap_id;
|
||||
ies->cause.present = group;
|
||||
ies->cause.choice.radioNetwork = cause;
|
||||
|
||||
d_trace(5, " PresenceMask[0x%x]\n", presenceMask);
|
||||
d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n",
|
||||
enb_ue_s1ap_id, mme_ue_s1ap_id);
|
||||
d_trace(5, " Group[%d] Cause[%d]\n", group, cause);
|
||||
|
||||
message.procedureCode = S1ap_ProcedureCode_id_ErrorIndication;
|
||||
message.direction = S1AP_PDU_PR_initiatingMessage;
|
||||
|
||||
encoded = s1ap_encode_pdu(s1apbuf, &message);
|
||||
s1ap_free_pdu(&message);
|
||||
|
||||
d_assert(s1apbuf && encoded >= 0,return CORE_ERROR,);
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,11 @@ CORE_DECLARE(status_t) s1ap_build_handover_cancel_ack(
|
|||
CORE_DECLARE(status_t) s1ap_build_mme_status_transfer(pkbuf_t **s1apbuf,
|
||||
enb_ue_t *target_ue, S1ap_ENBStatusTransferIEs_t *enb_ies);
|
||||
|
||||
CORE_DECLARE(status_t) s1ap_build_error_indication(
|
||||
pkbuf_t **s1apbuf, c_uint16_t presenceMask,
|
||||
c_uint32_t enb_ue_s1ap_id, c_uint32_t mme_ue_s1ap_id,
|
||||
S1ap_Cause_PR group, long cause);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -548,16 +548,32 @@ void s1ap_handle_ue_context_release_request(
|
|||
|
||||
S1ap_UEContextReleaseRequest_IEs_t *ies = NULL;
|
||||
|
||||
d_assert(enb, return,);
|
||||
d_assert(message, return,);
|
||||
|
||||
ies = &message->s1ap_UEContextReleaseRequest_IEs;
|
||||
d_assert(ies, return, "Null param");
|
||||
d_assert(ies, return,);
|
||||
|
||||
d_trace(3, "[MME] UE Context release request\n");
|
||||
d_trace(5, " IP[%s] ENB_ID[%d]\n",
|
||||
CORE_ADDR(enb->addr, buf), enb->enb_id);
|
||||
|
||||
enb_ue = enb_ue_find_by_mme_ue_s1ap_id(ies->mme_ue_s1ap_id);
|
||||
d_assert(enb_ue, return, "No ENB UE Context : MME_UE_S1AP_ID[%d]",
|
||||
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 |
|
||||
S1AP_ERRORINDICATIONIES_ENB_UE_S1AP_ID_PRESENT |
|
||||
S1AP_ERRORINDICATIONIES_CAUSE_PRESENT,
|
||||
ies->eNB_UE_S1AP_ID,
|
||||
ies->mme_ue_s1ap_id,
|
||||
S1ap_Cause_PR_radioNetwork,
|
||||
S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
|
||||
d_assert(rv == CORE_OK, return, "s1ap send error");
|
||||
return;
|
||||
}
|
||||
|
||||
d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
|
|
@ -452,3 +452,23 @@ status_t s1ap_send_mme_status_transfer(
|
|||
|
||||
return rv;
|
||||
}
|
||||
|
||||
status_t s1ap_send_error_indication(
|
||||
mme_enb_t *enb, c_uint16_t presenceMask,
|
||||
c_uint32_t enb_ue_s1ap_id, c_uint32_t mme_ue_s1ap_id,
|
||||
S1ap_Cause_PR group, long cause)
|
||||
{
|
||||
status_t rv;
|
||||
pkbuf_t *s1apbuf = NULL;
|
||||
|
||||
d_assert(enb, return CORE_ERROR,);
|
||||
|
||||
rv = s1ap_build_error_indication(&s1apbuf,
|
||||
presenceMask, enb_ue_s1ap_id, mme_ue_s1ap_id, group, cause);
|
||||
d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error");
|
||||
|
||||
rv = s1ap_send_to_enb(enb, s1apbuf);
|
||||
d_assert(rv == CORE_OK,, "s1ap send error");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,10 @@ CORE_DECLARE(status_t) s1ap_send_handover_cancel_ack(enb_ue_t *source_ue);
|
|||
|
||||
CORE_DECLARE(status_t) s1ap_send_mme_status_transfer(
|
||||
enb_ue_t *target_ue, S1ap_ENBStatusTransferIEs_t *ies);
|
||||
CORE_DECLARE(status_t) s1ap_send_error_indication(
|
||||
mme_enb_t *enb, c_uint16_t presenceMask,
|
||||
c_uint32_t enb_ue_s1ap_id, c_uint32_t mme_ue_s1ap_id,
|
||||
S1ap_Cause_PR group, long cause);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -315,7 +315,14 @@ static void attach_test1(abts_case *tc, void *data)
|
|||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
pkbuf_free(recvbuf);
|
||||
|
||||
#if 1 /* S1_HOLDING_TIMER */
|
||||
#if IMPLICIT_S1_RELEASE
|
||||
/* Send UE Context Release Request */
|
||||
rv = tests1ap_build_ue_context_release_request(&sendbuf, msgindex);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
rv = tests1ap_enb_send(sock, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
||||
#else /* S1_HOLDING_TIMER */
|
||||
/* Send UE Context Release Request */
|
||||
rv = tests1ap_build_ue_context_release_request(&sendbuf, msgindex);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
|
Loading…
Reference in New Issue