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

Fix typo

parent d4c21699
......@@ -73,7 +73,6 @@ extern "C" {
#include "dynamic_memory_check.h"
}
// using namespace oai::amf::model;
using namespace nas;
using namespace amf_application;
using namespace config;
......@@ -86,6 +85,7 @@ extern amf_app* amf_app_inst;
extern amf_n2* amf_n2_inst;
extern statistics stacs;
// Static variables
uint8_t amf_n1::no_random_delta = 0;
std::map<std::string, std::string> amf_n1::rand_record = {};
......@@ -482,7 +482,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind& nas_data_ind) {
blength(decoded_plain_msg));
if (nas_data_ind.is_nas_signalling_estab_req) {
Logger::amf_n1().debug("Received NAS signalling establishment request...");
Logger::amf_n1().debug("Received NAS Signalling Establishment request...");
comUt::print_buffer(
"amf_n1", "Decoded plain NAS Message buffer",
(uint8_t*) bdata(decoded_plain_msg), blength(decoded_plain_msg));
......@@ -552,13 +552,13 @@ void amf_n1::nas_signalling_establishment_request_handle(
switch (message_type) {
case REGISTRATION_REQUEST: {
Logger::amf_n1().debug(
"Received registration request message, handling...");
"Received Registration Request message, handling...");
registration_request_handle(
nc, ran_ue_ngap_id, amf_ue_ngap_id, snn, plain_msg);
} break;
case SERVICE_REQUEST: {
Logger::amf_n1().debug("Received service request message, handling...");
Logger::amf_n1().debug("Received Service Request message, handling...");
if (!nc.get()) {
Logger::amf_n1().error("No NAS Context found");
return;
......@@ -574,7 +574,7 @@ void amf_n1::nas_signalling_establishment_request_handle(
case UE_INIT_DEREGISTER: {
Logger::amf_n1().debug(
"Received initialUeMessage de-registration request message, "
"Received InitialUeMessage De-registration Request message, "
"handling...");
// ue_initiate_de_registration_handle(ran_ue_ngap_id, amf_ue_ngap_id,
// plain_msg);
......@@ -766,6 +766,8 @@ void amf_n1::identity_response_handle(
nc.get()->is_stacs_available = true;
}
// TODO: Trigger UE Location Report
run_registration_procedure(nc);
}
}
......@@ -1198,7 +1200,6 @@ void amf_n1::registration_request_handle(
}
} else {
Logger::amf_n1().debug("Existing nas_context --> Update");
// nc = amf_ue_id_2_nas_context(amf_ue_ngap_id);
set_amf_ue_ngap_id_2_nas_context(amf_ue_ngap_id, nc);
}
nc.get()->ran_ue_ngap_id = ran_ue_ngap_id;
......@@ -1326,7 +1327,7 @@ void amf_n1::registration_request_handle(
std::shared_ptr<gnb_context> gc = {};
if (!amf_n2_inst->is_assoc_id_2_gnb_context(unc.get()->gnb_assoc_id)) {
Logger::amf_n2().error(
Logger::amf_n1().error(
"No existed gNB context with assoc_id (%d)", unc.get()->gnb_assoc_id);
} else {
gc = amf_n2_inst->assoc_id_2_gnb_context(unc.get()->gnb_assoc_id);
......@@ -1421,7 +1422,6 @@ void amf_n1::registration_request_handle(
//------------------------------------------------------------------------------
bool amf_n1::is_amf_ue_id_2_nas_context(const long& amf_ue_ngap_id) const {
std::shared_lock lock(m_amfueid2nas_context);
// return bool{amfueid2nas_context.count(amf_ue_ngap_id) > 0};
if (amfueid2nas_context.count(amf_ue_ngap_id) > 0) {
if (amfueid2nas_context.at(amf_ue_ngap_id).get() != nullptr) {
return true;
......@@ -1618,7 +1618,7 @@ void amf_n1::send_registration_reject_msg(
//------------------------------------------------------------------------------
void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
Logger::amf_n1().debug("Start to run registration procedure");
Logger::amf_n1().debug("Start to run Registration Procedure");
if (!nc.get()->ctx_avaliability_ind) {
Logger::amf_n1().error("NAS context is not available");
return;
......@@ -1639,7 +1639,7 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
}
nc.get()->ngKsi = ngksi;
} else {
Logger::amf_n1().error("Request authentication vectors failure");
Logger::amf_n1().error("Request Authentication Vectors failure");
send_registration_reject_msg(
_5GMM_CAUSE_ILLEGAL_UE, nc.get()->ran_ue_ngap_id,
nc.get()->amf_ue_ngap_id); // cause?
......@@ -1647,13 +1647,13 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
}
} else {
Logger::amf_n1().debug(
"Authentication vector in nas_context is available");
"Authentication Vector in nas_context is available");
ngksi_t ngksi = 0;
if (nc.get()->security_ctx &&
nc.get()->ngKsi != NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE) {
// ngksi = (nc.get()->ngKsi + 1) % (NGKSI_MAX_VALUE + 1);
ngksi = (nc.get()->amf_ue_ngap_id + 1); // % (NGKSI_MAX_VALUE + 1);
Logger::amf_n1().debug("New ngKsi(%d)", ngksi);
Logger::amf_n1().debug("New ngKSI (%d)", ngksi);
// TODO: How to handle?
}
nc.get()->ngKsi = ngksi;
......@@ -1690,7 +1690,7 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
// Get authentication vectors either from AUSF(UDM) or from AMF (generate
// locally)
bool amf_n1::auth_vectors_generator(std::shared_ptr<nas_context>& nc) {
Logger::amf_n1().debug("Start to generate authentication vectors");
Logger::amf_n1().debug("Start to generate Authentication Vectors");
if (amf_cfg.support_features.enable_external_ausf) {
// get authentication vectors from AUSF
if (!get_authentication_vectors_from_ausf(nc)) return false;
......@@ -1797,7 +1797,7 @@ bool amf_n1::get_authentication_vectors_from_ausf(
//------------------------------------------------------------------------------
bool amf_n1::_5g_aka_confirmation_from_ausf(
std::shared_ptr<nas_context>& nc, bstring resStar) {
Logger::amf_n1().debug("_5g_aka_confirmation_from_ausf");
Logger::amf_n1().debug("5G AKA Confirmation from AUSF");
std::string remoteUri = nc.get()->Href;
std::string msgBody = {};
......@@ -1837,7 +1837,6 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
free_wrapper((void**) &resStar_s);
try {
ConfirmationDataResponse confirmationdataresponse;
// nlohmann::json::parse(response.c_str()).get_to(confirmationdataresponse);
response.get_to(confirmationdataresponse);
unsigned char* kseaf_hex =
conv::format_string_as_hex(confirmationdataresponse.getKseaf());
......@@ -1864,7 +1863,9 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
//------------------------------------------------------------------------------
bool amf_n1::authentication_vectors_generator_in_ausf(
std::shared_ptr<nas_context>& nc) { // A.5, 3gpp ts33.501
Logger::amf_n1().debug("Authentication_vectors_generator_in_ausf");
Logger::amf_n1().debug(
"Generate Authentication Vectors in AUSF"); // Actually, done locally in
// AMF
uint8_t inputString[MAX_5GS_AUTH_VECTORS][40];
uint8_t* xresStar[MAX_5GS_AUTH_VECTORS];
uint8_t* rand[MAX_5GS_AUTH_VECTORS];
......@@ -1890,13 +1891,13 @@ bool amf_n1::authentication_vectors_generator_in_ausf(
//------------------------------------------------------------------------------
bool amf_n1::authentication_vectors_generator_in_udm(
std::shared_ptr<nas_context>& nc) {
Logger::amf_n1().debug("Generate authentication vectors");
Logger::amf_n1().debug("Generate Authentication Vectors");
uint8_t* sqn = NULL;
uint8_t* auts = (uint8_t*) bdata(nc.get()->auts);
_5G_HE_AV_t* vector = nc.get()->_5g_he_av;
// Access to MySQL to fetch UE-related information
if (!connect_to_mysql()) {
Logger::amf_n1().error("Cannot connect to MySQL");
Logger::amf_n1().error("Cannot connect to MySQL DB");
return false;
}
Logger::amf_n1().debug("Connected to MySQL successfully");
......@@ -2064,7 +2065,7 @@ void amf_n1::annex_a_4_33501(
void amf_n1::handle_auth_vector_successful_result(
std::shared_ptr<nas_context>& nc) {
Logger::amf_n1().debug(
"Received security vectors, try to setup security with the UE");
"Received Security Vectors, try to setup security with the UE");
nc.get()->is_auth_vectors_present = true;
ngksi_t ngksi = 0;
if (!nc.get()->security_ctx) {
......@@ -2077,7 +2078,7 @@ void amf_n1::handle_auth_vector_successful_result(
}
int vindex = nc.get()->security_ctx->vector_pointer;
if (!start_authentication_procedure(nc, vindex, nc.get()->ngKsi)) {
Logger::amf_n1().error("Start authentication procedure failure, reject...");
Logger::amf_n1().error("Start Authentication Procedure Failure, reject...");
Logger::amf_n1().error(
"Ran_ue_ngap_id " GNB_UE_NGAP_ID_FMT, nc.get()->ran_ue_ngap_id);
send_registration_reject_msg(
......@@ -2091,7 +2092,7 @@ void amf_n1::handle_auth_vector_successful_result(
//------------------------------------------------------------------------------
bool amf_n1::start_authentication_procedure(
std::shared_ptr<nas_context>& nc, int vindex, uint8_t ngksi) {
Logger::amf_n1().debug("Starting authentication procedure");
Logger::amf_n1().debug("Starting Authentication procedure");
if (check_nas_common_procedure_on_going(nc)) {
Logger::amf_n1().error("Existed NAS common procedure on going, reject...");
send_registration_reject_msg(
......@@ -2111,7 +2112,7 @@ bool amf_n1::start_authentication_procedure(
auth_request->setABBA(2, abba);
uint8_t* rand = nc.get()->_5g_av[vindex].rand;
if (rand) auth_request->setAuthentication_Parameter_RAND(rand);
Logger::amf_n1().debug("Sending Authentication request with RAND");
Logger::amf_n1().debug("Sending Authentication Request with RAND");
printf("0x");
for (int i = 0; i < 16; i++) printf("%x", rand[i]);
printf("\n");
......@@ -2140,11 +2141,11 @@ bool amf_n1::start_authentication_procedure(
bool amf_n1::check_nas_common_procedure_on_going(
std::shared_ptr<nas_context>& nc) {
if (nc.get()->is_common_procedure_for_authentication_running) {
Logger::amf_n1().debug("Existed authentication procedure is running");
Logger::amf_n1().debug("Existed Authentication procedure is running");
return true;
}
if (nc.get()->is_common_procedure_for_identification_running) {
Logger::amf_n1().debug("Existed identification procedure is running");
Logger::amf_n1().debug("Existed Identification procedure is running");
return true;
}
if (nc.get()->is_common_procedure_for_security_mode_control_running) {
......@@ -2245,6 +2246,7 @@ void amf_n1::authentication_response_handle(
return;
} else {
Logger::amf_n1().debug("Authentication successful by network!");
// Fix to work with ng4T
// TODO: To verify UE/AMF behavior according to 3GPP TS 24.501
// if (!nc.get()->is_current_security_available) {
if (!start_security_mode_control_procedure(nc)) {
......@@ -2260,7 +2262,7 @@ void amf_n1::authentication_failure_handle(
std::shared_ptr<nas_context> nc;
if (!is_amf_ue_id_2_nas_context(amf_ue_ngap_id)) {
Logger::amf_n1().error(
"No existed NAS context for UE with amf_ue_ngap_id(" AMF_UE_NGAP_ID_FMT
"No existed NAS context for UE with amf_ue_ngap_id (" AMF_UE_NGAP_ID_FMT
")",
amf_ue_ngap_id);
send_registration_reject_msg(
......@@ -2285,7 +2287,7 @@ void amf_n1::authentication_failure_handle(
}
switch (mm_cause) {
case _5GMM_CAUSE_SYNCH_FAILURE: {
Logger::amf_n1().debug("Initial new authentication procedure");
Logger::amf_n1().debug("Initial new Authentication procedure");
bstring auts;
if (!auth_failure->getAutsInAuthFailPara(auts)) {
Logger::amf_n1().warn(
......@@ -2299,7 +2301,7 @@ void amf_n1::authentication_failure_handle(
if (auth_vectors_generator(nc)) { // all authentication in one(AMF)
handle_auth_vector_successful_result(nc);
} else {
Logger::amf_n1().error("Request authentication vectors failure");
Logger::amf_n1().error("Request Authentication Vectors failure");
send_registration_reject_msg(
_5GMM_CAUSE_ILLEGAL_UE, nc.get()->ran_ue_ngap_id,
nc.get()->amf_ue_ngap_id); // cause?
......@@ -2309,7 +2311,7 @@ void amf_n1::authentication_failure_handle(
case _5GMM_CAUSE_NGKSI_ALREADY_IN_USE: {
Logger::amf_n1().debug(
"ngKSI already in use, select a new ngKSI and restart the "
"authentication procedure!");
"Authentication procedure!");
// select new ngKSI and resend Authentication Request
ngksi_t ngksi =
(nc.get()->ngKsi + 1) % (NGKSI_MAX_VALUE + 1); // To be verified
......@@ -2317,7 +2319,7 @@ void amf_n1::authentication_failure_handle(
int vindex = nc.get()->security_ctx->vector_pointer;
if (!start_authentication_procedure(nc, vindex, nc.get()->ngKsi)) {
Logger::amf_n1().error(
"Start authentication procedure failure, reject...");
"Start Authentication procedure failure, reject...");
Logger::amf_n1().error(
"Ran_ue_ngap_id " GNB_UE_NGAP_ID_FMT, nc.get()->ran_ue_ngap_id);
send_registration_reject_msg(
......@@ -3013,7 +3015,7 @@ void amf_n1::ue_initiate_de_registration_handle(
// Check Deregistration type
uint8_t deregType = 0;
dereg_request->getDeregistrationType(deregType);
Logger::amf_n1().debug("Deregistration Type 0x%x", deregType);
Logger::amf_n1().debug("De-registration Type 0x%x", deregType);
// If UE switch-off, don't need to send Deregistration Accept
if ((deregType & 0b00001000) == 0) {
......@@ -3423,7 +3425,7 @@ void amf_n1::handle_ue_location_change(
std::string supi, oai::amf::model::UserLocation user_location,
uint8_t http_version) {
Logger::amf_n1().debug(
"Send request to SBI to triger UE Location Report (SUPI "
"Send request to SBI to trigger UE Location Report (SUPI "
"%s )",
supi.c_str());
std::vector<std::shared_ptr<amf_subscription>> subscriptions = {};
......@@ -3432,7 +3434,7 @@ void amf_n1::handle_ue_location_change(
if (subscriptions.size() > 0) {
// Send request to SBI to trigger the notification to the subscribed event
Logger::amf_app().debug(
Logger::amf_n1().debug(
"Send ITTI msg to AMF SBI to trigger the event notification");
std::shared_ptr<itti_sbi_notify_subscribed_event> itti_msg =
......@@ -3477,7 +3479,7 @@ void amf_n1::handle_ue_location_change(
void amf_n1::handle_ue_reachability_status_change(
std::string supi, uint8_t status, uint8_t http_version) {
Logger::amf_n1().debug(
"Send request to SBI to triger UE Reachability Report (SUPI "
"Send request to SBI to trigger UE Reachability Report (SUPI "
"%s )",
supi.c_str());
......@@ -3487,7 +3489,7 @@ void amf_n1::handle_ue_reachability_status_change(
if (subscriptions.size() > 0) {
// Send request to SBI to trigger the notification to the subscribed event
Logger::amf_app().debug(
Logger::amf_n1().debug(
"Send ITTI msg to AMF SBI to trigger the event notification");
std::shared_ptr<itti_sbi_notify_subscribed_event> itti_msg =
......@@ -3537,7 +3539,7 @@ void amf_n1::handle_ue_reachability_status_change(
void amf_n1::handle_ue_registration_state_change(
std::string supi, uint8_t status, uint8_t http_version) {
Logger::amf_n1().debug(
"Send request to SBI to triger UE Registration State Report (SUPI "
"Send request to SBI to trigger UE Registration State Report (SUPI "
"%s )",
supi.c_str());
......@@ -3547,7 +3549,7 @@ void amf_n1::handle_ue_registration_state_change(
if (subscriptions.size() > 0) {
// Send request to SBI to trigger the notification to the subscribed event
Logger::amf_app().debug(
Logger::amf_n1().debug(
"Send ITTI msg to AMF SBI to trigger the event notification");
std::shared_ptr<itti_sbi_notify_subscribed_event> itti_msg =
......@@ -3604,7 +3606,7 @@ void amf_n1::handle_ue_registration_state_change(
void amf_n1::handle_ue_connectivity_state_change(
std::string supi, uint8_t status, uint8_t http_version) {
Logger::amf_n1().debug(
"Send request to SBI to triger UE Connectivity State Report (SUPI "
"Send request to SBI to trigger UE Connectivity State Report (SUPI "
"%s )",
supi.c_str());
......@@ -3614,7 +3616,7 @@ void amf_n1::handle_ue_connectivity_state_change(
if (subscriptions.size() > 0) {
// Send request to SBI to trigger the notification to the subscribed event
Logger::amf_app().debug(
Logger::amf_n1().debug(
"Send ITTI msg to AMF SBI to trigger the event notification");
std::shared_ptr<itti_sbi_notify_subscribed_event> itti_msg =
......@@ -3843,7 +3845,7 @@ void amf_n1::mobile_reachable_timer_timeout(
timer_id_t tid = itti_inst->timer_setup(
IMPLICIT_DEREGISTRATION_TIMER_MIN * 60, 0, TASK_AMF_N1,
TASK_AMF_IMPLICIT_DEREGISTRATION_TIMER_EXPIRE, amf_ue_ngap_id);
Logger::amf_app().startup(
Logger::amf_n1().startup(
"Started Implicit De-Registration Timer (tid %d)", tid);
set_implicit_deregistration_timer(nc, tid);
......@@ -4304,7 +4306,7 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
std::shared_ptr<gnb_context> gc = {};
if (!amf_n2_inst->is_assoc_id_2_gnb_context(unc.get()->gnb_assoc_id)) {
Logger::amf_n2().error(
Logger::amf_n1().error(
"No existed gNB context with assoc_id (%d)", unc.get()->gnb_assoc_id);
return false;
}
......@@ -4322,7 +4324,7 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
try {
sst = std::stoi(s.sst);
} catch (const std::exception& err) {
Logger::amf_app().error("Invalid SST");
Logger::amf_n1().error("Invalid SST");
return false;
}
nssai.setSst(sst);
......
......@@ -1366,7 +1366,7 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
timer_id_t tid = itti_inst->timer_setup(
MOBILE_REACHABLE_TIMER_NO_EMERGENCY_SERVICES_MIN * 60, 0, TASK_AMF_N1,
TASK_AMF_MOBILE_REACHABLE_TIMER_EXPIRE, amf_ue_ngap_id);
Logger::amf_app().startup("Started mobile reachable timer (tid %d)", tid);
Logger::amf_n2().startup("Started mobile reachable timer (tid %d)", tid);
amf_n1_inst->set_mobile_reachable_timer(nc, tid);
amf_n1_inst->set_mobile_reachable_timer_timeout(nc, false);
......
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