Changing pack accept

master
Pedro Alvarez 6 years ago
parent 3663d59920
commit c1eff4ce73

@ -188,11 +188,11 @@ public:
bool integrity_check( emm_ctx_t *emm_ctx, srslte::byte_buffer_t *pdu);
bool short_integrity_check( emm_ctx_t *emm_ctx, srslte::byte_buffer_t *pdu);
private:
/* UE Context*/
emm_ctx_t m_emm_ctx;
ecm_ctx_t m_ecm_ctx;
esm_ctx_t m_esm_ctx[MAX_ERABS_PER_UE];
sec_ctx_t sec_ctx;
sec_ctx_t m_sec_ctx;
};
}//namespace

@ -47,7 +47,7 @@ public:
void init(void);
bool send_initial_context_setup_request(nas *nas_ctx);
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);

@ -114,7 +114,7 @@ nas::handle_nas_imsi_attach_request(uint32_t enb_ue_s1ap_id,
imsi += attach_req.eps_mobile_id.imsi[i]*std::pow(10,14-i);
}
//Check if UE is
//Check if UE is already atached
ue_ctx_t *old_ctx = m_s1ap->find_ue_ctx_from_imsi(imsi);
if(old_ctx!=NULL)
{
@ -227,7 +227,7 @@ nas::handle_nas_imsi_attach_request(uint32_t enb_ue_s1ap_id,
}
bool
s1ap_nas_transport::handle_nas_guti_attach_request( uint32_t enb_ue_s1ap_id,
nas::handle_nas_guti_attach_request( uint32_t enb_ue_s1ap_id,
const LIBLTE_MME_ATTACH_REQUEST_MSG_STRUCT &attach_req,
const LIBLTE_MME_PDN_CONNECTIVITY_REQUEST_MSG_STRUCT &pdn_con_req,
srslte::byte_buffer_t *nas_msg,
@ -1378,7 +1378,7 @@ nas::pack_security_mode_command(srslte::byte_buffer_t *reply_msg, ue_emm_ctx_t *
}
bool
s1ap_nas_transport::pack_esm_information_request(srslte::byte_buffer_t *reply_msg, ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *ue_ecm_ctx)
nas::pack_esm_information_request(srslte::byte_buffer_t *reply_msg, ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *ue_ecm_ctx)
{
srslte::byte_buffer_t *nas_buffer = m_pool->allocate();
@ -1409,8 +1409,7 @@ s1ap_nas_transport::pack_esm_information_request(srslte::byte_buffer_t *reply_ms
ue_emm_ctx->security_ctxt.dl_nas_count++;
LIBLTE_ERROR_ENUM err = srslte_mme_pack_esm_information_request_msg(&esm_info_req, sec_hdr_type,ue_emm_ctx->security_ctxt.dl_nas_count,(LIBLTE_BYTE_MSG_STRUCT *) nas_buffer);
if(err != LIBLTE_SUCCESS)
{
if (err != LIBLTE_SUCCESS) {
m_s1ap_log->error("Error packing ESM information request\n");
m_s1ap_log->console("Error packing ESM information request\n");
return false;
@ -1446,12 +1445,11 @@ s1ap_nas_transport::pack_esm_information_request(srslte::byte_buffer_t *reply_ms
}
bool
s1ap_nas_transport::pack_attach_accept(ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *ue_ecm_ctx, LIBLTE_S1AP_E_RABTOBESETUPITEMCTXTSUREQ_STRUCT *erab_ctxt, struct srslte::gtpc_pdn_address_allocation_ie *paa, srslte::byte_buffer_t *nas_buffer) {
nas::pack_attach_accept(LIBLTE_S1AP_E_RABTOBESETUPITEMCTXTSUREQ_STRUCT *erab_ctxt, struct srslte::gtpc_pdn_address_allocation_ie *paa, srslte::byte_buffer_t *nas_buffer)
{
m_nas_log->info("Packing Attach Accept\n");
LIBLTE_MME_ATTACH_ACCEPT_MSG_STRUCT attach_accept;
LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT act_def_eps_bearer_context_req;
//bzero(&act_def_eps_bearer_context_req,sizeof(LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT));
m_s1ap_log->info("Packing Attach Accept\n");
//Get decimal MCC and MNC
uint32_t mcc = 0;

@ -79,7 +79,7 @@ s1ap_ctx_mngmt_proc::init(void)
}
bool
s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas *nas_ctx)
s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas *nas_ctx, uint16_t erab_to_setup)
{
//Prepare reply PDU
LIBLTE_S1AP_S1AP_PDU_STRUCT pdu;
@ -93,6 +93,12 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas *nas_ctx)
LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPREQUEST_STRUCT *in_ctxt_req = &init->choice.InitialContextSetupRequest;
m_s1ap_log->info("Preparing to send Initial Context Setup request\n");
//Get UE Context/E-RAB Context to setup
emm_ctx_t *emm_ctx = &nas_ctx->m_emm_ctx;
ecm_ctx_t *ecm_ctx = &nas_ctx->m_ecm_ctx;
esm_ctx_t *esm_ctx = &nas_ctx->m_esm_ctx[erab_to_setup];
sec_ctx_t *sec_ctx = &nas_ctx->m_sec_ctx;
//Add MME and eNB S1AP Ids
in_ctxt_req->MME_UE_S1AP_ID.MME_UE_S1AP_ID = ecm_ctx->mme_ue_s1ap_id;
in_ctxt_req->eNB_UE_S1AP_ID.ENB_UE_S1AP_ID = ecm_ctx->enb_ue_s1ap_id;
@ -148,7 +154,7 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas *nas_ctx)
//Attach procedure initiated from an attach request
m_s1ap_log->console("Adding attach accept to Initial Context Setup Request\n");
m_s1ap_log->info("Adding attach accept to Initial Context Setup Request\n");
nas_ctx->pack_attach_accept(emm_ctx, ecm_ctx, erab_ctx_req, &erab_ctx->pdn_addr_alloc, nas_buffer);
nas_ctx->pack_attach_accept(emm_ctx, ecm_ctx, erab_ctx_req, &esm_ctx->pdn_addr_alloc, nas_buffer);
}
srslte::byte_buffer_t *reply_buffer = m_pool->allocate();
@ -163,7 +169,7 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas *nas_ctx)
}
//Change E-RAB state to Context Setup Requested and save S-GW control F-TEID
ecm_ctx->erabs_ctx[erab_ctx_req->e_RAB_ID.E_RAB_ID].state = ERAB_CTX_REQUESTED;
esm_ctx->state = ERAB_CTX_REQUESTED;
struct in_addr addr;
addr.s_addr = htonl(sgw_s1u_ip);

Loading…
Cancel
Save