Starting to parse Modify Bearer Request at the S-GW.

master
Pedro Alvarez 7 years ago
parent 9f994dba04
commit 489865fa22

@ -56,11 +56,11 @@ typedef struct {
typedef struct { typedef struct {
uint64_t imsi; uint64_t imsi;
in_addr_t ue_ipv4; in_addr_t ue_ipv4;
struct srslte::gtpc_f_teid_ie uplink_ctrl; struct srslte::gtpc_f_teid_ie up_ctrl_fteid;
struct srslte::gtpc_f_teid_ie uplink_user; struct srslte::gtpc_f_teid_ie up_user_fteid;
struct srslte::gtpc_f_teid_ie downlink_ctrl; struct srslte::gtpc_f_teid_ie dw_ctrl_fteid;
struct srslte::gtpc_f_teid_ie downlink_user; struct srslte::gtpc_f_teid_ie dw_user_fteid;
} spgw_ue_ctxr; } spgw_ue_ctx;
class spgw: class spgw:
public thread public thread
@ -101,6 +101,9 @@ private:
uint64_t m_next_ctrl_teid; uint64_t m_next_ctrl_teid;
uint64_t m_next_user_teid; uint64_t m_next_user_teid;
std::map<uint32_t,spgw_ue_ctx*> m_teid_to_ue_ctx; //Map control TEID to ue_ctx. Usefull to get reply ctrl TEID
std::map<in_addr_t,gtpc_f_teid_ie> m_ip_to_teid; //Map IP to User-plane TEID for downlink traffic
/*Logs*/ /*Logs*/
srslte::log_filter *m_spgw_log; srslte::log_filter *m_spgw_log;

@ -167,7 +167,7 @@ void
mme_gtpc::send_modify_bearer_request(erab_ctx_t *erab_ctx) mme_gtpc::send_modify_bearer_request(erab_ctx_t *erab_ctx)
{ {
m_mme_gtpc_log->info("Sending GTP-C Modify bearer request\n"); m_mme_gtpc_log->info("Sending GTP-C Modify bearer request\n");
srslte::gtpc_pdu pdu; srslte::gtpc_pdu mb_req_pdu;
srslte::gtpc_f_teid_ie *enb_fteid = &erab_ctx->enb_fteid; srslte::gtpc_f_teid_ie *enb_fteid = &erab_ctx->enb_fteid;
srslte::gtpc_f_teid_ie *sgw_ctrl_fteid = &erab_ctx->sgw_ctrl_fteid; srslte::gtpc_f_teid_ie *sgw_ctrl_fteid = &erab_ctx->sgw_ctrl_fteid;
@ -176,14 +176,16 @@ mme_gtpc::send_modify_bearer_request(erab_ctx_t *erab_ctx)
header->teid = sgw_ctrl_fteid->teid; header->teid = sgw_ctrl_fteid->teid;
header->type = srslte::GTPC_MSG_TYPE_MODIFY_BEARER_REQUEST; header->type = srslte::GTPC_MSG_TYPE_MODIFY_BEARER_REQUEST;
srslte::gtpc_modify_bearer_request mb_req; srslte::gtpc_modify_bearer_request *mb_req = &mb_req_pdu.modify_bearer_request;
mb_req.eps_bearer_context_to_modify.ebi = erab_ctx->erab_id; mb_req->eps_bearer_context_to_modify.ebi = erab_ctx->erab_id;
mb_req.eps_bearer_context_to_modify.s1_u_enb_f_teid.ipv4 = enb_fteid->ipv4; mb_req->eps_bearer_context_to_modify.s1_u_enb_f_teid.ipv4 = enb_fteid->ipv4;
mb_req.eps_bearer_context_to_modify.s1_u_enb_f_teid.teid = enb_fteid->teid; mb_req->eps_bearer_context_to_modify.s1_u_enb_f_teid.teid = enb_fteid->teid;
m_mme_gtpc_log->info("GTP-C Modify bearer request -- S-GW Control TEID %d\n", sgw_ctrl_fteid->teid ); m_mme_gtpc_log->info("GTP-C Modify bearer request -- S-GW Control TEID %d\n", sgw_ctrl_fteid->teid );
m_mme_gtpc_log->info("GTP-C Modify bearer request -- S1-U TEID 0x%x\n", enb_fteid->teid ); m_mme_gtpc_log->info("GTP-C Modify bearer request -- S1-U TEID 0x%x\n", enb_fteid->teid );
//
srslte::gtpc_pdu mb_resp_pdu;
m_spgw->handle_modify_bearer_request(&mb_req_pdu,&mb_resp_pdu);
} }
} //namespace srsepc } //namespace srsepc

