Commit 667b6c1f authored by aligungr's avatar aligungr

UAC implementation

parent b4ef5a13
......@@ -101,7 +101,7 @@ class NasMm
private: /* Transport */
void receiveDlNasTransport(const nas::DlNasTransport &msg);
EProcRc deliverUlTransport(const nas::UlNasTransport &msg);
EProcRc deliverUlTransport(const nas::UlNasTransport &msg, ENasTransportHint hint);
private: /* Registration */
EProcRc sendInitialRegistration(EInitialRegCause regCause);
......
......@@ -48,6 +48,12 @@ EProcRc NasMm::sendInitialRegistration(EInitialRegCause regCause)
}
}
// Perform Unified Access Control
if (m_cmState == ECmState::CM_IDLE && performUac() != EUacResult::ALLOWED)
{
return EProcRc::STAY;
}
m_logger->debug("Sending %s",
nas::utils::EnumToString(isEmergencyReg ? nas::ERegistrationType::EMERGENCY_REGISTRATION
: nas::ERegistrationType::INITIAL_REGISTRATION));
......@@ -158,6 +164,12 @@ EProcRc NasMm::sendMobilityRegistration(ERegUpdateCause updateCause)
m_timers->t3517.stop();
}
// Perform Unified Access Control
if (m_cmState == ECmState::CM_IDLE && performUac() != EUacResult::ALLOWED)
{
return EProcRc::STAY;
}
m_logger->debug("Sending %s with update cause [%s]",
nas::utils::EnumToString(updateCause == ERegUpdateCause::T3512_EXPIRY
? nas::ERegistrationType::PERIODIC_REGISTRATION_UPDATING
......
......@@ -91,6 +91,12 @@ EProcRc NasMm::sendServiceRequest(EServiceReqCause reqCause)
}
}
// Perform Unified Access Control
if (performUac() != EUacResult::ALLOWED)
{
return EProcRc::STAY;
}
m_logger->debug("Sending Service Request due to [%s]", ToJson(reqCause).str().c_str());
updateProvidedGuti();
......
......@@ -107,7 +107,7 @@ void NasMm::receiveDlNasTransport(const nas::DlNasTransport &msg)
}
}
EProcRc NasMm::deliverUlTransport(const nas::UlNasTransport &msg)
EProcRc NasMm::deliverUlTransport(const nas::UlNasTransport &msg, ENasTransportHint hint)
{
// 5.4.5.2.6 Abnormal cases in the UE
// "The UE shall not send the UL NAS TRANSPORT message when the UE is in non-allowed area or
......@@ -130,6 +130,15 @@ EProcRc NasMm::deliverUlTransport(const nas::UlNasTransport &msg)
}
}
// Perform UAC for PDU session establishment and modification
if (hint == ENasTransportHint::PDU_SESSION_ESTABLISHMENT_REQUEST || hint == ENasTransportHint::PDU_SESSION_MODIFICATION_REQUEST)
{
if (performUac() != EUacResult::ALLOWED)
{
return EProcRc::STAY;
}
}
// Send the UL NAS Transport Message
auto rc = sendNasMessage(msg);
if (rc != EProcRc::OK)
......
......@@ -7,12 +7,56 @@
//
#include "sm.hpp"
#include <stdexcept>
#include <lib/nas/utils.hpp>
#include <ue/nas/mm/mm.hpp>
namespace nr::ue
{
static ENasTransportHint MapMsgTypeToHint(nas::EMessageType msgType)
{
switch (msgType)
{
case nas::EMessageType::PDU_SESSION_ESTABLISHMENT_REQUEST:
return ENasTransportHint::PDU_SESSION_ESTABLISHMENT_REQUEST;
case nas::EMessageType::PDU_SESSION_ESTABLISHMENT_ACCEPT:
return ENasTransportHint::PDU_SESSION_ESTABLISHMENT_ACCEPT;
case nas::EMessageType::PDU_SESSION_ESTABLISHMENT_REJECT:
return ENasTransportHint::PDU_SESSION_ESTABLISHMENT_REJECT;
case nas::EMessageType::PDU_SESSION_AUTHENTICATION_COMMAND:
return ENasTransportHint::PDU_SESSION_AUTHENTICATION_COMMAND;
case nas::EMessageType::PDU_SESSION_AUTHENTICATION_COMPLETE:
return ENasTransportHint::PDU_SESSION_AUTHENTICATION_COMPLETE;
case nas::EMessageType::PDU_SESSION_AUTHENTICATION_RESULT:
return ENasTransportHint::PDU_SESSION_AUTHENTICATION_RESULT;
case nas::EMessageType::PDU_SESSION_MODIFICATION_REQUEST:
return ENasTransportHint::PDU_SESSION_MODIFICATION_REQUEST;
case nas::EMessageType::PDU_SESSION_MODIFICATION_REJECT:
return ENasTransportHint::PDU_SESSION_MODIFICATION_REJECT;
case nas::EMessageType::PDU_SESSION_MODIFICATION_COMMAND:
return ENasTransportHint::PDU_SESSION_MODIFICATION_COMMAND;
case nas::EMessageType::PDU_SESSION_MODIFICATION_COMPLETE:
return ENasTransportHint::PDU_SESSION_MODIFICATION_COMPLETE;
case nas::EMessageType::PDU_SESSION_MODIFICATION_COMMAND_REJECT:
return ENasTransportHint::PDU_SESSION_MODIFICATION_COMMAND_REJECT;
case nas::EMessageType::PDU_SESSION_RELEASE_REQUEST:
return ENasTransportHint::PDU_SESSION_RELEASE_REQUEST;
case nas::EMessageType::PDU_SESSION_RELEASE_REJECT:
return ENasTransportHint::PDU_SESSION_RELEASE_REJECT;
case nas::EMessageType::PDU_SESSION_RELEASE_COMMAND:
return ENasTransportHint::PDU_SESSION_RELEASE_COMMAND;
case nas::EMessageType::PDU_SESSION_RELEASE_COMPLETE:
return ENasTransportHint::PDU_SESSION_RELEASE_COMPLETE;
case nas::EMessageType::FIVEG_SM_STATUS:
return ENasTransportHint::FIVEG_SM_STATUS;
default:
throw std::runtime_error("failure in MapMsgTypeToHint");
}
}
void NasSm::sendSmMessage(int psi, const nas::SmMessage &msg)
{
auto &session = m_pduSessions[psi];
......@@ -35,7 +79,7 @@ void NasSm::sendSmMessage(int psi, const nas::SmMessage &msg)
m.dnn = nas::utils::DnnFromApn(*session->apn);
}
m_mm->deliverUlTransport(m);
m_mm->deliverUlTransport(m, MapMsgTypeToHint(msg.messageType));
}
void NasSm::receiveSmMessage(const nas::SmMessage &msg)
......@@ -95,7 +139,7 @@ void NasSm::sendSmCause(const nas::ESmCause &cause, int pti, int psi)
ulTransport.pduSessionId = nas::IEPduSessionIdentity2{};
ulTransport.pduSessionId->value = psi;
m_mm->deliverUlTransport(ulTransport);
m_mm->deliverUlTransport(ulTransport, ENasTransportHint::FIVEG_SM_STATUS);
}
void NasSm::receiveForwardingFailure(const nas::SmMessage &msg, nas::EMmCause cause,
......
......@@ -592,6 +592,30 @@ struct UacOutput
EUacResult res{};
};
enum class ENasTransportHint
{
PDU_SESSION_ESTABLISHMENT_REQUEST,
PDU_SESSION_ESTABLISHMENT_ACCEPT,
PDU_SESSION_ESTABLISHMENT_REJECT,
PDU_SESSION_AUTHENTICATION_COMMAND,
PDU_SESSION_AUTHENTICATION_COMPLETE,
PDU_SESSION_AUTHENTICATION_RESULT,
PDU_SESSION_MODIFICATION_REQUEST,
PDU_SESSION_MODIFICATION_REJECT,
PDU_SESSION_MODIFICATION_COMMAND,
PDU_SESSION_MODIFICATION_COMPLETE,
PDU_SESSION_MODIFICATION_COMMAND_REJECT,
PDU_SESSION_RELEASE_REQUEST,
PDU_SESSION_RELEASE_REJECT,
PDU_SESSION_RELEASE_COMMAND,
PDU_SESSION_RELEASE_COMPLETE,
FIVEG_SM_STATUS
};
Json ToJson(const ECmState &state);
Json ToJson(const ERmState &state);
Json ToJson(const EMmState &state);
......
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