Quick and dirty hack to not send activate default eps bearer when a service request is received.

master
Pedro Alvarez 7 years ago
parent 669ef9816f
commit d301d7599f

@ -48,8 +48,8 @@ public:
bool init(srslte::log_filter *mme_gtpc_log);
uint32_t get_new_ctrl_teid();
void send_create_session_request(uint64_t imsi, uint32_t mme_s1ap_id);
void handle_create_session_response(srslte::gtpc_pdu *cs_resp_pdu);
void send_create_session_request(uint64_t imsi, uint32_t mme_s1ap_id, bool pack_attach);
void handle_create_session_response(srslte::gtpc_pdu *cs_resp_pdu, bool pack_attach);
void send_modify_bearer_request(erab_ctx_t *bearer_ctx);
void handle_modify_bearer_response(srslte::gtpc_pdu *mb_resp_pdu);
void send_delete_session_request(ue_ecm_ctx_t *ue_ecm_ctx);

@ -48,7 +48,7 @@ public:
void init(void);
//bool send_initial_context_setup_request(uint32_t mme_ue_s1ap_id, struct srslte::gtpc_create_session_response *cs_resp, struct srslte::gtpc_f_teid_ie sgw_ctrl_fteid);
bool send_initial_context_setup_request(ue_emm_ctx_t *emm_ctx, ue_ecm_ctx_t *ecm_ctx, erab_ctx_t *erab_ctx);
bool send_initial_context_setup_request(ue_emm_ctx_t *emm_ctx, ue_ecm_ctx_t *ecm_ctx, erab_ctx_t *erab_ctx, bool pack_attach);
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(ue_ecm_ctx_t *ecm_ctx, srslte::byte_buffer_t *reply_buffer);

@ -73,7 +73,7 @@ public:
void stop();
void run_thread();
void handle_create_session_request(struct srslte::gtpc_create_session_request *cs_req, struct srslte::gtpc_pdu *cs_resp_pdu);
void handle_create_session_request(struct srslte::gtpc_create_session_request *cs_req, struct srslte::gtpc_pdu *cs_resp_pdu,bool pack_attach);
void handle_modify_bearer_request(struct srslte::gtpc_pdu *mb_req_pdu, struct srslte::gtpc_pdu *mb_resp_pdu);
void handle_delete_session_request(struct srslte::gtpc_pdu *del_req_pdu, struct srslte::gtpc_pdu *del_resp_pdu);

@ -88,7 +88,7 @@ mme_gtpc::get_new_ctrl_teid()
return m_next_ctrl_teid++; //FIXME Use a Id pool?
}
void
mme_gtpc::send_create_session_request(uint64_t imsi, uint32_t mme_ue_s1ap_id)
mme_gtpc::send_create_session_request(uint64_t imsi, uint32_t mme_ue_s1ap_id, bool pack_attach)
{
m_mme_gtpc_log->info("Sending Create Session Request.\n");
m_mme_gtpc_log->console("Sending Create Session Request.\n");
@ -125,12 +125,12 @@ mme_gtpc::send_create_session_request(uint64_t imsi, uint32_t mme_ue_s1ap_id)
//Save RX Control TEID
m_teid_to_mme_s1ap_id.insert(std::pair<uint32_t,uint32_t>(cs_req->sender_f_teid.teid, mme_ue_s1ap_id));
m_spgw->handle_create_session_request(cs_req, &cs_resp_pdu);
m_spgw->handle_create_session_request(cs_req, &cs_resp_pdu, pack_attach);
}
void
mme_gtpc::handle_create_session_response(srslte::gtpc_pdu *cs_resp_pdu)
mme_gtpc::handle_create_session_response(srslte::gtpc_pdu *cs_resp_pdu, bool pack_attach)
{
struct srslte::gtpc_create_session_response *cs_resp = & cs_resp_pdu->choice.create_session_response;
m_mme_gtpc_log->info("Received Create Session Response\n");
@ -206,7 +206,7 @@ mme_gtpc::handle_create_session_response(srslte::gtpc_pdu *cs_resp_pdu)
erab_ctx->sgw_ctrl_fteid = sgw_ctrl_fteid;
erab_ctx->sgw_s1u_fteid = cs_resp->eps_bearer_context_created.s1_u_sgw_f_teid;
m_s1ap->m_s1ap_ctx_mngmt_proc->send_initial_context_setup_request(emm_ctx, ecm_ctx, erab_ctx);
m_s1ap->m_s1ap_ctx_mngmt_proc->send_initial_context_setup_request(emm_ctx, ecm_ctx, erab_ctx, pack_attach);
}

