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
b1aa51a8
Commit
b1aa51a8
authored
Feb 23, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Registration reject improvement
parent
afbb2569
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
38 deletions
+95
-38
src/ue/mm/mm.hpp
src/ue/mm/mm.hpp
+3
-0
src/ue/mm/register.cpp
src/ue/mm/register.cpp
+87
-35
src/ue/nas/storage.hpp
src/ue/nas/storage.hpp
+5
-3
No files found.
src/ue/mm/mm.hpp
View file @
b1aa51a8
...
...
@@ -45,6 +45,8 @@ class NasMm
bool
m_lastDeregDueToDisable5g
{};
// Last time PLMN search is triggered
long
m_lastPlmnSearchTrigger
{};
// Registration attempt counter
int
m_regCounter
{};
friend
class
UeCmdHandler
;
...
...
@@ -95,6 +97,7 @@ class NasMm
void
sendRegistration
(
nas
::
ERegistrationType
registrationType
,
nas
::
EFollowOnRequest
followOn
);
void
receiveRegistrationAccept
(
const
nas
::
RegistrationAccept
&
msg
);
void
receiveRegistrationReject
(
const
nas
::
RegistrationReject
&
msg
);
void
incrementRegistrationAttempt
();
/* Authentication */
void
receiveAuthenticationRequest
(
const
nas
::
AuthenticationRequest
&
msg
);
...
...
src/ue/mm/register.cpp
View file @
b1aa51a8
...
...
@@ -124,12 +124,11 @@ void NasMm::receiveRegistrationReject(const nas::RegistrationReject &msg)
nas
::
utils
::
EnumToString
(
msg
.
eapMessage
->
eap
->
code
));
}
auto
unhandledRejectCase
=
[
cause
,
this
]()
{
m_storage
.
discardUsim
();
switchRmState
(
ERmState
::
RM_DEREGISTERED
);
m_logger
->
err
(
"Registration rejected with unhandled MMCause: %s"
,
nas
::
utils
::
EnumToString
(
cause
));
switchMmState
(
EMmState
::
MM_DEREGISTERED
,
EMmSubState
::
MM_DEREGISTERED_NA
);
switchRmState
(
ERmState
::
RM_DEREGISTERED
);
auto
handleAbnormalCase
=
[
cause
,
this
]()
{
m_logger
->
debug
(
"Handling Registration Reject abnormal case"
);
// todo
};
if
(
regType
==
nas
::
ERegistrationType
::
INITIAL_REGISTRATION
)
...
...
@@ -137,24 +136,86 @@ void NasMm::receiveRegistrationReject(const nas::RegistrationReject &msg)
if
(
cause
==
nas
::
EMmCause
::
ILLEGAL_UE
||
cause
==
nas
::
EMmCause
::
ILLEGAL_ME
||
cause
==
nas
::
EMmCause
::
FIVEG_SERVICES_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
PLMN_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
TA_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
ROAMING_NOT_ALLOWED_IN_TA
||
cause
==
nas
::
EMmCause
::
NO_SUITIBLE_CELLS_IN_TA
)
cause
==
nas
::
EMmCause
::
NO_SUITIBLE_CELLS_IN_TA
||
cause
==
nas
::
EMmCause
::
N1_MODE_NOT_ALLOWED
)
{
switchUState
(
E5UState
::
U3_ROAMING_NOT_ALLOWED
);
m_storage
.
invalidateSim
();
}
if
(
cause
==
nas
::
EMmCause
::
SERVING_NETWORK_NOT_AUTHORIZED
)
{
switchUState
(
E5UState
::
U2_NOT_UPDATED
);
}
if
(
cause
==
nas
::
EMmCause
::
ILLEGAL_UE
||
cause
==
nas
::
EMmCause
::
ILLEGAL_ME
||
cause
==
nas
::
EMmCause
::
FIVEG_SERVICES_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
PLMN_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
TA_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
ROAMING_NOT_ALLOWED_IN_TA
||
cause
==
nas
::
EMmCause
::
NO_SUITIBLE_CELLS_IN_TA
||
cause
==
nas
::
EMmCause
::
N1_MODE_NOT_ALLOWED
)
{
m_storage
.
m_storedGuti
=
{};
m_storage
.
m_lastVisitedRegisteredTai
=
{};
m_storage
.
m_taiList
=
{};
m_storage
.
m_currentNsCtx
=
{};
m_storage
.
m_nonCurrentNsCtx
=
{};
}
// TODO Normally UE switches to PLMN SEARCH, but this leads to endless registration attempt again and again.
// due to RLS.
// switchMmState(EMmState::MM_DEREGISTERED, EMmSubState::MM_DEREGISTERED_PLMN_SEARCH);
if
(
cause
==
nas
::
EMmCause
::
ILLEGAL_UE
||
cause
==
nas
::
EMmCause
::
ILLEGAL_ME
||
cause
==
nas
::
EMmCause
::
FIVEG_SERVICES_NOT_ALLOWED
)
{
m_storage
.
invalidateSim__
();
}
if
(
cause
==
nas
::
EMmCause
::
ILLEGAL_UE
||
cause
==
nas
::
EMmCause
::
ILLEGAL_ME
||
cause
==
nas
::
EMmCause
::
FIVEG_SERVICES_NOT_ALLOWED
)
{
switchMmState
(
EMmState
::
MM_DEREGISTERED
,
EMmSubState
::
MM_DEREGISTERED_NA
);
}
if
(
cause
==
nas
::
EMmCause
::
TA_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
ROAMING_NOT_ALLOWED_IN_TA
||
cause
==
nas
::
EMmCause
::
NO_SUITIBLE_CELLS_IN_TA
)
{
switchMmState
(
EMmState
::
MM_DEREGISTERED
,
EMmSubState
::
MM_DEREGISTERED_LIMITED_SERVICE
);
}
if
(
cause
==
nas
::
EMmCause
::
N1_MODE_NOT_ALLOWED
)
{
switchMmState
(
EMmState
::
MM_NULL
,
EMmSubState
::
MM_NULL_NA
);
// TODO: disable n1 mode capability (See 4.9)
}
if
(
cause
==
nas
::
EMmCause
::
PLMN_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
SERVING_NETWORK_NOT_AUTHORIZED
)
{
switchMmState
(
EMmState
::
MM_DEREGISTERED
,
EMmSubState
::
MM_DEREGISTERED_PLMN_SEARCH
);
}
if
(
cause
==
nas
::
EMmCause
::
PLMN_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
TA_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
ROAMING_NOT_ALLOWED_IN_TA
||
cause
==
nas
::
EMmCause
::
NO_SUITIBLE_CELLS_IN_TA
||
cause
==
nas
::
EMmCause
::
N1_MODE_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
SERVING_NETWORK_NOT_AUTHORIZED
)
{
m_regCounter
=
0
;
}
if
(
cause
==
nas
::
EMmCause
::
ILLEGAL_UE
||
cause
==
nas
::
EMmCause
::
ILLEGAL_ME
||
cause
==
nas
::
EMmCause
::
PLMN_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
ROAMING_NOT_ALLOWED_IN_TA
)
{
m_storage
.
m_equivalentPlmnList
=
{};
}
switchRmState
(
ERmState
::
RM_DEREGISTERED
);
if
(
cause
==
nas
::
EMmCause
::
ROAMING_NOT_ALLOWED_IN_TA
||
cause
==
nas
::
EMmCause
::
NO_SUITIBLE_CELLS_IN_TA
)
{
// TODO add to forbidden tai
}
else
if
(
cause
==
nas
::
EMmCause
::
CONGESTION
)
if
(
cause
==
nas
::
EMmCause
::
PLMN_NOT_ALLOWED
||
cause
==
nas
::
EMmCause
::
SERVING_NETWORK_NOT_AUTHORIZED
)
{
// todo add to forbidden plmn
}
if
(
cause
==
nas
::
EMmCause
::
CONGESTION
)
{
if
(
msg
.
t3346value
.
has_value
()
&&
nas
::
utils
::
HasValue
(
*
msg
.
t3346value
))
{
switchUState
(
E5UState
::
U2_NOT_UPDATED
);
switchMmState
(
EMmState
::
MM_DEREGISTERED
,
EMmSubState
::
MM_DEREGISTERED_ATTEMPTING_REGISTRATION
);
switchRmState
(
ERmState
::
RM_DEREGISTERED
);
m_timers
->
t3346
.
stop
();
if
(
msg
.
sht
!=
nas
::
ESecurityHeaderType
::
NOT_PROTECTED
)
...
...
@@ -164,41 +225,32 @@ void NasMm::receiveRegistrationReject(const nas::RegistrationReject &msg)
}
else
{
// TODO abnormal case see 5.5.1.2.7.
unhandledRejectCase
();
handleAbnormalCase
();
}
}
else
if
(
cause
==
nas
::
EMmCause
::
N1_MODE_NOT_ALLOWED
)
{
m_storage
.
discardUsim
();
switchMmState
(
EMmState
::
MM_NULL
,
EMmSubState
::
MM_NULL_NA
);
switchRmState
(
ERmState
::
RM_DEREGISTERED
);
}
else
if
(
cause
!=
nas
::
EMmCause
::
ILLEGAL_UE
&&
cause
!=
nas
::
EMmCause
::
ILLEGAL_ME
&&
cause
!=
nas
::
EMmCause
::
FIVEG_SERVICES_NOT_ALLOWED
&&
cause
!=
nas
::
EMmCause
::
PLMN_NOT_ALLOWED
&&
cause
!=
nas
::
EMmCause
::
TA_NOT_ALLOWED
&&
cause
!=
nas
::
EMmCause
::
ROAMING_NOT_ALLOWED_IN_TA
&&
cause
!=
nas
::
EMmCause
::
NO_SUITIBLE_CELLS_IN_TA
&&
cause
!=
nas
::
EMmCause
::
CONGESTION
&&
cause
!=
nas
::
EMmCause
::
N1_MODE_NOT_ALLOWED
&&
cause
!=
nas
::
EMmCause
::
SERVING_NETWORK_NOT_AUTHORIZED
)
{
// TODO
unhandledRejectCase
();
handleAbnormalCase
();
}
}
else
if
(
regType
==
nas
::
ERegistrationType
::
EMERGENCY_REGISTRATION
)
{
if
(
cause
==
nas
::
EMmCause
::
PEI_NOT_ACCEPTED
)
{
// TODO
unhandledRejectCase
();
}
else
{
// TODO: abnormal case
unhandledRejectCase
();
}
// TODO
}
else
{
// TODO
unhandledRejectCase
();
}
}
void
NasMm
::
incrementRegistrationAttempt
()
{
m_regCounter
++
;
}
}
// namespace nr::ue
\ No newline at end of file
src/ue/nas/storage.hpp
View file @
b1aa51a8
...
...
@@ -29,7 +29,10 @@ class MobileStorage
nas
::
IE5gsMobileIdentity
m_storedSuci
{};
// Plmn related
std
::
optional
<
nas
::
IE5gsTrackingAreaIdentityList
>
m_taiList
{};
nas
::
IE5gsTrackingAreaIdentityList
m_taiList
{};
nas
::
IE5gsTrackingAreaIdentityList
m_forbiddenTaiList
{};
nas
::
IEPlmnList
m_equivalentPlmnList
{};
nas
::
IEPlmnList
m_forbiddenPlmnList
{};
// Security related
std
::
optional
<
NasSecurityContext
>
m_currentNsCtx
{};
...
...
@@ -72,10 +75,9 @@ class MobileStorage
discardSecurity
();
}
void
invalidateSim
()
void
invalidateSim
__
()
{
// TODO: log
discardUsim
();
m_simIsValid
=
false
;
}
...
...
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