Unverified Commit 19bd6bb4 authored by Ali Güngör's avatar Ali Güngör Committed by GitHub

Merge pull request #263 from aligungr/dev

milenage.cpp compilation fix
parents 7949f681 159e260a
......@@ -8,6 +8,7 @@
#include "milenage.hpp"
#include <crypt-ext/milenage.hpp>
#include <stdexcept>
namespace crypto::milenage
{
......
......@@ -8,37 +8,168 @@
#include "mm.hpp"
#include <nas/utils.hpp>
namespace nr::ue
{
void NasMm::receiveConfigurationUpdate(const nas::ConfigurationUpdateCommand &msg)
{
// Indicates there exists at least one configuration to be updated
bool hasNewConfig = false;
// "Upon receiving the CONFIGURATION UPDATE COMMAND message, the UE shall stop timer T3346 if running"
m_timers->t3346.stop();
// "If the UE receives a new 5G-GUTI in the CONFIGURATION UPDATE COMMAND message, the UE shall consider the new
// 5G-GUTI as valid, the old 5G-GUTI as invalid, stop timer T3519 if running, and delete any stored SUCI;"
if (msg.guti.has_value() && msg.guti->type == nas::EIdentityType::GUTI)
{
hasNewConfig = true;
m_storage.m_storedSuci = {};
m_storage.m_storedGuti = *msg.guti;
m_timers->t3519.stop();
}
// "If the UE receives a new TAI list in the CONFIGURATION UPDATE COMMAND message, the UE shall consider the new TAI
// list as valid and the old TAI list as invalid; otherwise, the UE shall consider the old TAI list as valid."
if (msg.taiList.has_value())
m_storage.m_taiList = msg.taiList.value();
{
hasNewConfig = true;
m_storage.m_taiList = *msg.taiList;
}
// "If the UE receives a new service area list in the CONFIGURATION UPDATE COMMAND message, the UE shall consider
// the
// new service area list as valid and the old service area list as invalid; otherwise, the UE shall consider the
// old service area list, if any, as valid."
if (msg.serviceAreaList.has_value())
{
hasNewConfig = true;
m_storage.m_serviceAreaList = *msg.serviceAreaList;
}
// "If the UE receives new NITZ information in the CONFIGURATION UPDATE COMMAND message, the UE considers the new
// NITZ information as valid and the old NITZ information as invalid; otherwise, the UE shall consider the old NITZ
// information as valid."
if (msg.networkFullName.has_value())
{
hasNewConfig = true;
m_storage.networkFullName = nas::utils::DeepCopyIe(*msg.networkFullName);
}
if (msg.networkShortName.has_value())
{
hasNewConfig = true;
m_storage.networkShortName = nas::utils::DeepCopyIe(*msg.networkShortName);
}
if (msg.localTimeZone.has_value())
{
hasNewConfig = true;
m_storage.localTimeZone = *msg.localTimeZone;
}
if (msg.universalTimeAndLocalTimeZone.has_value())
{
hasNewConfig = true;
m_storage.universalTimeAndLocalTimeZone = *msg.universalTimeAndLocalTimeZone;
}
if (msg.networkDaylightSavingTime.has_value())
{
hasNewConfig = true;
m_storage.networkDaylightSavingTime = *msg.networkDaylightSavingTime;
}
// "If the UE receives a new allowed NSSAI for the associated access type in the CONFIGURATION UPDATE COMMAND
// message, the UE shall consider the new allowed NSSAI as valid for the associated access type, store the allowed
// NSSAI for the associated access type as specified in subclause 4.6.2.2 and consider the old allowed NSSAI for
// the associated access type as invalid; otherwise, the UE shall consider the old Allowed NSSAI as valid for the
// associated access type."
if (msg.allowedNssai.has_value())
{
hasNewConfig = true;
m_storage.m_allowedNssai = nas::utils::NssaiTo(*msg.allowedNssai);
}
// "If the UE receives a new configured NSSAI in the CONFIGURATION UPDATE COMMAND message, the UE shall consider the
// new configured NSSAI for the registered PLMN as valid and the old configured NSSAI for the registered PLMN as
// invalid; otherwise, the UE shall consider the old configured NSSAI for the registered PLMN as valid The UE shall
// store the new configured NSSAI as specified in subclause 4.6.2.2."
if (msg.configuredNssai.has_value())
{
hasNewConfig = true;
m_storage.m_configuredNssai = nas::utils::NssaiTo(*msg.configuredNssai);
}
// "If the UE receives the Network slicing indication IE in the CONFIGURATION UPDATE COMMAND message with the
// Network slicing subscription change indication set to "Network slicing subscription changed", the UE shall
// delete the network slicing information for each and every PLMN except for the current PLMN as specified in
// subclause 4.6.2.2."
if (msg.networkSlicingIndication.has_value() &&
msg.networkSlicingIndication->nssci == nas::ENetworkSlicingSubscriptionChangeIndication::CHANGED)
{
hasNewConfig = true;
handleNetworkSlicingSubscriptionChange();
}
// "The UE receiving the rejected NSSAI in the CONFIGURATION UPDATE COMMAND message takes the following actions
// based on the rejection cause in the rejected NSSAI: .."
if (msg.rejectedNssai.has_value())
{
hasNewConfig = true;
for (auto &rejectedSlice : msg.rejectedNssai->list)
{
SingleSlice slice{};
slice.sst = rejectedSlice.sst;
slice.sd = rejectedSlice.sd;
if (msg.configurationUpdateIndication.has_value())
auto &list = rejectedSlice.cause == nas::ERejectedSNssaiCause::NA_IN_PLMN ? m_storage.m_rejectedNssaiInPlmn
: m_storage.m_rejectedNssaiInTa;
list.addIfNotExists(slice);
}
}
// "If the CONFIGURATION UPDATE COMMAND message indicates "registration requested" in the Configuration update
// indication IE and:"
if (msg.configurationUpdateIndication.has_value() &&
msg.configurationUpdateIndication->red == nas::ERegistrationRequested::REQUESTED)
{
if (msg.configurationUpdateIndication.has_value())
// "contains no other parameters or contains at least one of the following parameters: a new allowed NSSAI,
// a new configured NSSAI or the Network slicing subscription change indication, and:"
if (!hasNewConfig || (msg.allowedNssai.has_value() || msg.configuredNssai.has_value() ||
msg.networkSlicingIndication.has_value()))
{
if (msg.configurationUpdateIndication->red == nas::ERegistrationRequested::REQUESTED)
if (hasEmergency()) // "an emergency PDU session exists,"
{
// "the UE shall, after the completion of the generic UE configuration
// update procedure and after the emergency PDU session is released, release the existing N1 NAS
// signalling connection, and start a registration procedure for mobility and periodic registration
// update as specified in subclause 5.5.1.3;"
// TODO
}
if (msg.configurationUpdateIndication->ack == nas::EAcknowledgement::REQUESTED)
else // "no emergency PDU Session exists,"
{
nas::ConfigurationUpdateComplete resp;
sendNasMessage(resp);
// "the UE shall, after the completion of the generic UE configuration
// update procedure, and the release of the existing N1 NAS signalling connection, start a registration
// procedure for mobility and periodic registration update as specified in subclause 5.5.1.3;"
// TODO
}
}
if (msg.micoIndication.has_value() && !msg.allowedNssai.has_value() && !msg.configuredNssai.has_value())
{
// "an MICO indication is included without a new allowed NSSAI or a new configured NSSAI, the UE shall,
// after the completion of the generic UE configuration update procedure, start a registration procedure
// for mobility and registration update as specified in subclause 5.5.1.3 to re-negotiate MICO mode with
// the network."
// TODO
}
}
// "If acknowledgement requested is indicated in the Configuration update indication IE in the CONFIGURATION UPDATE
// COMMAND message, the UE shall send a CONFIGURATION UPDATE COMPLETE message."
if (msg.configurationUpdateIndication.has_value() &&
msg.configurationUpdateIndication->ack == nas::EAcknowledgement::REQUESTED)
{
sendNasMessage(nas::ConfigurationUpdateComplete{});
}
}
......
......@@ -48,6 +48,13 @@ class MobileStorage
NetworkSlice m_rejectedNssaiInPlmn{};
NetworkSlice m_rejectedNssaiInTa{};
// NITZ related
std::optional<nas::IENetworkName> networkFullName{};
std::optional<nas::IENetworkName> networkShortName{};
std::optional<nas::IETimeZone> localTimeZone{};
std::optional<nas::IETimeZoneAndTime> universalTimeAndLocalTimeZone{};
std::optional<nas::IEDaylightSavingTime> networkDaylightSavingTime{};
public:
void initialize(bool hasSupi, const UeConfig::Initials &initials)
{
......
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