Commit f86d7e29 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

fix issue when an internal error happens

parent 86ff6efb
This diff is collapsed.
......@@ -620,6 +620,7 @@ class smf_app {
* @param [const uint32_t &] http_code: Status code of HTTP response
* @param [const oai::smf_server::model::SmContextCreateError &] smContextCreateError: store the json content of response message
* @param [uint32_t &] promise_id: Promise Id
* @param [uint8_t] msg_type: Type of HTTP message (Update/Release)
* @return void
*/
void trigger_http_response(
......@@ -633,6 +634,7 @@ class smf_app {
* @param [const oai::smf_server::model::SmContextUpdateError &] smContextUpdateError: store the json content of response message
* @param [const std::string &] n1_sm_msg: N1 SM message
* @param [uint32_t &] promise_id: Promise Id
* @param [uint8_t] msg_type: Type of HTTP message (Update/Release)
* @return void
*/
void trigger_http_response(
......@@ -644,7 +646,7 @@ class smf_app {
* To trigger the response to the HTTP server by set the value of the corresponding promise to ready
* @param [const uint32_t &] http_code: Status code of HTTP response
* @param [uint32_t &] promise_id: Promise Id
* @param [uint8_t] msg_type
* @param [uint8_t] msg_type: Type of HTTP message (Create/Update/Release)
* @return void
*/
void trigger_http_response(const uint32_t &http_code, uint32_t &promise_id,
......
This diff is collapsed.
......@@ -68,7 +68,7 @@ using namespace smf;
extern smf_app *smf_app_inst;
//-----------------------------------------------------------------------------------------------------
void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
bool smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
uint8_t n1_msg_type,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause) {
......@@ -103,7 +103,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
Logger::smf_app().error(
"Cannot create an PDU Session Establishment Accept for this message (type %d)",
msg.get_msg_type());
return;
return false;
}
pdu_session_create_sm_context_response &sm_context_res =
......@@ -112,6 +112,13 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
//get default QoS value
qos_flow_context_updated qos_flow = { };
qos_flow = sm_context_res.get_qos_flow_context();
//check the QoS Flow
if ((qos_flow.qfi.qfi < QOS_FLOW_IDENTIFIER_FIRST )
or (qos_flow.qfi.qfi > QOS_FLOW_IDENTIFIER_LAST )) {
//error
Logger::smf_app().error("Incorrect QFI %d", qos_flow.qfi.qfi);
return false;
}
Logger::smf_app().info(
"PDU_SESSION_ESTABLISHMENT_ACCEPT, encode starting...");
......@@ -149,6 +156,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
//authorized QoS rules of the PDU session: QOSRules (Section 6.2.5@3GPP TS 24.501)
//(Section 6.4.1.3@3GPP TS 24.501 V16.1.0) Make sure that the number of the packet filters used in the authorized QoS rules of the PDU Session does not
// exceed the maximum number of packet filters supported by the UE for the PDU session
if (qos_flow.qos_rules.size() > 0) {
sm_msg->pdu_session_establishment_accept.qosrules.lengthofqosrulesie =
qos_flow.qos_rules.size();
sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie =
......@@ -158,10 +166,12 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
for (auto rule : qos_flow.qos_rules) {
sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie[i]
.qosruleidentifer = rule.second.qosruleidentifer;
memcpy(&sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie[i],
memcpy(
&sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie[i],
&rule.second, sizeof(QOSRulesIE));
i++;
}
}
//SessionAMBR
Logger::smf_app().debug("Get default values for Session-AMBR");
......@@ -179,7 +189,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
} else {
Logger::smf_app().warn(
"SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64);
//TODO:
return false;
}
//Presence
......@@ -298,8 +308,11 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
nas_msg_str = n1Message;
//free memory
if (qos_flow.qos_rules.size() > 0) {
free_wrapper(
(void**) &sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie);
(void**) &sm_msg->pdu_session_establishment_accept.qosrules
.qosrulesie);
}
free_wrapper(
(void**) &sm_msg->pdu_session_establishment_accept.qosflowdescriptions
.qosflowdescriptionscontents);
......@@ -434,7 +447,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
} else {
Logger::smf_app().warn(
"SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64);
//TODO:
return false;
}
bool find_dnn = sc.get()->find_dnn_context(sm_context_res.get_snssai(),
......@@ -447,8 +460,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
if (!find_dnn or !find_pdu) {
//error
Logger::smf_app().warn("DNN or PDU session context does not exist!");
//TODO:
return;
return false;
}
//PTI
......@@ -475,6 +487,10 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
std::vector<QOSRulesIE> qos_rules;
sp.get()->get_qos_rules_to_be_synchronised(qos_rules);
if (qos_rules.size() == 0) {
return false;
}
sm_msg->pdu_session_modification_command.qosrules.lengthofqosrulesie =
qos_rules.size();
......@@ -630,7 +646,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
}
//------------------------------------------------------------------------------
void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
bool smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
uint8_t ngap_msg_type,
n2_sm_info_type_e ngap_ie_type,
std::string &ngap_msg_str) {
......@@ -684,6 +700,10 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
qos_flows.begin(); it != qos_flows.end(); ++it)
Logger::smf_app().debug("QoS Flow context to be updated QFI %d",
it->first);
if (qos_flows.empty()) {
return false;
}
//TODO: support only 1 qos flow
qos_flow = qos_flows.begin()->second;
......@@ -703,7 +723,15 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
msg.get_msg_type());
//TODO:
free_wrapper((void**) &ngap_IEs);
return;
return false;
}
//check the QoS Flow
if ((qos_flow.qfi.qfi < QOS_FLOW_IDENTIFIER_FIRST )
or (qos_flow.qfi.qfi > QOS_FLOW_IDENTIFIER_LAST )) {
//error
Logger::smf_app().error("Incorrect QFI %d", qos_flow.qfi.qfi);
return false;
}
//PDUSessionAggregateMaximumBitRate
......@@ -734,7 +762,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
} else {
Logger::smf_app().warn(
"SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64);
//TODO:
return false;
}
ASN_SEQUENCE_ADD(&ngap_IEs->protocolIEs.list,
......@@ -888,7 +916,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
Logger::smf_app().warn(
"NGAP PDU Session Resource Setup Request Transfer encode failed (encode size %d)",
encoded_size);
return;
return false;
}
#if DEBUG_IS_ON
......@@ -948,6 +976,14 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
//TODO: support only 1 qos flow
qos_flow_context_updated qos_flow = qos_flows.begin()->second;
//check the QoS Flow
if ((qos_flow.qfi.qfi < QOS_FLOW_IDENTIFIER_FIRST )
or (qos_flow.qfi.qfi > QOS_FLOW_IDENTIFIER_LAST )) {
//error
Logger::smf_app().error("Incorrect QFI %d", qos_flow.qfi.qfi);
return false;
}
Logger::smf_app().debug(
"QoS Flow, UL F-TEID ID " "0x%" PRIx32 ", IP Address %s ",
qos_flow.ul_fteid.teid_gre_key,
......@@ -1164,7 +1200,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
Logger::smf_app().warn(
"NGAP PDU Session Resource Modify Request Transfer encode failed (encoded size %d)",
encoded_size);
return;
return false;
}
#if DEBUG_IS_ON
......@@ -1288,7 +1324,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
Logger::smf_app().warn(
"NGAP PDU Session Resource Setup Response Transfer encode failed (encoded size %d)",
encoded_size);
return;
return false;
}
#if DEBUG_IS_ON
......@@ -1398,7 +1434,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
Logger::smf_app().warn(
" NGAP PDU Session Resource Modify Response Transfer encode failed (encoded size %d)",
encoded_size);
return;
return false;
}
#if DEBUG_IS_ON
......@@ -1474,7 +1510,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
Logger::smf_app().warn(
"NGAP PDU Session Release Command encode failed (encoded size %d)",
encoded_size);
return;
return false;
}
#if DEBUG_IS_ON
......@@ -1518,7 +1554,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
Logger::smf_app().warn(
"NGAP PDU Session Release Command encode failed (encoded size %d)",
encoded_size);
return;
return false;
}
#if DEBUG_IS_ON
......
......@@ -78,9 +78,9 @@ class smf_n1_n2 {
* @param [uint8_t] msg_type Type of N1 message
* @param [std::string&] nas_msg_str store NAS message in form of string
* @param [uint8_t] sm_cause store NAS Cause
*
* @return boolean: True if the NAS message has been created successfully, otherwise return false
*/
void create_n1_sm_container(pdu_session_msg &msg, uint8_t msg_type,
bool create_n1_sm_container(pdu_session_msg &msg, uint8_t msg_type,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
......@@ -89,9 +89,10 @@ class smf_n1_n2 {
* @param [std::shared_ptr<itti_n11_create_sm_context_response>] sm_context_res
* @param [uint8_t] msg_type Type of N2 message
* @param [std::string&] ngap_msg_str store NGAP message in form of string
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
void create_n2_sm_information(pdu_session_msg &msg, uint8_t ngap_msg_type,
bool create_n2_sm_information(pdu_session_msg &msg, uint8_t ngap_msg_type,
n2_sm_info_type_e ngap_ie_type,
std::string &ngap_msg_str);
......
......@@ -1034,6 +1034,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
smf_app_inst->trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
smContextUpdateError, n11_triggered_pending->pid);
return;
}
}
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment