Commit 9caf610b authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Add log/fix minor issue with ngKSI

parent 8bbc18db
......@@ -1088,21 +1088,20 @@ void amf_n1::registration_request_handle(
}
// Check 5GS_Registration_type IE (Mandatory IE)
uint8_t reg_type;
bool is_follow_on_req_pending;
uint8_t reg_type = 0;
bool is_follow_on_req_pending = false;
if (!regReq->get5GSRegistrationType(is_follow_on_req_pending, reg_type)) {
Logger::amf_n1().error("Missing Mandatory IE 5GS Registration type...");
response_registration_reject_msg(
_5GMM_CAUSE_INVALID_MANDATORY_INFO, ran_ue_ngap_id, amf_ue_ngap_id);
// delete regReq;
return;
}
nc.get()->registration_type = reg_type;
nc.get()->follow_on_req_pending_ind = is_follow_on_req_pending;
// Check ngKSI (Mandatory IE)
uint8_t ngKSI = regReq->getngKSI();
if (ngKSI == -1) {
uint8_t ngKSI = 0;
if (!regReq->getngKSI(ngKSI)) {
Logger::amf_n1().error("Missing Mandatory IE ngKSI...");
response_registration_reject_msg(
_5GMM_CAUSE_INVALID_MANDATORY_INFO, ran_ue_ngap_id, amf_ue_ngap_id);
......@@ -1142,7 +1141,7 @@ void amf_n1::registration_request_handle(
// Get Requested NSSAI (Optional IE), if provided
if (!regReq->getRequestedNssai(nc.get()->requestedNssai)) {
Logger::amf_n1().warn("No Optional IE RequestedNssai available");
Logger::amf_n1().debug("No Optional IE RequestedNssai available");
}
for (auto r : nc.get()->requestedNssai) {
......@@ -1170,7 +1169,7 @@ void amf_n1::registration_request_handle(
if (!registration_request_msg_container->getRequestedNssai(
nc.get()->requestedNssai)) {
Logger::amf_n1().warn(
Logger::amf_n1().debug(
"No Optional IE RequestedNssai available in NAS Container");
} else {
for (auto s : nc.get()->requestedNssai) {
......@@ -1181,6 +1180,9 @@ void amf_n1::registration_request_handle(
s.sst, s.sd, s.mHplmnSst, s.mHplmnSd);
}
}
} else {
Logger::amf_n1().debug(
"No Optional NAS Container inside Registration Request message");
}
// Store NAS information into nas_context
......@@ -2702,6 +2704,7 @@ void amf_n1::ul_nas_transport_handle(
}
// TODO: Only use the first one for now if there's multiple requested NSSAI
// since we don't know which slice associated with this PDU session
if (nc.get()->requestedNssai.size() > 0)
snssai = nc.get()->requestedNssai[0];
}
......
......@@ -82,12 +82,14 @@ void DeregistrationRequest::getDeregistrationType(
}
//------------------------------------------------------------------------------
void DeregistrationRequest::getngKSI(uint8_t& ng_ksi) {
bool DeregistrationRequest::getngKSI(uint8_t& ng_ksi) {
if (ie_ngKSI) {
ng_ksi =
(ie_ngKSI->getTypeOfSecurityContext()) | ie_ngKSI->getasKeyIdentifier();
return true;
} else {
ng_ksi = 0;
// ng_ksi = 0;
return false;
}
}
......
......@@ -58,7 +58,7 @@ class DeregistrationRequest {
void getDeregistrationType(uint8_t& dereg_type);
void getDeregistrationType(_5gs_deregistration_type_t& type);
void getngKSI(uint8_t& ng_ksi);
bool getngKSI(uint8_t& ng_ksi);
void getMobilityIdentityType(uint8_t& type);
std::string get_5g_guti();
bool getSuciSupiFormatImsi(nas::SUCI_imsi_t& imsi);
......
......@@ -92,13 +92,14 @@ void RegistrationRequest::setngKSI(uint8_t tsc, uint8_t key_set_id) {
}
//------------------------------------------------------------------------------
uint8_t RegistrationRequest::getngKSI() {
bool RegistrationRequest::getngKSI(uint8_t& ng_ksi) {
if (ie_ngKSI) {
return (
(ie_ngKSI->getTypeOfSecurityContext()) |
ie_ngKSI->getasKeyIdentifier());
ng_ksi =
(ie_ngKSI->getTypeOfSecurityContext()) | ie_ngKSI->getasKeyIdentifier();
return true;
} else {
return 0;
// ng_ksi = 0;
return false;
}
}
......
......@@ -93,7 +93,7 @@ class RegistrationRequest {
void setEPS_Bearer_Context_Status(uint16_t value);
bool get5GSRegistrationType(bool& is_for, uint8_t& reg_type /*3bits*/);
uint8_t getngKSI();
bool getngKSI(uint8_t& ng_ksi);
uint8_t getMobilityIdentityType();
std::string get_5g_guti(); //"error" for missing IE GUTI
bool getSuciSupiFormatImsi(nas::SUCI_imsi_t& imsi);
......
......@@ -246,13 +246,13 @@ int ServiceRequest::decodefrombuffer(
}
//------------------------------------------------------------------------------
uint8_t ServiceRequest::getngKSI() {
bool ServiceRequest::getngKSI(uint8_t& ng_ksi) {
if (ie_ngKSI) {
uint8_t a = 0;
a = (ie_ngKSI->getTypeOfSecurityContext()) | ie_ngKSI->getasKeyIdentifier();
return a;
ng_ksi =
(ie_ngKSI->getTypeOfSecurityContext()) | ie_ngKSI->getasKeyIdentifier();
return true;
} else {
return 0;
return false;
}
}
......
......@@ -56,7 +56,7 @@ class ServiceRequest {
public:
int decodefrombuffer(NasMmPlainHeader* header, uint8_t* buf, int len);
uint8_t getngKSI();
bool getngKSI(uint8_t& ng_ksi);
uint8_t getServiceType();
bool get5G_S_TMSI(uint16_t& amfSetId, uint8_t& amfPointer, string& tmsi);
uint16_t getUplinkDataStatus();
......
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