Fixed up release ue ctx command.

master
Pedro Alvarez 6 years ago
parent f350fa5ec0
commit 6ef3124fc9

@ -109,6 +109,7 @@ public:
//Interfaces
virtual bool send_initial_context_setup_request(uint64_t imsi, uint16_t erab_to_setup);
virtual bool send_ue_context_release_command(uint32_t mme_ue_s1ap_id);
private:
s1ap();

@ -50,7 +50,7 @@ public:
bool send_initial_context_setup_request(nas *nas_ctx, uint16_t erab_to_setup);
bool handle_initial_context_setup_response(LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPRESPONSE_STRUCT *in_ctxt_resp);
bool handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECONTEXTRELEASEREQUEST_STRUCT *ue_rel, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
bool send_ue_context_release_command(ecm_ctx_t *ecm_ctx, srslte::byte_buffer_t *reply_buffer);
bool send_ue_context_release_command(nas *nas_ctx);
bool handle_ue_context_release_complete(LIBLTE_S1AP_MESSAGE_UECONTEXTRELEASECOMPLETE_STRUCT *rel_comp);
private:

@ -127,7 +127,7 @@ nas::handle_nas_authentication_response(srslte::byte_buffer_t *nas_msg, srslte::
}
bool
nas::handle_nas_security_mode_complete(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool *reply_flag)
nas::handle_nas_security_mode_complete(srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *reply_buffer, bool *reply_flag)
{
ue_emm_ctx_t *emm_ctx = &ue_ctx->emm_ctx;

@ -52,7 +52,6 @@ s1ap::~s1ap()
s1ap*
s1ap::get_instance(void)
{
pthread_mutex_lock(&s1ap_instance_mutex);
if(m_instance == NULL) {
m_instance = new s1ap();
@ -611,12 +610,12 @@ s1ap::print_enb_ctx_info(const std::string &prefix, const enb_ctx_t &enb_ctx)
/*
* Interfaces
*/
// GTP-C || NAS -> S1AP interface
/*GTP-C||NAS -> S1AP interface*/
bool
s1ap::send_initial_context_setup_request(uint64_t imsi, uint16_t erab_to_setup)
{
nas* nas_ctx = find_nas_ctx_from_imsi(imsi);
if (nas_ctx==NULL) {
if (nas_ctx == NULL) {
m_s1ap_log->error("Error finding NAS context when sending initial context Setup Request\n");
return false;
}
@ -624,5 +623,17 @@ s1ap::send_initial_context_setup_request(uint64_t imsi, uint16_t erab_to_setup)
return true;
}
} //namespace srsepc
/*NAS -> S1AP interface*/
bool
s1ap::send_ue_context_release_command(uint32_t mme_ue_s1ap_id)
{
nas* nas_ctx = find_nas_ctx_from_mme_ue_s1ap_id(mme_ue_s1ap_id);
if (nas_ctx == NULL) {
m_s1ap_log->error("Error finding NAS context when sending UE Context Setup Release\n");
return false;
}
m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(nas_ctx);
return true;
}
} //namespace srsepc

@ -268,7 +268,7 @@ s1ap_ctx_mngmt_proc::handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECON
m_mme_gtpc->send_release_access_bearers_request(emm_ctx->imsi);
//Send release context command to enb, so that it can release it's bearers
send_ue_context_release_command(ecm_ctx,reply_buffer);
send_ue_context_release_command(nas_ctx);
} else {
//No ECM Context to release
m_s1ap_log->info("UE is not ECM connected. No need to release S1-U. MME UE S1AP Id %d\n", mme_ue_s1ap_id);
@ -289,9 +289,10 @@ s1ap_ctx_mngmt_proc::handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECON
}
bool
s1ap_ctx_mngmt_proc::send_ue_context_release_command(ecm_ctx_t *ecm_ctx, srslte::byte_buffer_t *reply_buffer)
s1ap_ctx_mngmt_proc::send_ue_context_release_command(nas *nas_ctx)
{
//Prepare reply PDU
srslte::byte_buffer_t *reply_buffer;
LIBLTE_S1AP_S1AP_PDU_STRUCT pdu;
bzero(&pdu, sizeof(LIBLTE_S1AP_S1AP_PDU_STRUCT));
pdu.choice_type = LIBLTE_S1AP_S1AP_PDU_CHOICE_INITIATINGMESSAGE;
@ -302,8 +303,8 @@ s1ap_ctx_mngmt_proc::send_ue_context_release_command(ecm_ctx_t *ecm_ctx, srslte:
LIBLTE_S1AP_MESSAGE_UECONTEXTRELEASECOMMAND_STRUCT *ctx_rel_cmd = &init->choice.UEContextReleaseCommand;
ctx_rel_cmd->UE_S1AP_IDs.choice_type = LIBLTE_S1AP_UE_S1AP_IDS_CHOICE_UE_S1AP_ID_PAIR;
ctx_rel_cmd->UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID.MME_UE_S1AP_ID = ecm_ctx->mme_ue_s1ap_id;
ctx_rel_cmd->UE_S1AP_IDs.choice.uE_S1AP_ID_pair.eNB_UE_S1AP_ID.ENB_UE_S1AP_ID = ecm_ctx->enb_ue_s1ap_id;
ctx_rel_cmd->UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID.MME_UE_S1AP_ID = nas_ctx->m_ecm_ctx.mme_ue_s1ap_id;
ctx_rel_cmd->UE_S1AP_IDs.choice.uE_S1AP_ID_pair.eNB_UE_S1AP_ID.ENB_UE_S1AP_ID = nas_ctx->m_ecm_ctx.enb_ue_s1ap_id;
ctx_rel_cmd->Cause.choice_type = LIBLTE_S1AP_CAUSE_CHOICE_NAS;
ctx_rel_cmd->Cause.choice.nas.ext = false;
@ -316,7 +317,7 @@ s1ap_ctx_mngmt_proc::send_ue_context_release_command(ecm_ctx_t *ecm_ctx, srslte:
}
//Send Reply to eNB
if(!m_s1ap->s1ap_tx_pdu(reply_buffer,&ecm_ctx->enb_sri)){
if(!m_s1ap->s1ap_tx_pdu(reply_buffer,&nas_ctx->m_ecm_ctx.enb_sri)){
m_s1ap_log->error("Error sending UE Context Release command.\n");
return false;
}

@ -412,7 +412,7 @@ s1ap_nas_transport::handle_nas_imsi_attach_request(uint32_t enb_ue_s1ap_id,
//Detaching previoulsy attached UE.
m_mme_gtpc->send_delete_session_request(imsi);
if (old_ctx->m_ecm_ctx.mme_ue_s1ap_id!=0) {
m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(&old_ctx->m_ecm_ctx, reply_buffer);
m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(old_ctx);
}
m_s1ap->delete_ue_ctx(imsi);
}
@ -687,7 +687,7 @@ s1ap_nas_transport::handle_nas_guti_attach_request( uint32_t enb_ue_s1ap_id,
//Detaching previoulsy attached UE.
m_mme_gtpc->send_delete_session_request(emm_ctx->imsi);
if (ecm_ctx->mme_ue_s1ap_id!=0) {
m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(ecm_ctx, reply_buffer);
m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(nas_ctx);
}
}
sec_ctx->ul_nas_count = 0;
@ -808,7 +808,7 @@ s1ap_nas_transport::handle_nas_service_request(uint32_t m_tmsi,
//Release previous context
m_s1ap_log->info("Service Request -- Releasing previouse ECM context. eNB S1AP Id %d, MME UE S1AP Id %d\n", ecm_ctx->enb_ue_s1ap_id, ecm_ctx->mme_ue_s1ap_id);
m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(ecm_ctx,reply_buffer);
m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(nas_ctx);
m_s1ap->release_ue_ecm_ctx(ecm_ctx->mme_ue_s1ap_id);
}
@ -890,7 +890,7 @@ s1ap_nas_transport::handle_nas_detach_request(uint32_t m_tmsi,
//eNB created new ECM context to send the detach request; this needs to be cleared.
ecm_ctx->mme_ue_s1ap_id = m_s1ap->get_next_mme_ue_s1ap_id();
ecm_ctx->enb_ue_s1ap_id = enb_ue_s1ap_id;
m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(ecm_ctx, reply_buffer);
m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(nas_ctx);
return true;
}

Loading…
Cancel
Save