Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lte/gateway/c/oai/include/ip_forward_messages_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ typedef struct {

typedef struct {
teid_t context_teid; ///< Tunnel Endpoint Identifier S11
SGIStatus_t status; ///< Status of endpoint creation (Failed = 0xFF or
///< Success = 0x0)
uint8_t num_bearers_modified;
bearer_cxt_t bearer_contexts_to_be_modified[BEARERS_PER_UE];
uint8_t num_bearers_removed;
Expand Down
1 change: 1 addition & 0 deletions lte/gateway/c/oai/include/sgw_context_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ void sgw_display_sgw_eps_bearer_context(
const sgw_eps_bearer_ctxt_t* eps_bearer_ctxt);
void sgw_display_s11teid2mme(mme_sgw_tunnel_t* mme_sgw_tunnel);
void sgw_display_s11_bearer_context_information(
log_proto_t module,
sgw_eps_bearer_context_information_t* sgw_context_information);
void pgw_lite_cm_free_apn(pgw_apn_t** apnP);

Expand Down
28 changes: 17 additions & 11 deletions lte/gateway/c/oai/lib/s8_proxy/s8_client_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ static void get_fteid_from_proto_msg(
OAILOG_FUNC_IN(LOG_SGW_S8);
pgw_fteid->teid = proto_fteid.teid();
if (proto_fteid.ipv4_address().c_str()) {
struct in_addr addr = {0};
memcpy(&addr, proto_fteid.ipv4_address().c_str(), sizeof(in_addr));
pgw_fteid->ipv4_address = addr;
pgw_fteid->ipv4 = true;
inet_pton(
AF_INET, proto_fteid.ipv4_address().c_str(),
&(pgw_fteid->ipv4_address));
}
if (proto_fteid.ipv6_address().c_str()) {
struct in6_addr ip6_addr;
memcpy(&ip6_addr, proto_fteid.ipv6_address().c_str(), sizeof(in6_addr));
pgw_fteid->ipv6_address = ip6_addr;
pgw_fteid->ipv6 = true;
inet_pton(
AF_INET6, proto_fteid.ipv6_address().c_str(),
&(pgw_fteid->ipv6_address));
}
OAILOG_FUNC_OUT(LOG_SGW_S8);
}
Expand All @@ -69,22 +71,22 @@ static void get_paa_from_proto_msg(
case magma::feg::PDNType::IPV4: {
paa->pdn_type = IPv4;
auto ip = proto_paa.ipv4_address();
memcpy(&paa->ipv4_address, ip.c_str(), sizeof(ip.c_str()));
inet_pton(AF_INET, ip.c_str(), &(paa->ipv4_address));
break;
}
case magma::feg::PDNType::IPV6: {
paa->pdn_type = IPv6;
auto ip = proto_paa.ipv6_address();
memcpy(&paa->ipv6_address, ip.c_str(), sizeof(ip.c_str()));
inet_pton(AF_INET6, ip.c_str(), &(paa->ipv6_address));
paa->ipv6_prefix_length = IPV6_PREFIX_LEN;
break;
}
case magma::feg::PDNType::IPV4V6: {
paa->pdn_type = IPv4_AND_v6;
auto ip = proto_paa.ipv4_address();
memcpy(&paa->ipv4_address, ip.c_str(), sizeof(ip.c_str()));
inet_pton(AF_INET, ip.c_str(), &(paa->ipv4_address));
auto ipv6 = proto_paa.ipv6_address();
memcpy(&paa->ipv6_address, ipv6.c_str(), sizeof(ipv6.c_str()));
inet_pton(AF_INET6, ipv6.c_str(), &(paa->ipv6_address));
paa->ipv6_prefix_length = IPV6_PREFIX_LEN;
break;
}
Expand Down Expand Up @@ -371,6 +373,10 @@ static void convert_proto_msg_to_itti_csr(
get_qos_from_proto_msg(response.bearer_context().qos(), &s8_bc->qos);
get_fteid_from_proto_msg(
response.bearer_context().user_plane_fteid(), &s8_bc->pgw_s8_up);
s5_response->cause = response.mutable_gtp_error()->cause();
if (response.has_gtp_error()) {
s5_response->cause = response.mutable_gtp_error()->cause();
} else {
s5_response->cause = REQUEST_ACCEPTED;
}
OAILOG_FUNC_OUT(LOG_SGW_S8);
}
6 changes: 6 additions & 0 deletions lte/gateway/c/oai/tasks/gtpv1-u/gtpv1u.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,10 @@ int gtpv1u_add_s8_tunnel(
struct in_addr ue, struct in6_addr* ue_ipv6, int vlan, struct in_addr enb,
struct in_addr pgw, uint32_t i_tei, uint32_t o_tei, Imsi_t imsi,
struct ip_flow_dl* flow_dl, uint32_t flow_precedence_dl);

int gtpv1u_del_s8_tunnel(
struct in_addr enb, struct in_addr pgw, struct in_addr ue,
struct in6_addr* ue_ipv6, uint32_t i_tei, uint32_t o_tei,
struct ip_flow_dl* flow_dl);

#endif /* FILE_GTPV1_U_SEEN */
20 changes: 10 additions & 10 deletions lte/gateway/c/oai/tasks/sgw/sgw_context_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,41 +65,41 @@ void sgw_display_sgw_eps_bearer_context(

//-----------------------------------------------------------------------------
void sgw_display_s11_bearer_context_information(
log_proto_t module,
sgw_eps_bearer_context_information_t* sgw_context_information)
//-----------------------------------------------------------------------------
{
OAILOG_DEBUG(
LOG_SPGW_APP, "| KEY %" PRId64 ": \n",
sgw_context_information->imsi64);
OAILOG_DEBUG(LOG_SPGW_APP, "|\tsgw_eps_bearer_context_information: |\n");
module, "| KEY %" PRId64 ": \n", sgw_context_information->imsi64);
OAILOG_DEBUG(module, "|\tsgw_eps_bearer_context_information: |\n");
// Imsi_t imsi; ///< IMSI
// (International Mobile Subscriber Identity) is the subscriber permanent
// identity.
OAILOG_DEBUG(
LOG_SPGW_APP, "|\t\timsi_unauthenticated_indicator:\t%u\n",
module, "|\t\timsi_unauthenticated_indicator:\t%u\n",
sgw_context_information->imsi_unauthenticated_indicator);
// char msisdn[MSISDN_LENGTH]; ///< The basic MSISDN
// of the UE. The presence is dictated by its storage in the HSS.
OAILOG_DEBUG(
LOG_SPGW_APP, "|\t\tmme_teid_ S11: \t" TEID_FMT "\n",
module, "|\t\tmme_teid_ S11: \t" TEID_FMT "\n",
sgw_context_information->mme_teid_S11);
// ip_address_t mme_ip_address_for_S11; ///< MME IP address
// the S11 interface.
OAILOG_DEBUG(
LOG_SPGW_APP, "|\t\ts_gw_teid_S11_S4: \t" TEID_FMT "\n",
module, "|\t\ts_gw_teid_S11_S4: \t" TEID_FMT "\n",
sgw_context_information->s_gw_teid_S11_S4);
// ip_address_t s_gw_ip_address_for_S11_S4; ///< S-GW IP address
// for the S11 interface and the S4 Interface (control plane). cgi_t
// last_known_cell_Id; ///< This is the last location of the UE
// known by the network
OAILOG_DEBUG(LOG_SPGW_APP, "|\t\tpdn_connection:\n");
OAILOG_DEBUG(module, "|\t\tpdn_connection:\n");
OAILOG_DEBUG(
LOG_SPGW_APP, "|\t\t\tapn_in_use: %s\n",
module, "|\t\t\tapn_in_use: %s\n",
sgw_context_information->pdn_connection.apn_in_use);
OAILOG_DEBUG(
LOG_SPGW_APP, "|\t\t\tdefault_bearer: %u\n",
module, "|\t\t\tdefault_bearer: %u\n",
sgw_context_information->pdn_connection.default_bearer);
OAILOG_DEBUG(LOG_SPGW_APP, "|\t\t\teps_bearers:\n");
OAILOG_DEBUG(module, "|\t\t\teps_bearers:\n");
for (int ebix = 0; ebix < BEARERS_PER_UE; ebix++) {
sgw_display_sgw_eps_bearer_context(
sgw_context_information->pdn_connection.sgw_eps_bearers_array[ebix]);
Expand Down
58 changes: 28 additions & 30 deletions lte/gateway/c/oai/tasks/sgw/sgw_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ static void _generate_dl_flow(
packet_filter_contents_t* packet_filter, in_addr_t ipv4_s_addr,
struct in6_addr* ue_ipv6, struct ip_flow_dl* dlflow);

static bool does_bearer_context_hold_valid_enb_ip(
ip_address_t enb_ip_address_S1u);

static void _add_tunnel_helper(
s_plus_p_gw_eps_bearer_context_information_t* spgw_context,
sgw_eps_bearer_ctxt_t* eps_bearer_ctxt_entry_p, imsi64_t imsi64);
Expand Down Expand Up @@ -255,8 +252,8 @@ int sgw_handle_s11_create_session_request(
session_req_pP->bearer_contexts_to_be_created.bearer_contexts[0]
.eps_bearer_id);
sgw_display_s11_bearer_context_information(
&s_plus_p_gw_eps_bearer_ctxt_info_p
->sgw_eps_bearer_context_information);
LOG_SPGW_APP, &s_plus_p_gw_eps_bearer_ctxt_info_p
->sgw_eps_bearer_context_information);

if (eps_bearer_ctxt_p == NULL) {
OAILOG_ERROR_UE(
Expand Down Expand Up @@ -439,10 +436,11 @@ int sgw_handle_sgi_endpoint_created(
/* Populates bearer contexts marked for removal structure in
* modify bearer rsp message.
*/
static void sgw_populate_mbr_bearer_contexts_not_found(
void sgw_populate_mbr_bearer_contexts_not_found(
log_proto_t module,
const itti_sgi_update_end_point_response_t* const resp_pP,
itti_s11_modify_bearer_response_t* modify_response_p) {
OAILOG_FUNC_IN(LOG_SPGW_APP);
OAILOG_FUNC_IN(module);
uint8_t rsp_idx = 0;
for (uint8_t idx = 0; idx < resp_pP->num_bearers_not_found; idx++) {
modify_response_p->bearer_contexts_marked_for_removal
Expand All @@ -453,23 +451,22 @@ static void sgw_populate_mbr_bearer_contexts_not_found(
.cause.cause_value = CONTEXT_NOT_FOUND;
modify_response_p->bearer_contexts_marked_for_removal.num_bearer_context++;
}
OAILOG_FUNC_OUT(LOG_SPGW_APP);
OAILOG_FUNC_OUT(module);
}
//------------------------------------------------------------------------------
/* Populates bearer contexts marked for removal structure in
* modify bearer rsp message
*/
static void sgw_populate_mbr_bearer_contexts_removed(
void sgw_populate_mbr_bearer_contexts_removed(
const itti_sgi_update_end_point_response_t* const resp_pP, imsi64_t imsi64,
s_plus_p_gw_eps_bearer_context_information_t* new_bearer_ctxt_info_p,
sgw_eps_bearer_context_information_t* sgw_context_p,
itti_s11_modify_bearer_response_t* modify_response_p) {
OAILOG_FUNC_IN(LOG_SPGW_APP);
uint8_t rsp_idx = 0;
sgw_eps_bearer_ctxt_t* eps_bearer_ctxt_p = NULL;
for (uint8_t idx = 0; idx < resp_pP->num_bearers_removed; idx++) {
eps_bearer_ctxt_p = sgw_cm_get_eps_bearer_entry(
&new_bearer_ctxt_info_p->sgw_eps_bearer_context_information
.pdn_connection,
&(sgw_context_p->pdn_connection),
resp_pP->bearer_contexts_to_be_removed[idx]);
/* If context is found, delete the context and set cause as
* REQUEST_ACCEPTED. If context is not found set the cause as
Expand All @@ -478,9 +475,8 @@ static void sgw_populate_mbr_bearer_contexts_removed(
*/
if (NULL != eps_bearer_ctxt_p) {
sgw_free_eps_bearer_context(
&new_bearer_ctxt_info_p->sgw_eps_bearer_context_information
.pdn_connection.sgw_eps_bearers_array[EBI_TO_INDEX(
eps_bearer_ctxt_p->eps_bearer_id)]);
&(sgw_context_p->pdn_connection.sgw_eps_bearers_array[EBI_TO_INDEX(
eps_bearer_ctxt_p->eps_bearer_id)]));
modify_response_p->bearer_contexts_marked_for_removal
.bearer_contexts[rsp_idx]
.cause.cause_value = REQUEST_ACCEPTED;
Expand Down Expand Up @@ -672,8 +668,8 @@ void sgw_handle_sgi_endpoint_updated(

OAILOG_DEBUG_UE(
LOG_SPGW_APP, imsi64,
"Rx SGI_UPDATE_ENDPOINT_RESPONSE, Context teid " TEID_FMT " status %d\n",
resp_pP->context_teid, resp_pP->status);
"Rx SGI_UPDATE_ENDPOINT_RESPONSE, Context teid " TEID_FMT "\n",
resp_pP->context_teid);
message_p = itti_alloc_new_message(TASK_SPGW_APP, S11_MODIFY_BEARER_RESPONSE);

if (!message_p) {
Expand All @@ -698,8 +694,11 @@ void sgw_handle_sgi_endpoint_updated(
sgw_populate_mbr_bearer_contexts_modified(
resp_pP, imsi64, new_bearer_ctxt_info_p, modify_response_p);
sgw_populate_mbr_bearer_contexts_removed(
resp_pP, imsi64, new_bearer_ctxt_info_p, modify_response_p);
sgw_populate_mbr_bearer_contexts_not_found(resp_pP, modify_response_p);
resp_pP, imsi64,
&new_bearer_ctxt_info_p->sgw_eps_bearer_context_information,
modify_response_p);
sgw_populate_mbr_bearer_contexts_not_found(
LOG_SPGW_APP, resp_pP, modify_response_p);
send_msg_to_task(&spgw_app_task_zmq_ctx, TASK_MME, message_p);
}
OAILOG_FUNC_OUT(LOG_SPGW_APP);
Expand Down Expand Up @@ -860,7 +859,7 @@ int sgw_handle_sgi_endpoint_deleted(

//------------------------------------------------------------------------------
// This function populates itti_sgi_update_end_point_response_t message
static void populate_sgi_end_point_update(
void populate_sgi_end_point_update(
uint8_t sgi_rsp_idx, uint8_t idx,
const itti_s11_modify_bearer_request_t* const modify_bearer_pP,
sgw_eps_bearer_ctxt_t* eps_bearer_ctxt_p,
Expand All @@ -887,18 +886,19 @@ static void populate_sgi_end_point_update(

//------------------------------------------------------------------------------
// This function populates and sends MBR failure message to MME APP
static int send_mbr_failure(
int send_mbr_failure(
log_proto_t module,
const itti_s11_modify_bearer_request_t* const modify_bearer_pP,
imsi64_t imsi64) {
int rv = RETURNok;
OAILOG_FUNC_IN(LOG_SPGW_APP);
OAILOG_FUNC_IN(module);
MessageDef* message_p =
itti_alloc_new_message(TASK_SPGW_APP, S11_MODIFY_BEARER_RESPONSE);

if (!message_p) {
OAILOG_ERROR(
LOG_SPGW_APP, "S11_MODIFY_BEARER_RESPONSE memory allocation failed\n");
OAILOG_FUNC_RETURN(LOG_SPGW_APP, RETURNerror);
module, "S11_MODIFY_BEARER_RESPONSE memory allocation failed\n");
OAILOG_FUNC_RETURN(module, RETURNerror);
}

itti_s11_modify_bearer_response_t* modify_response_p =
Expand All @@ -921,13 +921,13 @@ static int send_mbr_failure(
modify_response_p->cause.cause_value = CONTEXT_NOT_FOUND;
modify_response_p->trxn = modify_bearer_pP->trxn;
OAILOG_DEBUG_UE(
LOG_SPGW_APP, imsi64,
module, imsi64,
"Rx MODIFY_BEARER_REQUEST, teid " TEID_FMT " CONTEXT_NOT_FOUND\n",
modify_bearer_pP->teid);
message_p->ittiMsgHeader.imsi = imsi64;
rv = send_msg_to_task(&spgw_app_task_zmq_ctx, TASK_MME, message_p);

OAILOG_FUNC_RETURN(LOG_SPGW_APP, rv);
OAILOG_FUNC_RETURN(module, rv);
}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -956,7 +956,6 @@ int sgw_handle_modify_bearer_request(
modify_bearer_pP->trxn;

sgi_update_end_point_resp.context_teid = modify_bearer_pP->teid;
sgi_update_end_point_resp.status = 0;
uint8_t sgi_rsp_idx = 0;
for (idx = 0;
idx <
Expand Down Expand Up @@ -1031,7 +1030,7 @@ int sgw_handle_modify_bearer_request(
}
sgw_handle_sgi_endpoint_updated(&sgi_update_end_point_resp, imsi64);
} else { // bearer_ctxt_info_p not found
rv = send_mbr_failure(modify_bearer_pP, imsi64);
rv = send_mbr_failure(LOG_SPGW_APP, modify_bearer_pP, imsi64);
if (rv != RETURNok) {
OAILOG_ERROR(
LOG_SPGW_APP,
Expand Down Expand Up @@ -2227,8 +2226,7 @@ static void _add_tunnel_helper(
}
}
}
static bool does_bearer_context_hold_valid_enb_ip(
ip_address_t enb_ip_address_S1u) {
bool does_bearer_context_hold_valid_enb_ip(ip_address_t enb_ip_address_S1u) {
OAILOG_FUNC_IN(LOG_SPGW_APP);
static struct in6_addr ipv6_address = {0};
switch (enb_ip_address_S1u.pdn_type) {
Expand Down
24 changes: 24 additions & 0 deletions lte/gateway/c/oai/tasks/sgw/sgw_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,28 @@ int sgw_handle_ip_allocation_rsp(
const itti_ip_allocation_response_t* ip_allocation_rsp, imsi64_t imsi64);
bool is_enb_ip_address_same(const fteid_t* fte_p, ip_address_t* ip_p);
uint32_t spgw_get_new_s1u_teid(spgw_state_t* state);
int send_mbr_failure(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create common header file accessed by both sgw and sgw_s8 tasks

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create source file for common functionality

log_proto_t module,
const itti_s11_modify_bearer_request_t* const modify_bearer_pP,
imsi64_t imsi64);
void sgw_populate_mbr_bearer_contexts_removed(
const itti_sgi_update_end_point_response_t* const resp_pP, imsi64_t imsi64,
sgw_eps_bearer_context_information_t* sgw_context_p,
itti_s11_modify_bearer_response_t* modify_response_p);
void sgw_populate_mbr_bearer_contexts_not_found(
log_proto_t module,
const itti_sgi_update_end_point_response_t* const resp_pP,
itti_s11_modify_bearer_response_t* modify_response_p);
void populate_sgi_end_point_update(
uint8_t sgi_rsp_idx, uint8_t idx,
const itti_s11_modify_bearer_request_t* const modify_bearer_pP,
sgw_eps_bearer_ctxt_t* eps_bearer_ctxt_p,
itti_sgi_update_end_point_response_t* sgi_update_end_point_resp);
bool does_bearer_context_hold_valid_enb_ip(ip_address_t enb_ip_address_S1u);
void populate_sgi_end_point_update(
uint8_t sgi_rsp_idx, uint8_t idx,
const itti_s11_modify_bearer_request_t* const modify_bearer_pP,
sgw_eps_bearer_ctxt_t* eps_bearer_ctxt_p,
itti_sgi_update_end_point_response_t* sgi_update_end_point_resp);

#endif /* FILE_SGW_HANDLERS_SEEN */
Loading