Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
UERANSIM
Commits
0cf24f02
Commit
0cf24f02
authored
Mar 30, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PDU session establishment reject improvements
parent
8cceeae6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
28 deletions
+74
-28
src/ue/sm/establishment.cpp
src/ue/sm/establishment.cpp
+34
-28
src/ue/sm/sm.hpp
src/ue/sm/sm.hpp
+3
-0
src/ue/sm/utils.cpp
src/ue/sm/utils.cpp
+37
-0
No files found.
src/ue/sm/establishment.cpp
View file @
0cf24f02
...
@@ -129,38 +129,25 @@ void NasSm::receivePduSessionEstablishmentAccept(const nas::PduSessionEstablishm
...
@@ -129,38 +129,25 @@ void NasSm::receivePduSessionEstablishmentAccept(const nas::PduSessionEstablishm
{
{
m_logger
->
debug
(
"PDU Session Establishment Accept received"
);
m_logger
->
debug
(
"PDU Session Establishment Accept received"
);
if
(
msg
.
smCause
.
has_value
())
if
(
!
checkPtiAndPsi
(
msg
))
{
m_logger
->
warn
(
"SM cause received in PduSessionEstablishmentAccept [%s]"
,
nas
::
utils
::
EnumToString
(
msg
.
smCause
->
value
));
}
if
(
msg
.
pti
<
ProcedureTransaction
::
MIN_ID
||
msg
.
pti
>
ProcedureTransaction
::
MAX_ID
)
{
// PTI is required for PDU session establishment request
m_logger
->
err
(
"Received PTI [%d] value is invalid"
,
msg
.
pti
);
sendSmCause
(
nas
::
ESmCause
::
INVALID_PTI_VALUE
,
msg
.
pduSessionId
);
return
;
return
;
}
if
(
m_procedureTransactions
[
msg
.
pti
].
psi
!=
msg
.
pduSessionId
)
{
m_logger
->
err
(
"Received PSI value [%d] is invalid, expected was [%d]"
,
msg
.
pduSessionId
,
m_procedureTransactions
[
msg
.
pti
].
psi
);
sendSmCause
(
nas
::
ESmCause
::
INVALID_PTI_VALUE
,
msg
.
pduSessionId
);
return
;
}
freeProcedureTransactionId
(
msg
.
pti
);
freeProcedureTransactionId
(
msg
.
pti
);
auto
&
pduSession
=
m_pduSessions
[
msg
.
pduSessionId
];
auto
&
pduSession
=
m_pduSessions
[
msg
.
pduSessionId
];
if
(
pduSession
->
psState
!=
EPsState
::
ACTIVE_PENDING
)
if
(
pduSession
->
psState
!=
EPsState
::
ACTIVE_PENDING
)
{
{
m_logger
->
err
(
"PS establishment accept received without requested"
);
m_logger
->
err
(
"PS establishment accept received without
being
requested"
);
sendSmCause
(
nas
::
ESmCause
::
MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE
,
pduSession
->
psi
);
sendSmCause
(
nas
::
ESmCause
::
MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE
,
pduSession
->
psi
);
return
;
return
;
}
}
if
(
msg
.
smCause
.
has_value
())
{
m_logger
->
warn
(
"SM cause received in PduSessionEstablishmentAccept [%s]"
,
nas
::
utils
::
EnumToString
(
msg
.
smCause
->
value
));
}
pduSession
->
psState
=
EPsState
::
ACTIVE
;
pduSession
->
psState
=
EPsState
::
ACTIVE
;
pduSession
->
authorizedQoSRules
=
nas
::
utils
::
DeepCopyIe
(
msg
.
authorizedQoSRules
);
pduSession
->
authorizedQoSRules
=
nas
::
utils
::
DeepCopyIe
(
msg
.
authorizedQoSRules
);
pduSession
->
sessionAmbr
=
nas
::
utils
::
DeepCopyIe
(
msg
.
sessionAmbr
);
pduSession
->
sessionAmbr
=
nas
::
utils
::
DeepCopyIe
(
msg
.
sessionAmbr
);
...
@@ -183,12 +170,6 @@ void NasSm::receivePduSessionEstablishmentAccept(const nas::PduSessionEstablishm
...
@@ -183,12 +170,6 @@ void NasSm::receivePduSessionEstablishmentAccept(const nas::PduSessionEstablishm
m_logger
->
info
(
"PDU Session establishment is successful PSI[%d]"
,
pduSession
->
psi
);
m_logger
->
info
(
"PDU Session establishment is successful PSI[%d]"
,
pduSession
->
psi
);
}
}
void
NasSm
::
receivePduSessionEstablishmentReject
(
const
nas
::
PduSessionEstablishmentReject
&
msg
)
{
m_logger
->
err
(
"PDU Session Establishment Reject received [%s]"
,
nas
::
utils
::
EnumToString
(
msg
.
smCause
.
value
));
// TODO
}
void
NasSm
::
abortEstablishmentRequest
(
int
pti
)
void
NasSm
::
abortEstablishmentRequest
(
int
pti
)
{
{
int
psi
=
m_procedureTransactions
[
pti
].
psi
;
int
psi
=
m_procedureTransactions
[
pti
].
psi
;
...
@@ -199,4 +180,29 @@ void NasSm::abortEstablishmentRequest(int pti)
...
@@ -199,4 +180,29 @@ void NasSm::abortEstablishmentRequest(int pti)
freePduSessionId
(
psi
);
freePduSessionId
(
psi
);
}
}
void
NasSm
::
receivePduSessionEstablishmentReject
(
const
nas
::
PduSessionEstablishmentReject
&
msg
)
{
m_logger
->
err
(
"PDU Session Establishment Reject received [%s]"
,
nas
::
utils
::
EnumToString
(
msg
.
smCause
.
value
));
if
(
!
checkPtiAndPsi
(
msg
))
return
;
freeProcedureTransactionId
(
msg
.
pti
);
auto
&
pduSession
=
m_pduSessions
[
msg
.
pduSessionId
];
if
(
pduSession
->
psState
!=
EPsState
::
ACTIVE_PENDING
)
{
m_logger
->
err
(
"PS establishment reject received without being requested"
);
sendSmCause
(
nas
::
ESmCause
::
MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE
,
pduSession
->
psi
);
return
;
}
pduSession
->
psState
=
EPsState
::
INACTIVE
;
if
(
pduSession
->
isEmergency
)
{
// This not much important and no need for now
// TODO: inform the upper layers of the failure of the procedure
}
}
}
// namespace nr::ue
}
// namespace nr::ue
\ No newline at end of file
src/ue/sm/sm.hpp
View file @
0cf24f02
...
@@ -74,6 +74,9 @@ class NasSm
...
@@ -74,6 +74,9 @@ class NasSm
void
onTimerExpire
(
nas
::
NasTimer
&
timer
);
void
onTimerExpire
(
nas
::
NasTimer
&
timer
);
void
onTransactionTimerExpire
(
int
pti
);
void
onTransactionTimerExpire
(
int
pti
);
/* Utils */
bool
checkPtiAndPsi
(
const
nas
::
SmMessage
&
msg
);
public:
public:
/* Interface */
/* Interface */
void
handleNasEvent
(
const
NwUeNasToNas
&
msg
);
// used by NAS
void
handleNasEvent
(
const
NwUeNasToNas
&
msg
);
// used by NAS
...
...
src/ue/sm/utils.cpp
0 → 100644
View file @
0cf24f02
//
// This file is a part of UERANSIM open source project.
// Copyright (c) 2021 ALİ GÜNGÖR.
//
// The software and all associated files are licensed under GPL-3.0
// and subject to the terms and conditions defined in LICENSE file.
//
#include "sm.hpp"
#include <nas/utils.hpp>
#include <ue/app/task.hpp>
#include <ue/mm/mm.hpp>
namespace
nr
::
ue
{
bool
NasSm
::
checkPtiAndPsi
(
const
nas
::
SmMessage
&
msg
)
{
if
(
msg
.
pti
<
ProcedureTransaction
::
MIN_ID
||
msg
.
pti
>
ProcedureTransaction
::
MAX_ID
)
{
m_logger
->
err
(
"Received PTI [%d] value is invalid"
,
msg
.
pti
);
sendSmCause
(
nas
::
ESmCause
::
INVALID_PTI_VALUE
,
msg
.
pduSessionId
);
return
false
;
}
if
(
m_procedureTransactions
[
msg
.
pti
].
psi
!=
msg
.
pduSessionId
)
{
m_logger
->
err
(
"Received PSI value [%d] is invalid, expected was [%d]"
,
msg
.
pduSessionId
,
m_procedureTransactions
[
msg
.
pti
].
psi
);
sendSmCause
(
nas
::
ESmCause
::
INVALID_PTI_VALUE
,
msg
.
pduSessionId
);
return
false
;
}
return
true
;
}
}
// namespace nr::ue
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment