Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-AMF
Commits
9cff5872
Commit
9cff5872
authored
Apr 28, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix_ue_information' into 'develop'
Fix ue information See merge request oai/cn5g/oai-cn5g-amf!110
parents
3228cbb1
551751d3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
122 additions
and
66 deletions
+122
-66
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+119
-63
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+1
-1
src/nas/msgs/DeregistrationRequest.cpp
src/nas/msgs/DeregistrationRequest.cpp
+1
-1
src/nas/msgs/RegistrationRequest.cpp
src/nas/msgs/RegistrationRequest.cpp
+1
-1
No files found.
src/amf-app/amf_n1.cpp
View file @
9cff5872
...
...
@@ -73,7 +73,6 @@ extern "C" {
#include "dynamic_memory_check.h"
}
// using namespace oai::amf::model;
using
namespace
nas
;
using
namespace
amf_application
;
using
namespace
config
;
...
...
@@ -86,6 +85,7 @@ extern amf_app* amf_app_inst;
extern
amf_n2
*
amf_n2_inst
;
extern
statistics
stacs
;
// Static variables
uint8_t
amf_n1
::
no_random_delta
=
0
;
std
::
map
<
std
::
string
,
std
::
string
>
amf_n1
::
rand_record
=
{};
...
...
@@ -482,7 +482,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind& nas_data_ind) {
blength
(
decoded_plain_msg
));
if
(
nas_data_ind
.
is_nas_signalling_estab_req
)
{
Logger
::
amf_n1
().
debug
(
"Received NAS
signalling e
stablishment request..."
);
Logger
::
amf_n1
().
debug
(
"Received NAS
Signalling E
stablishment request..."
);
comUt
::
print_buffer
(
"amf_n1"
,
"Decoded plain NAS Message buffer"
,
(
uint8_t
*
)
bdata
(
decoded_plain_msg
),
blength
(
decoded_plain_msg
));
...
...
@@ -530,11 +530,13 @@ void amf_n1::nas_signalling_establishment_request_handle(
// stacs.UE_connected += 1;
// Trigger UE Reachability Status Notify
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n1
().
debug
(
"Signal the UE Reachability Status Event notification for SUPI %s"
,
supi
.
c_str
());
event_sub
.
ue_reachability_status
(
supi
,
CM_CONNECTED
,
1
);
if
(
!
nc
.
get
()
->
imsi
.
empty
())
{
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n1
().
debug
(
"Signal the UE Reachability Status Event notification for SUPI %s"
,
supi
.
c_str
());
event_sub
.
ue_reachability_status
(
supi
,
CM_CONNECTED
,
1
);
}
}
else
{
Logger
::
amf_n1
().
debug
(
"Existing nas_context with amf_ue_ngap_id ("
AMF_UE_NGAP_ID_FMT
")"
,
...
...
@@ -550,13 +552,13 @@ void amf_n1::nas_signalling_establishment_request_handle(
switch
(
message_type
)
{
case
REGISTRATION_REQUEST
:
{
Logger
::
amf_n1
().
debug
(
"Received
registration r
equest message, handling..."
);
"Received
Registration R
equest message, handling..."
);
registration_request_handle
(
nc
,
ran_ue_ngap_id
,
amf_ue_ngap_id
,
snn
,
plain_msg
);
}
break
;
case
SERVICE_REQUEST
:
{
Logger
::
amf_n1
().
debug
(
"Received
service r
equest message, handling..."
);
Logger
::
amf_n1
().
debug
(
"Received
Service R
equest message, handling..."
);
if
(
!
nc
.
get
())
{
Logger
::
amf_n1
().
error
(
"No NAS Context found"
);
return
;
...
...
@@ -572,7 +574,7 @@ void amf_n1::nas_signalling_establishment_request_handle(
case
UE_INIT_DEREGISTER
:
{
Logger
::
amf_n1
().
debug
(
"Received
initialUeMessage de-registration r
equest message, "
"Received
InitialUeMessage De-registration R
equest message, "
"handling..."
);
// ue_initiate_de_registration_handle(ran_ue_ngap_id, amf_ue_ngap_id,
// plain_msg);
...
...
@@ -592,43 +594,42 @@ void amf_n1::uplink_nas_msg_handle(
switch
(
message_type
)
{
case
AUTHENTICATION_RESPONSE
:
{
Logger
::
amf_n1
().
debug
(
"Received
authentication r
esponse message, handling..."
);
"Received
Authentication R
esponse message, handling..."
);
authentication_response_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
}
break
;
case
AUTHENTICATION_FAILURE
:
{
Logger
::
amf_n1
().
debug
(
"Received
authentication f
ailure message, handling..."
);
"Received
Authentication F
ailure message, handling..."
);
authentication_failure_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
}
break
;
case
SECURITY_MODE_COMPLETE
:
{
Logger
::
amf_n1
().
debug
(
"Received
security mode c
omplete message, handling..."
);
"Received
Security Mode C
omplete message, handling..."
);
security_mode_complete_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
}
break
;
case
SECURITY_MODE_REJECT
:
{
Logger
::
amf_n1
().
debug
(
"Received
security mode r
eject message, handling..."
);
"Received
Security Mode R
eject message, handling..."
);
security_mode_reject_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
}
break
;
case
UL_NAS_TRANSPORT
:
{
Logger
::
amf_n1
().
debug
(
"Received
ul NAS t
ransport message, handling..."
);
Logger
::
amf_n1
().
debug
(
"Received
UL NAS T
ransport message, handling..."
);
ul_nas_transport_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
,
plmn
);
}
break
;
case
UE_INIT_DEREGISTER
:
{
Logger
::
amf_n1
().
debug
(
"Received
de-registration r
equest message, handling..."
);
"Received
De-registration R
equest message, handling..."
);
ue_initiate_de_registration_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
}
break
;
case
IDENTITY_RESPONSE
:
{
Logger
::
amf_n1
().
debug
(
"
received identity response message , handle
..."
);
Logger
::
amf_n1
().
debug
(
"
Received Identity Response message, handling
..."
);
identity_response_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
}
break
;
case
REGISTRATION_COMPLETE
:
{
Logger
::
amf_n1
().
debug
(
"Received
registration c
omplete message, handling..."
);
"Received
Registration C
omplete message, handling..."
);
registration_complete_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
// TODO
}
break
;
default:
{
Logger
::
amf_n1
().
debug
(
"Received Unknown message type, ignoring..."
);
...
...
@@ -681,7 +682,7 @@ void amf_n1::identity_response_handle(
Logger
::
amf_n1
().
error
(
"Decode Identity Response error"
);
return
;
}
string
supi
=
""
;
string
supi
=
{}
;
if
(
identity_response
->
ie_mobility_id
)
{
nas
::
SUCI_imsi_t
imsi
;
identity_response
->
ie_mobility_id
->
getSuciWithSupiImsi
(
imsi
);
...
...
@@ -709,13 +710,15 @@ void amf_n1::identity_response_handle(
if
(
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
{
nc
=
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
Logger
::
amf_n1
().
debug
(
"Find nas_context
(%p) by amf_ue_ngap_id
("
AMF_UE_NGAP_ID_FMT
")"
,
"Find nas_context
(%p) by amf_ue_ngap_id
("
AMF_UE_NGAP_ID_FMT
")"
,
nc
.
get
(),
amf_ue_ngap_id
);
}
else
{
nc
=
std
::
shared_ptr
<
nas_context
>
(
new
nas_context
);
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
nc
.
get
()
->
ctx_avaliability_ind
=
false
;
}
// Update Nas Context
nc
.
get
()
->
ctx_avaliability_ind
=
true
;
nc
.
get
()
->
nas_status
=
CM_CONNECTED
;
nc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
...
...
@@ -728,7 +731,43 @@ void amf_n1::identity_response_handle(
itti_inst
->
timer_remove
(
nc
.
get
()
->
mobile_reachable_timer
);
itti_inst
->
timer_remove
(
nc
.
get
()
->
implicit_deregistration_timer
);
// Continue the Registration Procedure
if
(
nc
.
get
()
->
to_be_register_by_new_suci
)
{
if
(
!
nc
.
get
()
->
is_stacs_available
)
{
ue_info_t
ueItem
;
ueItem
.
connStatus
=
"5GMM-CONNECTED"
;
//"CM-CONNECTED";
ueItem
.
registerStatus
=
"5GMM-REG-INITIATED"
;
// 5GMM-COMMON-PROCEDURE-INITIATED
ueItem
.
ranid
=
ran_ue_ngap_id
;
ueItem
.
amfid
=
amf_ue_ngap_id
;
ueItem
.
imsi
=
nc
.
get
()
->
imsi
;
// Find UE context
std
::
shared_ptr
<
ue_context
>
uc
=
{};
if
(
!
find_ue_context
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
uc
))
{
Logger
::
amf_n1
().
warn
(
"Cannot find the UE context"
);
}
else
{
ueItem
.
mcc
=
uc
.
get
()
->
cgi
.
mcc
;
ueItem
.
mnc
=
uc
.
get
()
->
cgi
.
mnc
;
ueItem
.
cellId
=
uc
.
get
()
->
cgi
.
nrCellID
;
}
stacs
.
update_ue_info
(
ueItem
);
set_5gmm_state
(
nc
,
_5GMM_COMMON_PROCEDURE_INITIATED
);
// stacs.display();
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n1
().
debug
(
"Signal the UE Registration State Event notification for SUPI %s"
,
supi
.
c_str
());
event_sub
.
ue_registration_state
(
supi
,
_5GMM_COMMON_PROCEDURE_INITIATED
,
1
);
nc
.
get
()
->
is_stacs_available
=
true
;
}
// TODO: Trigger UE Location Report
run_registration_procedure
(
nc
);
}
}
...
...
@@ -975,7 +1014,7 @@ void amf_n1::registration_request_handle(
}
// Check 5gs Mobility Identity (Mandatory IE)
std
::
string
guti
;
std
::
string
guti
=
{}
;
uint8_t
mobility_id_type
=
registration_request
->
getMobilityIdentityType
();
switch
(
mobility_id_type
)
{
case
SUCI
:
{
...
...
@@ -984,6 +1023,10 @@ void amf_n1::registration_request_handle(
Logger
::
amf_n1
().
warn
(
"No SUCI and IMSI for SUPI Format"
);
}
else
{
if
(
!
nc
.
get
())
{
Logger
::
amf_n1
().
debug
(
"No existing nas_context with amf_ue_ngap_id ("
AMF_UE_NGAP_ID_FMT
") --> Create new one"
,
amf_ue_ngap_id
);
nc
=
std
::
shared_ptr
<
nas_context
>
(
new
nas_context
);
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
nc
.
get
()
->
ctx_avaliability_ind
=
false
;
...
...
@@ -996,23 +1039,32 @@ void amf_n1::registration_request_handle(
itti_inst
->
timer_remove
(
nc
.
get
()
->
mobile_reachable_timer
);
itti_inst
->
timer_remove
(
nc
.
get
()
->
implicit_deregistration_timer
);
}
nc
.
get
()
->
is_imsi_present
=
true
;
nc
.
get
()
->
imsi
=
imsi
.
mcc
+
imsi
.
mnc
+
imsi
.
msin
;
Logger
::
amf_n1
().
debug
(
"Received IMSI %s"
,
nc
.
get
()
->
imsi
.
c_str
());
// Trigger UE Reachability Status Notify
if
(
!
nc
.
get
()
->
imsi
.
empty
())
{
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n1
().
debug
(
"Signal the UE Reachability Status Event notification for SUPI "
"%s"
,
supi
.
c_str
());
event_sub
.
ue_reachability_status
(
supi
,
CM_CONNECTED
,
1
);
}
set_supi_2_amf_id
(
"imsi-"
+
nc
.
get
()
->
imsi
,
amf_ue_ngap_id
);
set_supi_2_ran_id
(
"imsi-"
+
nc
.
get
()
->
imsi
,
ran_ue_ngap_id
);
//
t
ry to find old nas_context and release
//
T
ry to find old nas_context and release
std
::
shared_ptr
<
nas_context
>
old_nc
=
{};
old_nc
=
imsi_2_nas_context
(
"imsi-"
+
nc
.
get
()
->
imsi
);
//
imsi2nas_context[("imsi-" + nc.get()->imsi)];
//
release
if
(
old_nc
.
get
())
{
// release
old_nc
.
reset
();
}
set_imsi_2_nas_context
(
"imsi-"
+
nc
.
get
()
->
imsi
,
nc
);
// imsi2nas_context[("imsi-" + nc.get()->imsi)] = nc;
Logger
::
amf_n1
().
info
(
"Associating IMSI (%s) with nas_context (%p)"
,
(
"imsi-"
+
nc
.
get
()
->
imsi
).
c_str
(),
nc
.
get
());
...
...
@@ -1032,6 +1084,7 @@ void amf_n1::registration_request_handle(
stacs
.
update_ue_info
(
ueItem
);
set_5gmm_state
(
nc
,
_5GMM_COMMON_PROCEDURE_INITIATED
);
// stacs.display();
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n1
().
debug
(
...
...
@@ -1047,7 +1100,8 @@ void amf_n1::registration_request_handle(
case
_5G_GUTI
:
{
guti
=
registration_request
->
get_5g_guti
();
Logger
::
amf_n1
().
debug
(
"Decoded GUTI from registration request message"
);
Logger
::
amf_n1
().
debug
(
"Decoded GUTI from registration request message %s"
,
guti
.
c_str
());
if
(
guti
.
empty
())
{
Logger
::
amf_n1
().
warn
(
"No GUTI IE"
);
}
...
...
@@ -1146,7 +1200,6 @@ void amf_n1::registration_request_handle(
}
}
else
{
Logger
::
amf_n1
().
debug
(
"Existing nas_context --> Update"
);
// nc = amf_ue_id_2_nas_context(amf_ue_ngap_id);
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
}
nc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
...
...
@@ -1274,7 +1327,7 @@ void amf_n1::registration_request_handle(
std
::
shared_ptr
<
gnb_context
>
gc
=
{};
if
(
!
amf_n2_inst
->
is_assoc_id_2_gnb_context
(
unc
.
get
()
->
gnb_assoc_id
))
{
Logger
::
amf_n
2
().
error
(
Logger
::
amf_n
1
().
error
(
"No existed gNB context with assoc_id (%d)"
,
unc
.
get
()
->
gnb_assoc_id
);
}
else
{
gc
=
amf_n2_inst
->
assoc_id_2_gnb_context
(
unc
.
get
()
->
gnb_assoc_id
);
...
...
@@ -1369,7 +1422,6 @@ void amf_n1::registration_request_handle(
//------------------------------------------------------------------------------
bool
amf_n1
::
is_amf_ue_id_2_nas_context
(
const
long
&
amf_ue_ngap_id
)
const
{
std
::
shared_lock
lock
(
m_amfueid2nas_context
);
// return bool{amfueid2nas_context.count(amf_ue_ngap_id) > 0};
if
(
amfueid2nas_context
.
count
(
amf_ue_ngap_id
)
>
0
)
{
if
(
amfueid2nas_context
.
at
(
amf_ue_ngap_id
).
get
()
!=
nullptr
)
{
return
true
;
...
...
@@ -1566,7 +1618,7 @@ void amf_n1::send_registration_reject_msg(
//------------------------------------------------------------------------------
void
amf_n1
::
run_registration_procedure
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
Logger
::
amf_n1
().
debug
(
"Start to run
registration p
rocedure"
);
Logger
::
amf_n1
().
debug
(
"Start to run
Registration P
rocedure"
);
if
(
!
nc
.
get
()
->
ctx_avaliability_ind
)
{
Logger
::
amf_n1
().
error
(
"NAS context is not available"
);
return
;
...
...
@@ -1587,7 +1639,7 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
}
nc
.
get
()
->
ngKsi
=
ngksi
;
}
else
{
Logger
::
amf_n1
().
error
(
"Request
authentication v
ectors failure"
);
Logger
::
amf_n1
().
error
(
"Request
Authentication V
ectors failure"
);
send_registration_reject_msg
(
_5GMM_CAUSE_ILLEGAL_UE
,
nc
.
get
()
->
ran_ue_ngap_id
,
nc
.
get
()
->
amf_ue_ngap_id
);
// cause?
...
...
@@ -1595,13 +1647,13 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
}
}
else
{
Logger
::
amf_n1
().
debug
(
"Authentication
v
ector in nas_context is available"
);
"Authentication
V
ector in nas_context is available"
);
ngksi_t
ngksi
=
0
;
if
(
nc
.
get
()
->
security_ctx
&&
nc
.
get
()
->
ngKsi
!=
NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE
)
{
// ngksi = (nc.get()->ngKsi + 1) % (NGKSI_MAX_VALUE + 1);
ngksi
=
(
nc
.
get
()
->
amf_ue_ngap_id
+
1
);
// % (NGKSI_MAX_VALUE + 1);
Logger
::
amf_n1
().
debug
(
"New ngK
si
(%d)"
,
ngksi
);
Logger
::
amf_n1
().
debug
(
"New ngK
SI
(%d)"
,
ngksi
);
// TODO: How to handle?
}
nc
.
get
()
->
ngKsi
=
ngksi
;
...
...
@@ -1638,7 +1690,7 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
// Get authentication vectors either from AUSF(UDM) or from AMF (generate
// locally)
bool
amf_n1
::
auth_vectors_generator
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
Logger
::
amf_n1
().
debug
(
"Start to generate
authentication v
ectors"
);
Logger
::
amf_n1
().
debug
(
"Start to generate
Authentication V
ectors"
);
if
(
amf_cfg
.
support_features
.
enable_external_ausf
)
{
// get authentication vectors from AUSF
if
(
!
get_authentication_vectors_from_ausf
(
nc
))
return
false
;
...
...
@@ -1745,7 +1797,7 @@ bool amf_n1::get_authentication_vectors_from_ausf(
//------------------------------------------------------------------------------
bool
amf_n1
::
_5g_aka_confirmation_from_ausf
(
std
::
shared_ptr
<
nas_context
>&
nc
,
bstring
resStar
)
{
Logger
::
amf_n1
().
debug
(
"
_5g_aka_confirmation_from_ausf
"
);
Logger
::
amf_n1
().
debug
(
"
5G AKA Confirmation from AUSF
"
);
std
::
string
remoteUri
=
nc
.
get
()
->
Href
;
std
::
string
msgBody
=
{};
...
...
@@ -1785,7 +1837,6 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
free_wrapper
((
void
**
)
&
resStar_s
);
try
{
ConfirmationDataResponse
confirmationdataresponse
;
// nlohmann::json::parse(response.c_str()).get_to(confirmationdataresponse);
response
.
get_to
(
confirmationdataresponse
);
unsigned
char
*
kseaf_hex
=
conv
::
format_string_as_hex
(
confirmationdataresponse
.
getKseaf
());
...
...
@@ -1812,7 +1863,9 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
//------------------------------------------------------------------------------
bool
amf_n1
::
authentication_vectors_generator_in_ausf
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
// A.5, 3gpp ts33.501
Logger
::
amf_n1
().
debug
(
"Authentication_vectors_generator_in_ausf"
);
Logger
::
amf_n1
().
debug
(
"Generate Authentication Vectors in AUSF"
);
// Actually, done locally in
// AMF
uint8_t
inputString
[
MAX_5GS_AUTH_VECTORS
][
40
];
uint8_t
*
xresStar
[
MAX_5GS_AUTH_VECTORS
];
uint8_t
*
rand
[
MAX_5GS_AUTH_VECTORS
];
...
...
@@ -1838,13 +1891,13 @@ bool amf_n1::authentication_vectors_generator_in_ausf(
//------------------------------------------------------------------------------
bool
amf_n1
::
authentication_vectors_generator_in_udm
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
Logger
::
amf_n1
().
debug
(
"Generate
authentication v
ectors"
);
Logger
::
amf_n1
().
debug
(
"Generate
Authentication V
ectors"
);
uint8_t
*
sqn
=
NULL
;
uint8_t
*
auts
=
(
uint8_t
*
)
bdata
(
nc
.
get
()
->
auts
);
_5G_HE_AV_t
*
vector
=
nc
.
get
()
->
_5g_he_av
;
// Access to MySQL to fetch UE-related information
if
(
!
connect_to_mysql
())
{
Logger
::
amf_n1
().
error
(
"Cannot connect to MySQL"
);
Logger
::
amf_n1
().
error
(
"Cannot connect to MySQL
DB
"
);
return
false
;
}
Logger
::
amf_n1
().
debug
(
"Connected to MySQL successfully"
);
...
...
@@ -2012,7 +2065,7 @@ void amf_n1::annex_a_4_33501(
void
amf_n1
::
handle_auth_vector_successful_result
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
Logger
::
amf_n1
().
debug
(
"Received
security v
ectors, try to setup security with the UE"
);
"Received
Security V
ectors, try to setup security with the UE"
);
nc
.
get
()
->
is_auth_vectors_present
=
true
;
ngksi_t
ngksi
=
0
;
if
(
!
nc
.
get
()
->
security_ctx
)
{
...
...
@@ -2025,7 +2078,7 @@ void amf_n1::handle_auth_vector_successful_result(
}
int
vindex
=
nc
.
get
()
->
security_ctx
->
vector_pointer
;
if
(
!
start_authentication_procedure
(
nc
,
vindex
,
nc
.
get
()
->
ngKsi
))
{
Logger
::
amf_n1
().
error
(
"Start
authentication procedure f
ailure, reject..."
);
Logger
::
amf_n1
().
error
(
"Start
Authentication Procedure F
ailure, reject..."
);
Logger
::
amf_n1
().
error
(
"Ran_ue_ngap_id "
GNB_UE_NGAP_ID_FMT
,
nc
.
get
()
->
ran_ue_ngap_id
);
send_registration_reject_msg
(
...
...
@@ -2039,7 +2092,7 @@ void amf_n1::handle_auth_vector_successful_result(
//------------------------------------------------------------------------------
bool
amf_n1
::
start_authentication_procedure
(
std
::
shared_ptr
<
nas_context
>&
nc
,
int
vindex
,
uint8_t
ngksi
)
{
Logger
::
amf_n1
().
debug
(
"Starting
a
uthentication procedure"
);
Logger
::
amf_n1
().
debug
(
"Starting
A
uthentication procedure"
);
if
(
check_nas_common_procedure_on_going
(
nc
))
{
Logger
::
amf_n1
().
error
(
"Existed NAS common procedure on going, reject..."
);
send_registration_reject_msg
(
...
...
@@ -2059,7 +2112,7 @@ bool amf_n1::start_authentication_procedure(
auth_request
->
setABBA
(
2
,
abba
);
uint8_t
*
rand
=
nc
.
get
()
->
_5g_av
[
vindex
].
rand
;
if
(
rand
)
auth_request
->
setAuthentication_Parameter_RAND
(
rand
);
Logger
::
amf_n1
().
debug
(
"Sending Authentication
r
equest with RAND"
);
Logger
::
amf_n1
().
debug
(
"Sending Authentication
R
equest with RAND"
);
printf
(
"0x"
);
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"%x"
,
rand
[
i
]);
printf
(
"
\n
"
);
...
...
@@ -2088,11 +2141,11 @@ bool amf_n1::start_authentication_procedure(
bool
amf_n1
::
check_nas_common_procedure_on_going
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
if
(
nc
.
get
()
->
is_common_procedure_for_authentication_running
)
{
Logger
::
amf_n1
().
debug
(
"Existed
a
uthentication procedure is running"
);
Logger
::
amf_n1
().
debug
(
"Existed
A
uthentication procedure is running"
);
return
true
;
}
if
(
nc
.
get
()
->
is_common_procedure_for_identification_running
)
{
Logger
::
amf_n1
().
debug
(
"Existed
i
dentification procedure is running"
);
Logger
::
amf_n1
().
debug
(
"Existed
I
dentification procedure is running"
);
return
true
;
}
if
(
nc
.
get
()
->
is_common_procedure_for_security_mode_control_running
)
{
...
...
@@ -2193,6 +2246,7 @@ void amf_n1::authentication_response_handle(
return
;
}
else
{
Logger
::
amf_n1
().
debug
(
"Authentication successful by network!"
);
// Fix to work with ng4T
// TODO: To verify UE/AMF behavior according to 3GPP TS 24.501
// if (!nc.get()->is_current_security_available) {
if
(
!
start_security_mode_control_procedure
(
nc
))
{
...
...
@@ -2208,7 +2262,7 @@ void amf_n1::authentication_failure_handle(
std
::
shared_ptr
<
nas_context
>
nc
;
if
(
!
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
{
Logger
::
amf_n1
().
error
(
"No existed NAS context for UE with amf_ue_ngap_id("
AMF_UE_NGAP_ID_FMT
"No existed NAS context for UE with amf_ue_ngap_id
("
AMF_UE_NGAP_ID_FMT
")"
,
amf_ue_ngap_id
);
send_registration_reject_msg
(
...
...
@@ -2233,7 +2287,7 @@ void amf_n1::authentication_failure_handle(
}
switch
(
mm_cause
)
{
case
_5GMM_CAUSE_SYNCH_FAILURE
:
{
Logger
::
amf_n1
().
debug
(
"Initial new
a
uthentication procedure"
);
Logger
::
amf_n1
().
debug
(
"Initial new
A
uthentication procedure"
);
bstring
auts
;
if
(
!
auth_failure
->
getAutsInAuthFailPara
(
auts
))
{
Logger
::
amf_n1
().
warn
(
...
...
@@ -2247,7 +2301,7 @@ void amf_n1::authentication_failure_handle(
if
(
auth_vectors_generator
(
nc
))
{
// all authentication in one(AMF)
handle_auth_vector_successful_result
(
nc
);
}
else
{
Logger
::
amf_n1
().
error
(
"Request
authentication v
ectors failure"
);
Logger
::
amf_n1
().
error
(
"Request
Authentication V
ectors failure"
);
send_registration_reject_msg
(
_5GMM_CAUSE_ILLEGAL_UE
,
nc
.
get
()
->
ran_ue_ngap_id
,
nc
.
get
()
->
amf_ue_ngap_id
);
// cause?
...
...
@@ -2257,7 +2311,7 @@ void amf_n1::authentication_failure_handle(
case
_5GMM_CAUSE_NGKSI_ALREADY_IN_USE
:
{
Logger
::
amf_n1
().
debug
(
"ngKSI already in use, select a new ngKSI and restart the "
"
a
uthentication procedure!"
);
"
A
uthentication procedure!"
);
// select new ngKSI and resend Authentication Request
ngksi_t
ngksi
=
(
nc
.
get
()
->
ngKsi
+
1
)
%
(
NGKSI_MAX_VALUE
+
1
);
// To be verified
...
...
@@ -2265,7 +2319,7 @@ void amf_n1::authentication_failure_handle(
int
vindex
=
nc
.
get
()
->
security_ctx
->
vector_pointer
;
if
(
!
start_authentication_procedure
(
nc
,
vindex
,
nc
.
get
()
->
ngKsi
))
{
Logger
::
amf_n1
().
error
(
"Start
a
uthentication procedure failure, reject..."
);
"Start
A
uthentication procedure failure, reject..."
);
Logger
::
amf_n1
().
error
(
"Ran_ue_ngap_id "
GNB_UE_NGAP_ID_FMT
,
nc
.
get
()
->
ran_ue_ngap_id
);
send_registration_reject_msg
(
...
...
@@ -2523,6 +2577,7 @@ void amf_n1::security_mode_complete_handle(
nc
.
get
()
->
is_stacs_available
=
true
;
}
set_5gmm_state
(
nc
,
_5GMM_REGISTERED
);
stacs
.
display
();
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n1
().
debug
(
...
...
@@ -2960,7 +3015,7 @@ void amf_n1::ue_initiate_de_registration_handle(
// Check Deregistration type
uint8_t
deregType
=
0
;
dereg_request
->
getDeregistrationType
(
deregType
);
Logger
::
amf_n1
().
debug
(
"Deregistration Type 0x%x"
,
deregType
);
Logger
::
amf_n1
().
debug
(
"De
-
registration Type 0x%x"
,
deregType
);
// If UE switch-off, don't need to send Deregistration Accept
if
((
deregType
&
0b00001000
)
==
0
)
{
...
...
@@ -2984,6 +3039,7 @@ void amf_n1::ue_initiate_de_registration_handle(
}
set_5gmm_state
(
nc
,
_5GMM_DEREGISTERED
);
stacs
.
display
();
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
Logger
::
amf_n1
().
debug
(
...
...
@@ -3369,7 +3425,7 @@ void amf_n1::handle_ue_location_change(
std
::
string
supi
,
oai
::
amf
::
model
::
UserLocation
user_location
,
uint8_t
http_version
)
{
Logger
::
amf_n1
().
debug
(
"Send request to SBI to triger UE Location Report (SUPI "
"Send request to SBI to trig
g
er UE Location Report (SUPI "
"%s )"
,
supi
.
c_str
());
std
::
vector
<
std
::
shared_ptr
<
amf_subscription
>>
subscriptions
=
{};
...
...
@@ -3378,7 +3434,7 @@ void amf_n1::handle_ue_location_change(
if
(
subscriptions
.
size
()
>
0
)
{
// Send request to SBI to trigger the notification to the subscribed event
Logger
::
amf_
app
().
debug
(
Logger
::
amf_
n1
().
debug
(
"Send ITTI msg to AMF SBI to trigger the event notification"
);
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
...
...
@@ -3423,7 +3479,7 @@ void amf_n1::handle_ue_location_change(
void
amf_n1
::
handle_ue_reachability_status_change
(
std
::
string
supi
,
uint8_t
status
,
uint8_t
http_version
)
{
Logger
::
amf_n1
().
debug
(
"Send request to SBI to triger UE Reachability Report (SUPI "
"Send request to SBI to trig
g
er UE Reachability Report (SUPI "
"%s )"
,
supi
.
c_str
());
...
...
@@ -3433,7 +3489,7 @@ void amf_n1::handle_ue_reachability_status_change(
if
(
subscriptions
.
size
()
>
0
)
{
// Send request to SBI to trigger the notification to the subscribed event
Logger
::
amf_
app
().
debug
(
Logger
::
amf_
n1
().
debug
(
"Send ITTI msg to AMF SBI to trigger the event notification"
);
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
...
...
@@ -3483,7 +3539,7 @@ void amf_n1::handle_ue_reachability_status_change(
void
amf_n1
::
handle_ue_registration_state_change
(
std
::
string
supi
,
uint8_t
status
,
uint8_t
http_version
)
{
Logger
::
amf_n1
().
debug
(
"Send request to SBI to triger UE Registration State Report (SUPI "
"Send request to SBI to trig
g
er UE Registration State Report (SUPI "
"%s )"
,
supi
.
c_str
());
...
...
@@ -3493,7 +3549,7 @@ void amf_n1::handle_ue_registration_state_change(
if
(
subscriptions
.
size
()
>
0
)
{
// Send request to SBI to trigger the notification to the subscribed event
Logger
::
amf_
app
().
debug
(
Logger
::
amf_
n1
().
debug
(
"Send ITTI msg to AMF SBI to trigger the event notification"
);
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
...
...
@@ -3550,7 +3606,7 @@ void amf_n1::handle_ue_registration_state_change(
void
amf_n1
::
handle_ue_connectivity_state_change
(
std
::
string
supi
,
uint8_t
status
,
uint8_t
http_version
)
{
Logger
::
amf_n1
().
debug
(
"Send request to SBI to triger UE Connectivity State Report (SUPI "
"Send request to SBI to trig
g
er UE Connectivity State Report (SUPI "
"%s )"
,
supi
.
c_str
());
...
...
@@ -3560,7 +3616,7 @@ void amf_n1::handle_ue_connectivity_state_change(
if
(
subscriptions
.
size
()
>
0
)
{
// Send request to SBI to trigger the notification to the subscribed event
Logger
::
amf_
app
().
debug
(
Logger
::
amf_
n1
().
debug
(
"Send ITTI msg to AMF SBI to trigger the event notification"
);
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
...
...
@@ -3789,7 +3845,7 @@ void amf_n1::mobile_reachable_timer_timeout(
timer_id_t
tid
=
itti_inst
->
timer_setup
(
IMPLICIT_DEREGISTRATION_TIMER_MIN
*
60
,
0
,
TASK_AMF_N1
,
TASK_AMF_IMPLICIT_DEREGISTRATION_TIMER_EXPIRE
,
amf_ue_ngap_id
);
Logger
::
amf_
app
().
startup
(
Logger
::
amf_
n1
().
startup
(
"Started Implicit De-Registration Timer (tid %d)"
,
tid
);
set_implicit_deregistration_timer
(
nc
,
tid
);
...
...
@@ -4250,7 +4306,7 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
std
::
shared_ptr
<
gnb_context
>
gc
=
{};
if
(
!
amf_n2_inst
->
is_assoc_id_2_gnb_context
(
unc
.
get
()
->
gnb_assoc_id
))
{
Logger
::
amf_n
2
().
error
(
Logger
::
amf_n
1
().
error
(
"No existed gNB context with assoc_id (%d)"
,
unc
.
get
()
->
gnb_assoc_id
);
return
false
;
}
...
...
@@ -4268,7 +4324,7 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
try
{
sst
=
std
::
stoi
(
s
.
sst
);
}
catch
(
const
std
::
exception
&
err
)
{
Logger
::
amf_
app
().
error
(
"Invalid SST"
);
Logger
::
amf_
n1
().
error
(
"Invalid SST"
);
return
false
;
}
nssai
.
setSst
(
sst
);
...
...
src/amf-app/amf_n2.cpp
View file @
9cff5872
...
...
@@ -1366,7 +1366,7 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
timer_id_t
tid
=
itti_inst
->
timer_setup
(
MOBILE_REACHABLE_TIMER_NO_EMERGENCY_SERVICES_MIN
*
60
,
0
,
TASK_AMF_N1
,
TASK_AMF_MOBILE_REACHABLE_TIMER_EXPIRE
,
amf_ue_ngap_id
);
Logger
::
amf_
app
().
startup
(
"Started mobile reachable timer (tid %d)"
,
tid
);
Logger
::
amf_
n2
().
startup
(
"Started mobile reachable timer (tid %d)"
,
tid
);
amf_n1_inst
->
set_mobile_reachable_timer
(
nc
,
tid
);
amf_n1_inst
->
set_mobile_reachable_timer_timeout
(
nc
,
false
);
...
...
src/nas/msgs/DeregistrationRequest.cpp
View file @
9cff5872
...
...
@@ -139,7 +139,7 @@ std::string DeregistrationRequest::get_5g_guti() {
Logger
::
nas_mm
().
debug
(
"5G GUTI %s"
,
guti_str
.
c_str
());
return
guti_str
;
}
else
{
return
""
;
return
{}
;
}
}
...
...
src/nas/msgs/RegistrationRequest.cpp
View file @
9cff5872
...
...
@@ -149,7 +149,7 @@ std::string RegistrationRequest::get_5g_guti() {
Logger
::
nas_mm
().
debug
(
"5G GUTI %s"
,
guti_str
.
c_str
());
return
guti_str
;
}
else
{
return
""
;
return
{}
;
}
}
...
...
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