@ -315,13 +315,7 @@ spgw::handle_create_session_request(struct srslte::gtpc_create_session_request *
m_spgw_log->info("Received Create Session Request\n"); m_spgw_log->info("Received Create Session Request\n");
//Setup GTP-C header //Setup uplink control TEID
header->piggyback = false;
header->teid_present = true;
header->teid = cs_req->sender_f_teid.teid; //Send create session requesponse to the CS Request TEID
header->type = srslte::GTPC_MSG_TYPE_CREATE_SESSION_RESPONSE;
//Setup uplink control TEID
uint64_t spgw_uplink_ctrl_teid = get_new_ctrl_teid(); uint64_t spgw_uplink_ctrl_teid = get_new_ctrl_teid();
//Setup uplink user TEID //Setup uplink user TEID
uint64_t spgw_uplink_user_teid = get_new_user_teid(); uint64_t spgw_uplink_user_teid = get_new_user_teid();
@ -329,9 +323,19 @@ spgw::handle_create_session_request(struct srslte::gtpc_create_session_request *
in_addr_t ue_ip = get_new_ue_ipv4(); in_addr_t ue_ip = get_new_ue_ipv4();
//Save the UE IP to User TEID map //TODO!!! //Save the UE IP to User TEID map //TODO!!!
struct sgw_ue_ctx *ue_ctx = new sgw_ue_ctx;
sgw_ue_ctx->imsi = cs_req->imsi;
sgw_ue_ctx->ul_user_fteid.teid = spgw_uplink_user_teid;
sgw_ue_ctx->ul_ctrl_fteid = spgw_uplink_ctrl_teid;
sgw_ue_ctx->ue_ipv4 = ue_ip;
//Create session response message //Create session response message
//Initialize to zero\\ //Setup GTP-C header
header->piggyback = false;
header->teid_present = true;
header->teid = cs_req->sender_f_teid.teid; //Send create session requesponse to the CS Request TEID
header->type = srslte::GTPC_MSG_TYPE_CREATE_SESSION_RESPONSE;
//Initialize to zero
bzero(cs_resp,sizeof(struct srslte::gtpc_create_session_response)); bzero(cs_resp,sizeof(struct srslte::gtpc_create_session_response));
//Setup Cause //Setup Cause
cs_resp->cause.cause_value = srslte::GTPC_CAUSE_VALUE_REQUEST_ACCEPTED; cs_resp->cause.cause_value = srslte::GTPC_CAUSE_VALUE_REQUEST_ACCEPTED;
@ -354,6 +358,21 @@ spgw::handle_create_session_request(struct srslte::gtpc_create_session_request *
return; return;
} }
void
spgw::handle_modify_bearer_request(struct srslte::gtpc_pdu *mb_req_pdu, struct srslte::gtpc_pdu *mb_resp_pdu)
{
m_spgw_log->info("Received Modified Bearer Request\n");
//Get control tunnel info from
//Setting up Modify bearer request PDU
//Header
srslte::gtpc_header *header = &mb_req_pdu->header;
header->piggyback = false;
header->teid_present = true;
header->teid = ; //
header->type = srslte::GTPC_MSG_TYPE_MODIFY_BEARER_RESPONSE;
//PDU
srslte::gtpc_modify_bearer_response *mb_resp = mb_req_pdu.choice.modify_bearer_response;
}
} //namespace srsepc } //namespace srsepc

Loading…
Cancel
Save