@ -79,8 +79,10 @@ s1ap_ctx_mngmt_proc::init(void)
bool
s1ap_ctx_mngmt_proc::send_initial_context_setup_request(ue_emm_ctx_t *emm_ctx,
ue_ecm_ctx_t *ecm_ctx,
erab_ctx_t *erab_ctx)
erab_ctx_t *erab_ctx,
bool pack_attach)
{
int s1mme = m_s1ap->get_s1_mme();
//Prepare reply PDU
@ -159,16 +161,21 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(ue_emm_ctx_t *emm_ctx,
m_s1ap_log->info_hex(emm_ctx->security_ctxt.k_enb, 32, "Initial Context Setup Request -- Key eNB\n");
srslte::byte_buffer_t *nas_buffer = m_pool->allocate();
m_s1ap_nas_transport->pack_attach_accept(emm_ctx, ecm_ctx, erab_ctx_req, &erab_ctx->pdn_addr_alloc, nas_buffer);
if(pack_attach)
{
pack_attach = false;
m_s1ap_nas_transport->pack_attach_accept(emm_ctx, ecm_ctx, erab_ctx_req, &erab_ctx->pdn_addr_alloc, nas_buffer);
}
LIBLTE_ERROR_ENUM err = liblte_s1ap_pack_s1ap_pdu(&pdu, (LIBLTE_BYTE_MSG_STRUCT*)reply_buffer);
if(err != LIBLTE_SUCCESS)
{
m_s1ap_log->error("Could not pack Initial Context Setup Request Message\n");
return false;
}
//Send Reply to eNB
//Send Reply to eNB
ssize_t n_sent = sctp_send(s1mme,reply_buffer->msg, reply_buffer->N_bytes, &ecm_ctx->enb_sri, 0);
if(n_sent == -1)
{

@ -578,7 +578,7 @@ s1ap_nas_transport::handle_nas_guti_attach_request( uint32_t enb_ue_s1ap_id,
m_s1ap->add_new_ue_ecm_ctx(ue_ecm_ctx);
//Create session request
m_s1ap_log->console("GUTI Attach -- NAS Integrity OK.");
m_mme_gtpc->send_create_session_request(ue_emm_ctx->imsi, ue_emm_ctx->mme_ue_s1ap_id);
m_mme_gtpc->send_create_session_request(ue_emm_ctx->imsi, ue_emm_ctx->mme_ue_s1ap_id,true);
*reply_flag = false; //No reply needed
return true;
}
@ -652,7 +652,7 @@ s1ap_nas_transport::handle_nas_service_request(uint32_t m_tmsi,
m_s1ap_log->info("Service Request -- User has ECM context already\n");
m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(ecm_ctx,reply_buffer);
int default_bearer_id = 5;
m_s1ap->m_s1ap_ctx_mngmt_proc->send_initial_context_setup_request(ue_emm_ctx, ecm_ctx, &ecm_ctx->erabs_ctx[default_bearer_id]);
m_s1ap->m_s1ap_ctx_mngmt_proc->send_initial_context_setup_request(ue_emm_ctx, ecm_ctx, &ecm_ctx->erabs_ctx[default_bearer_id],false);
}
else
{
@ -685,7 +685,9 @@ s1ap_nas_transport::handle_nas_service_request(uint32_t m_tmsi,
//Re-generate K_eNB
liblte_security_generate_k_enb(ue_emm_ctx->security_ctxt.k_asme, ue_emm_ctx->security_ctxt.ul_nas_count, ue_emm_ctx->security_ctxt.k_enb);
m_s1ap_log->info("Generating KeNB with UL NAS COUNT: %d\n",ue_emm_ctx->security_ctxt.ul_nas_count);
m_mme_gtpc->send_create_session_request(ue_ecm_ctx.imsi, ue_ecm_ctx.mme_ue_s1ap_id);
m_mme_gtpc->send_create_session_request(ue_ecm_ctx.imsi, ue_ecm_ctx.mme_ue_s1ap_id,false);
// m_s1ap->m_s1ap_ctx_mngmt_proc->send_initial_context_setup_request(ue_);
}
}
else
@ -798,7 +800,7 @@ s1ap_nas_transport::handle_nas_security_mode_complete(srslte::byte_buffer_t *nas
{
//FIXME The packging of GTP-C messages is not ready.
//This means that GTP-U tunnels are created with function calls, as opposed to GTP-C.
m_mme_gtpc->send_create_session_request(ue_ecm_ctx->imsi, ue_ecm_ctx->mme_ue_s1ap_id);
m_mme_gtpc->send_create_session_request(ue_ecm_ctx->imsi, ue_ecm_ctx->mme_ue_s1ap_id,true);
*reply_flag = false; //No reply needed
}
return true;
@ -867,7 +869,7 @@ s1ap_nas_transport::handle_esm_information_response(srslte::byte_buffer_t *nas_m
//FIXME The packging of GTP-C messages is not ready.
//This means that GTP-U tunnels are created with function calls, as opposed to GTP-C.
m_mme_gtpc->send_create_session_request(ue_ecm_ctx->imsi, ue_ecm_ctx->mme_ue_s1ap_id);
m_mme_gtpc->send_create_session_request(ue_ecm_ctx->imsi, ue_ecm_ctx->mme_ue_s1ap_id,true);
return true;
}
@ -1577,12 +1579,12 @@ s1ap_nas_transport::pack_attach_accept(ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *u
//Set up LAI for combined EPS/IMSI attach
//attach_accept.lai_present=false;
attach_accept.lai_present=true;
attach_accept.lai_present=false;
attach_accept.lai.mcc = mcc;
attach_accept.lai.mnc = mnc;
attach_accept.lai.lac = 001;
attach_accept.ms_id_present=true;
attach_accept.ms_id_present=false;
attach_accept.ms_id.type_of_id = LIBLTE_MME_MOBILE_ID_TYPE_TMSI;
attach_accept.ms_id.tmsi = attach_accept.guti.guti.m_tmsi;

@ -437,7 +437,7 @@ spgw::get_new_ue_ipv4()
}
void
spgw::handle_create_session_request(struct srslte::gtpc_create_session_request *cs_req, struct srslte::gtpc_pdu *cs_resp_pdu)
spgw::handle_create_session_request(struct srslte::gtpc_create_session_request *cs_req, struct srslte::gtpc_pdu *cs_resp_pdu, bool pack_attach)
{
srslte::gtpc_header *header = &cs_resp_pdu->header;
srslte::gtpc_create_session_response *cs_resp = &cs_resp_pdu->choice.create_session_response;
@ -492,7 +492,7 @@ spgw::handle_create_session_request(struct srslte::gtpc_create_session_request *
cs_resp->paa.ipv4_present = true;
cs_resp->paa.ipv4 = ue_ip;
m_spgw_log->info("Sending Create Session Response\n");
m_mme_gtpc->handle_create_session_response(cs_resp_pdu);
m_mme_gtpc->handle_create_session_response(cs_resp_pdu, pack_attach );
return;
}

Loading…
Cancel
Save