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
d0392a27
Commit
d0392a27
authored
Apr 27, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typo
parent
d4c21699
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
42 deletions
+44
-42
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+43
-41
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+1
-1
No files found.
src/amf-app/amf_n1.cpp
View file @
d0392a27
...
@@ -73,7 +73,6 @@ extern "C" {
...
@@ -73,7 +73,6 @@ extern "C" {
#include "dynamic_memory_check.h"
#include "dynamic_memory_check.h"
}
}
// using namespace oai::amf::model;
using
namespace
nas
;
using
namespace
nas
;
using
namespace
amf_application
;
using
namespace
amf_application
;
using
namespace
config
;
using
namespace
config
;
...
@@ -86,6 +85,7 @@ extern amf_app* amf_app_inst;
...
@@ -86,6 +85,7 @@ extern amf_app* amf_app_inst;
extern
amf_n2
*
amf_n2_inst
;
extern
amf_n2
*
amf_n2_inst
;
extern
statistics
stacs
;
extern
statistics
stacs
;
// Static variables
uint8_t
amf_n1
::
no_random_delta
=
0
;
uint8_t
amf_n1
::
no_random_delta
=
0
;
std
::
map
<
std
::
string
,
std
::
string
>
amf_n1
::
rand_record
=
{};
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) {
...
@@ -482,7 +482,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind& nas_data_ind) {
blength
(
decoded_plain_msg
));
blength
(
decoded_plain_msg
));
if
(
nas_data_ind
.
is_nas_signalling_estab_req
)
{
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
(
comUt
::
print_buffer
(
"amf_n1"
,
"Decoded plain NAS Message buffer"
,
"amf_n1"
,
"Decoded plain NAS Message buffer"
,
(
uint8_t
*
)
bdata
(
decoded_plain_msg
),
blength
(
decoded_plain_msg
));
(
uint8_t
*
)
bdata
(
decoded_plain_msg
),
blength
(
decoded_plain_msg
));
...
@@ -552,13 +552,13 @@ void amf_n1::nas_signalling_establishment_request_handle(
...
@@ -552,13 +552,13 @@ void amf_n1::nas_signalling_establishment_request_handle(
switch
(
message_type
)
{
switch
(
message_type
)
{
case
REGISTRATION_REQUEST
:
{
case
REGISTRATION_REQUEST
:
{
Logger
::
amf_n1
().
debug
(
Logger
::
amf_n1
().
debug
(
"Received
registration r
equest message, handling..."
);
"Received
Registration R
equest message, handling..."
);
registration_request_handle
(
registration_request_handle
(
nc
,
ran_ue_ngap_id
,
amf_ue_ngap_id
,
snn
,
plain_msg
);
nc
,
ran_ue_ngap_id
,
amf_ue_ngap_id
,
snn
,
plain_msg
);
}
break
;
}
break
;
case
SERVICE_REQUEST
:
{
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
())
{
if
(
!
nc
.
get
())
{
Logger
::
amf_n1
().
error
(
"No NAS Context found"
);
Logger
::
amf_n1
().
error
(
"No NAS Context found"
);
return
;
return
;
...
@@ -574,7 +574,7 @@ void amf_n1::nas_signalling_establishment_request_handle(
...
@@ -574,7 +574,7 @@ void amf_n1::nas_signalling_establishment_request_handle(
case
UE_INIT_DEREGISTER
:
{
case
UE_INIT_DEREGISTER
:
{
Logger
::
amf_n1
().
debug
(
Logger
::
amf_n1
().
debug
(
"Received
initialUeMessage de-registration r
equest message, "
"Received
InitialUeMessage De-registration R
equest message, "
"handling..."
);
"handling..."
);
// ue_initiate_de_registration_handle(ran_ue_ngap_id, amf_ue_ngap_id,
// ue_initiate_de_registration_handle(ran_ue_ngap_id, amf_ue_ngap_id,
// plain_msg);
// plain_msg);
...
@@ -766,6 +766,8 @@ void amf_n1::identity_response_handle(
...
@@ -766,6 +766,8 @@ void amf_n1::identity_response_handle(
nc
.
get
()
->
is_stacs_available
=
true
;
nc
.
get
()
->
is_stacs_available
=
true
;
}
}
// TODO: Trigger UE Location Report
run_registration_procedure
(
nc
);
run_registration_procedure
(
nc
);
}
}
}
}
...
@@ -1198,7 +1200,6 @@ void amf_n1::registration_request_handle(
...
@@ -1198,7 +1200,6 @@ void amf_n1::registration_request_handle(
}
}
}
else
{
}
else
{
Logger
::
amf_n1
().
debug
(
"Existing nas_context --> Update"
);
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
);
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
}
}
nc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
nc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
...
@@ -1326,7 +1327,7 @@ void amf_n1::registration_request_handle(
...
@@ -1326,7 +1327,7 @@ void amf_n1::registration_request_handle(
std
::
shared_ptr
<
gnb_context
>
gc
=
{};
std
::
shared_ptr
<
gnb_context
>
gc
=
{};
if
(
!
amf_n2_inst
->
is_assoc_id_2_gnb_context
(
unc
.
get
()
->
gnb_assoc_id
))
{
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
);
"No existed gNB context with assoc_id (%d)"
,
unc
.
get
()
->
gnb_assoc_id
);
}
else
{
}
else
{
gc
=
amf_n2_inst
->
assoc_id_2_gnb_context
(
unc
.
get
()
->
gnb_assoc_id
);
gc
=
amf_n2_inst
->
assoc_id_2_gnb_context
(
unc
.
get
()
->
gnb_assoc_id
);
...
@@ -1421,7 +1422,6 @@ void amf_n1::registration_request_handle(
...
@@ -1421,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
{
bool
amf_n1
::
is_amf_ue_id_2_nas_context
(
const
long
&
amf_ue_ngap_id
)
const
{
std
::
shared_lock
lock
(
m_amfueid2nas_context
);
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
.
count
(
amf_ue_ngap_id
)
>
0
)
{
if
(
amfueid2nas_context
.
at
(
amf_ue_ngap_id
).
get
()
!=
nullptr
)
{
if
(
amfueid2nas_context
.
at
(
amf_ue_ngap_id
).
get
()
!=
nullptr
)
{
return
true
;
return
true
;
...
@@ -1618,7 +1618,7 @@ void amf_n1::send_registration_reject_msg(
...
@@ -1618,7 +1618,7 @@ void amf_n1::send_registration_reject_msg(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n1
::
run_registration_procedure
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
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
)
{
if
(
!
nc
.
get
()
->
ctx_avaliability_ind
)
{
Logger
::
amf_n1
().
error
(
"NAS context is not available"
);
Logger
::
amf_n1
().
error
(
"NAS context is not available"
);
return
;
return
;
...
@@ -1639,7 +1639,7 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
...
@@ -1639,7 +1639,7 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
}
}
nc
.
get
()
->
ngKsi
=
ngksi
;
nc
.
get
()
->
ngKsi
=
ngksi
;
}
else
{
}
else
{
Logger
::
amf_n1
().
error
(
"Request
authentication v
ectors failure"
);
Logger
::
amf_n1
().
error
(
"Request
Authentication V
ectors failure"
);
send_registration_reject_msg
(
send_registration_reject_msg
(
_5GMM_CAUSE_ILLEGAL_UE
,
nc
.
get
()
->
ran_ue_ngap_id
,
_5GMM_CAUSE_ILLEGAL_UE
,
nc
.
get
()
->
ran_ue_ngap_id
,
nc
.
get
()
->
amf_ue_ngap_id
);
// cause?
nc
.
get
()
->
amf_ue_ngap_id
);
// cause?
...
@@ -1647,13 +1647,13 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
...
@@ -1647,13 +1647,13 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
}
}
}
else
{
}
else
{
Logger
::
amf_n1
().
debug
(
Logger
::
amf_n1
().
debug
(
"Authentication
v
ector in nas_context is available"
);
"Authentication
V
ector in nas_context is available"
);
ngksi_t
ngksi
=
0
;
ngksi_t
ngksi
=
0
;
if
(
nc
.
get
()
->
security_ctx
&&
if
(
nc
.
get
()
->
security_ctx
&&
nc
.
get
()
->
ngKsi
!=
NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE
)
{
nc
.
get
()
->
ngKsi
!=
NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE
)
{
// ngksi = (nc.get()->ngKsi + 1) % (NGKSI_MAX_VALUE + 1);
// ngksi = (nc.get()->ngKsi + 1) % (NGKSI_MAX_VALUE + 1);
ngksi
=
(
nc
.
get
()
->
amf_ue_ngap_id
+
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?
// TODO: How to handle?
}
}
nc
.
get
()
->
ngKsi
=
ngksi
;
nc
.
get
()
->
ngKsi
=
ngksi
;
...
@@ -1690,7 +1690,7 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
...
@@ -1690,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
// Get authentication vectors either from AUSF(UDM) or from AMF (generate
// locally)
// locally)
bool
amf_n1
::
auth_vectors_generator
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
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
)
{
if
(
amf_cfg
.
support_features
.
enable_external_ausf
)
{
// get authentication vectors from AUSF
// get authentication vectors from AUSF
if
(
!
get_authentication_vectors_from_ausf
(
nc
))
return
false
;
if
(
!
get_authentication_vectors_from_ausf
(
nc
))
return
false
;
...
@@ -1797,7 +1797,7 @@ bool amf_n1::get_authentication_vectors_from_ausf(
...
@@ -1797,7 +1797,7 @@ bool amf_n1::get_authentication_vectors_from_ausf(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
amf_n1
::
_5g_aka_confirmation_from_ausf
(
bool
amf_n1
::
_5g_aka_confirmation_from_ausf
(
std
::
shared_ptr
<
nas_context
>&
nc
,
bstring
resStar
)
{
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
remoteUri
=
nc
.
get
()
->
Href
;
std
::
string
msgBody
=
{};
std
::
string
msgBody
=
{};
...
@@ -1837,7 +1837,6 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
...
@@ -1837,7 +1837,6 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
free_wrapper
((
void
**
)
&
resStar_s
);
free_wrapper
((
void
**
)
&
resStar_s
);
try
{
try
{
ConfirmationDataResponse
confirmationdataresponse
;
ConfirmationDataResponse
confirmationdataresponse
;
// nlohmann::json::parse(response.c_str()).get_to(confirmationdataresponse);
response
.
get_to
(
confirmationdataresponse
);
response
.
get_to
(
confirmationdataresponse
);
unsigned
char
*
kseaf_hex
=
unsigned
char
*
kseaf_hex
=
conv
::
format_string_as_hex
(
confirmationdataresponse
.
getKseaf
());
conv
::
format_string_as_hex
(
confirmationdataresponse
.
getKseaf
());
...
@@ -1864,7 +1863,9 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
...
@@ -1864,7 +1863,9 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
amf_n1
::
authentication_vectors_generator_in_ausf
(
bool
amf_n1
::
authentication_vectors_generator_in_ausf
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
// A.5, 3gpp ts33.501
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
inputString
[
MAX_5GS_AUTH_VECTORS
][
40
];
uint8_t
*
xresStar
[
MAX_5GS_AUTH_VECTORS
];
uint8_t
*
xresStar
[
MAX_5GS_AUTH_VECTORS
];
uint8_t
*
rand
[
MAX_5GS_AUTH_VECTORS
];
uint8_t
*
rand
[
MAX_5GS_AUTH_VECTORS
];
...
@@ -1890,13 +1891,13 @@ bool amf_n1::authentication_vectors_generator_in_ausf(
...
@@ -1890,13 +1891,13 @@ bool amf_n1::authentication_vectors_generator_in_ausf(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
amf_n1
::
authentication_vectors_generator_in_udm
(
bool
amf_n1
::
authentication_vectors_generator_in_udm
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
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
*
sqn
=
NULL
;
uint8_t
*
auts
=
(
uint8_t
*
)
bdata
(
nc
.
get
()
->
auts
);
uint8_t
*
auts
=
(
uint8_t
*
)
bdata
(
nc
.
get
()
->
auts
);
_5G_HE_AV_t
*
vector
=
nc
.
get
()
->
_5g_he_av
;
_5G_HE_AV_t
*
vector
=
nc
.
get
()
->
_5g_he_av
;
// Access to MySQL to fetch UE-related information
// Access to MySQL to fetch UE-related information
if
(
!
connect_to_mysql
())
{
if
(
!
connect_to_mysql
())
{
Logger
::
amf_n1
().
error
(
"Cannot connect to MySQL"
);
Logger
::
amf_n1
().
error
(
"Cannot connect to MySQL
DB
"
);
return
false
;
return
false
;
}
}
Logger
::
amf_n1
().
debug
(
"Connected to MySQL successfully"
);
Logger
::
amf_n1
().
debug
(
"Connected to MySQL successfully"
);
...
@@ -2064,7 +2065,7 @@ void amf_n1::annex_a_4_33501(
...
@@ -2064,7 +2065,7 @@ void amf_n1::annex_a_4_33501(
void
amf_n1
::
handle_auth_vector_successful_result
(
void
amf_n1
::
handle_auth_vector_successful_result
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
std
::
shared_ptr
<
nas_context
>&
nc
)
{
Logger
::
amf_n1
().
debug
(
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
;
nc
.
get
()
->
is_auth_vectors_present
=
true
;
ngksi_t
ngksi
=
0
;
ngksi_t
ngksi
=
0
;
if
(
!
nc
.
get
()
->
security_ctx
)
{
if
(
!
nc
.
get
()
->
security_ctx
)
{
...
@@ -2077,7 +2078,7 @@ void amf_n1::handle_auth_vector_successful_result(
...
@@ -2077,7 +2078,7 @@ void amf_n1::handle_auth_vector_successful_result(
}
}
int
vindex
=
nc
.
get
()
->
security_ctx
->
vector_pointer
;
int
vindex
=
nc
.
get
()
->
security_ctx
->
vector_pointer
;
if
(
!
start_authentication_procedure
(
nc
,
vindex
,
nc
.
get
()
->
ngKsi
))
{
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
(
Logger
::
amf_n1
().
error
(
"Ran_ue_ngap_id "
GNB_UE_NGAP_ID_FMT
,
nc
.
get
()
->
ran_ue_ngap_id
);
"Ran_ue_ngap_id "
GNB_UE_NGAP_ID_FMT
,
nc
.
get
()
->
ran_ue_ngap_id
);
send_registration_reject_msg
(
send_registration_reject_msg
(
...
@@ -2091,7 +2092,7 @@ void amf_n1::handle_auth_vector_successful_result(
...
@@ -2091,7 +2092,7 @@ void amf_n1::handle_auth_vector_successful_result(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
amf_n1
::
start_authentication_procedure
(
bool
amf_n1
::
start_authentication_procedure
(
std
::
shared_ptr
<
nas_context
>&
nc
,
int
vindex
,
uint8_t
ngksi
)
{
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
))
{
if
(
check_nas_common_procedure_on_going
(
nc
))
{
Logger
::
amf_n1
().
error
(
"Existed NAS common procedure on going, reject..."
);
Logger
::
amf_n1
().
error
(
"Existed NAS common procedure on going, reject..."
);
send_registration_reject_msg
(
send_registration_reject_msg
(
...
@@ -2111,7 +2112,7 @@ bool amf_n1::start_authentication_procedure(
...
@@ -2111,7 +2112,7 @@ bool amf_n1::start_authentication_procedure(
auth_request
->
setABBA
(
2
,
abba
);
auth_request
->
setABBA
(
2
,
abba
);
uint8_t
*
rand
=
nc
.
get
()
->
_5g_av
[
vindex
].
rand
;
uint8_t
*
rand
=
nc
.
get
()
->
_5g_av
[
vindex
].
rand
;
if
(
rand
)
auth_request
->
setAuthentication_Parameter_RAND
(
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"
);
printf
(
"0x"
);
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"%x"
,
rand
[
i
]);
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"%x"
,
rand
[
i
]);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
...
@@ -2140,11 +2141,11 @@ bool amf_n1::start_authentication_procedure(
...
@@ -2140,11 +2141,11 @@ bool amf_n1::start_authentication_procedure(
bool
amf_n1
::
check_nas_common_procedure_on_going
(
bool
amf_n1
::
check_nas_common_procedure_on_going
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
std
::
shared_ptr
<
nas_context
>&
nc
)
{
if
(
nc
.
get
()
->
is_common_procedure_for_authentication_running
)
{
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
;
return
true
;
}
}
if
(
nc
.
get
()
->
is_common_procedure_for_identification_running
)
{
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
;
return
true
;
}
}
if
(
nc
.
get
()
->
is_common_procedure_for_security_mode_control_running
)
{
if
(
nc
.
get
()
->
is_common_procedure_for_security_mode_control_running
)
{
...
@@ -2245,6 +2246,7 @@ void amf_n1::authentication_response_handle(
...
@@ -2245,6 +2246,7 @@ void amf_n1::authentication_response_handle(
return
;
return
;
}
else
{
}
else
{
Logger
::
amf_n1
().
debug
(
"Authentication successful by network!"
);
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
// TODO: To verify UE/AMF behavior according to 3GPP TS 24.501
// if (!nc.get()->is_current_security_available) {
// if (!nc.get()->is_current_security_available) {
if
(
!
start_security_mode_control_procedure
(
nc
))
{
if
(
!
start_security_mode_control_procedure
(
nc
))
{
...
@@ -2260,7 +2262,7 @@ void amf_n1::authentication_failure_handle(
...
@@ -2260,7 +2262,7 @@ void amf_n1::authentication_failure_handle(
std
::
shared_ptr
<
nas_context
>
nc
;
std
::
shared_ptr
<
nas_context
>
nc
;
if
(
!
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
{
if
(
!
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
{
Logger
::
amf_n1
().
error
(
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
);
amf_ue_ngap_id
);
send_registration_reject_msg
(
send_registration_reject_msg
(
...
@@ -2285,7 +2287,7 @@ void amf_n1::authentication_failure_handle(
...
@@ -2285,7 +2287,7 @@ void amf_n1::authentication_failure_handle(
}
}
switch
(
mm_cause
)
{
switch
(
mm_cause
)
{
case
_5GMM_CAUSE_SYNCH_FAILURE
:
{
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
;
bstring
auts
;
if
(
!
auth_failure
->
getAutsInAuthFailPara
(
auts
))
{
if
(
!
auth_failure
->
getAutsInAuthFailPara
(
auts
))
{
Logger
::
amf_n1
().
warn
(
Logger
::
amf_n1
().
warn
(
...
@@ -2299,7 +2301,7 @@ void amf_n1::authentication_failure_handle(
...
@@ -2299,7 +2301,7 @@ void amf_n1::authentication_failure_handle(
if
(
auth_vectors_generator
(
nc
))
{
// all authentication in one(AMF)
if
(
auth_vectors_generator
(
nc
))
{
// all authentication in one(AMF)
handle_auth_vector_successful_result
(
nc
);
handle_auth_vector_successful_result
(
nc
);
}
else
{
}
else
{
Logger
::
amf_n1
().
error
(
"Request
authentication v
ectors failure"
);
Logger
::
amf_n1
().
error
(
"Request
Authentication V
ectors failure"
);
send_registration_reject_msg
(
send_registration_reject_msg
(
_5GMM_CAUSE_ILLEGAL_UE
,
nc
.
get
()
->
ran_ue_ngap_id
,
_5GMM_CAUSE_ILLEGAL_UE
,
nc
.
get
()
->
ran_ue_ngap_id
,
nc
.
get
()
->
amf_ue_ngap_id
);
// cause?
nc
.
get
()
->
amf_ue_ngap_id
);
// cause?
...
@@ -2309,7 +2311,7 @@ void amf_n1::authentication_failure_handle(
...
@@ -2309,7 +2311,7 @@ void amf_n1::authentication_failure_handle(
case
_5GMM_CAUSE_NGKSI_ALREADY_IN_USE
:
{
case
_5GMM_CAUSE_NGKSI_ALREADY_IN_USE
:
{
Logger
::
amf_n1
().
debug
(
Logger
::
amf_n1
().
debug
(
"ngKSI already in use, select a new ngKSI and restart the "
"ngKSI already in use, select a new ngKSI and restart the "
"
a
uthentication procedure!"
);
"
A
uthentication procedure!"
);
// select new ngKSI and resend Authentication Request
// select new ngKSI and resend Authentication Request
ngksi_t
ngksi
=
ngksi_t
ngksi
=
(
nc
.
get
()
->
ngKsi
+
1
)
%
(
NGKSI_MAX_VALUE
+
1
);
// To be verified
(
nc
.
get
()
->
ngKsi
+
1
)
%
(
NGKSI_MAX_VALUE
+
1
);
// To be verified
...
@@ -2317,7 +2319,7 @@ void amf_n1::authentication_failure_handle(
...
@@ -2317,7 +2319,7 @@ void amf_n1::authentication_failure_handle(
int
vindex
=
nc
.
get
()
->
security_ctx
->
vector_pointer
;
int
vindex
=
nc
.
get
()
->
security_ctx
->
vector_pointer
;
if
(
!
start_authentication_procedure
(
nc
,
vindex
,
nc
.
get
()
->
ngKsi
))
{
if
(
!
start_authentication_procedure
(
nc
,
vindex
,
nc
.
get
()
->
ngKsi
))
{
Logger
::
amf_n1
().
error
(
Logger
::
amf_n1
().
error
(
"Start
a
uthentication procedure failure, reject..."
);
"Start
A
uthentication procedure failure, reject..."
);
Logger
::
amf_n1
().
error
(
Logger
::
amf_n1
().
error
(
"Ran_ue_ngap_id "
GNB_UE_NGAP_ID_FMT
,
nc
.
get
()
->
ran_ue_ngap_id
);
"Ran_ue_ngap_id "
GNB_UE_NGAP_ID_FMT
,
nc
.
get
()
->
ran_ue_ngap_id
);
send_registration_reject_msg
(
send_registration_reject_msg
(
...
@@ -3013,7 +3015,7 @@ void amf_n1::ue_initiate_de_registration_handle(
...
@@ -3013,7 +3015,7 @@ void amf_n1::ue_initiate_de_registration_handle(
// Check Deregistration type
// Check Deregistration type
uint8_t
deregType
=
0
;
uint8_t
deregType
=
0
;
dereg_request
->
getDeregistrationType
(
deregType
);
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 UE switch-off, don't need to send Deregistration Accept
if
((
deregType
&
0b00001000
)
==
0
)
{
if
((
deregType
&
0b00001000
)
==
0
)
{
...
@@ -3423,7 +3425,7 @@ void amf_n1::handle_ue_location_change(
...
@@ -3423,7 +3425,7 @@ void amf_n1::handle_ue_location_change(
std
::
string
supi
,
oai
::
amf
::
model
::
UserLocation
user_location
,
std
::
string
supi
,
oai
::
amf
::
model
::
UserLocation
user_location
,
uint8_t
http_version
)
{
uint8_t
http_version
)
{
Logger
::
amf_n1
().
debug
(
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 )"
,
"%s )"
,
supi
.
c_str
());
supi
.
c_str
());
std
::
vector
<
std
::
shared_ptr
<
amf_subscription
>>
subscriptions
=
{};
std
::
vector
<
std
::
shared_ptr
<
amf_subscription
>>
subscriptions
=
{};
...
@@ -3432,7 +3434,7 @@ void amf_n1::handle_ue_location_change(
...
@@ -3432,7 +3434,7 @@ void amf_n1::handle_ue_location_change(
if
(
subscriptions
.
size
()
>
0
)
{
if
(
subscriptions
.
size
()
>
0
)
{
// Send request to SBI to trigger the notification to the subscribed event
// 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"
);
"Send ITTI msg to AMF SBI to trigger the event notification"
);
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
...
@@ -3477,7 +3479,7 @@ void amf_n1::handle_ue_location_change(
...
@@ -3477,7 +3479,7 @@ void amf_n1::handle_ue_location_change(
void
amf_n1
::
handle_ue_reachability_status_change
(
void
amf_n1
::
handle_ue_reachability_status_change
(
std
::
string
supi
,
uint8_t
status
,
uint8_t
http_version
)
{
std
::
string
supi
,
uint8_t
status
,
uint8_t
http_version
)
{
Logger
::
amf_n1
().
debug
(
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 )"
,
"%s )"
,
supi
.
c_str
());
supi
.
c_str
());
...
@@ -3487,7 +3489,7 @@ void amf_n1::handle_ue_reachability_status_change(
...
@@ -3487,7 +3489,7 @@ void amf_n1::handle_ue_reachability_status_change(
if
(
subscriptions
.
size
()
>
0
)
{
if
(
subscriptions
.
size
()
>
0
)
{
// Send request to SBI to trigger the notification to the subscribed event
// 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"
);
"Send ITTI msg to AMF SBI to trigger the event notification"
);
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
...
@@ -3537,7 +3539,7 @@ void amf_n1::handle_ue_reachability_status_change(
...
@@ -3537,7 +3539,7 @@ void amf_n1::handle_ue_reachability_status_change(
void
amf_n1
::
handle_ue_registration_state_change
(
void
amf_n1
::
handle_ue_registration_state_change
(
std
::
string
supi
,
uint8_t
status
,
uint8_t
http_version
)
{
std
::
string
supi
,
uint8_t
status
,
uint8_t
http_version
)
{
Logger
::
amf_n1
().
debug
(
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 )"
,
"%s )"
,
supi
.
c_str
());
supi
.
c_str
());
...
@@ -3547,7 +3549,7 @@ void amf_n1::handle_ue_registration_state_change(
...
@@ -3547,7 +3549,7 @@ void amf_n1::handle_ue_registration_state_change(
if
(
subscriptions
.
size
()
>
0
)
{
if
(
subscriptions
.
size
()
>
0
)
{
// Send request to SBI to trigger the notification to the subscribed event
// 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"
);
"Send ITTI msg to AMF SBI to trigger the event notification"
);
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
...
@@ -3604,7 +3606,7 @@ void amf_n1::handle_ue_registration_state_change(
...
@@ -3604,7 +3606,7 @@ void amf_n1::handle_ue_registration_state_change(
void
amf_n1
::
handle_ue_connectivity_state_change
(
void
amf_n1
::
handle_ue_connectivity_state_change
(
std
::
string
supi
,
uint8_t
status
,
uint8_t
http_version
)
{
std
::
string
supi
,
uint8_t
status
,
uint8_t
http_version
)
{
Logger
::
amf_n1
().
debug
(
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 )"
,
"%s )"
,
supi
.
c_str
());
supi
.
c_str
());
...
@@ -3614,7 +3616,7 @@ void amf_n1::handle_ue_connectivity_state_change(
...
@@ -3614,7 +3616,7 @@ void amf_n1::handle_ue_connectivity_state_change(
if
(
subscriptions
.
size
()
>
0
)
{
if
(
subscriptions
.
size
()
>
0
)
{
// Send request to SBI to trigger the notification to the subscribed event
// 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"
);
"Send ITTI msg to AMF SBI to trigger the event notification"
);
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
std
::
shared_ptr
<
itti_sbi_notify_subscribed_event
>
itti_msg
=
...
@@ -3843,7 +3845,7 @@ void amf_n1::mobile_reachable_timer_timeout(
...
@@ -3843,7 +3845,7 @@ void amf_n1::mobile_reachable_timer_timeout(
timer_id_t
tid
=
itti_inst
->
timer_setup
(
timer_id_t
tid
=
itti_inst
->
timer_setup
(
IMPLICIT_DEREGISTRATION_TIMER_MIN
*
60
,
0
,
TASK_AMF_N1
,
IMPLICIT_DEREGISTRATION_TIMER_MIN
*
60
,
0
,
TASK_AMF_N1
,
TASK_AMF_IMPLICIT_DEREGISTRATION_TIMER_EXPIRE
,
amf_ue_ngap_id
);
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
);
"Started Implicit De-Registration Timer (tid %d)"
,
tid
);
set_implicit_deregistration_timer
(
nc
,
tid
);
set_implicit_deregistration_timer
(
nc
,
tid
);
...
@@ -4304,7 +4306,7 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
...
@@ -4304,7 +4306,7 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
std
::
shared_ptr
<
gnb_context
>
gc
=
{};
std
::
shared_ptr
<
gnb_context
>
gc
=
{};
if
(
!
amf_n2_inst
->
is_assoc_id_2_gnb_context
(
unc
.
get
()
->
gnb_assoc_id
))
{
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
);
"No existed gNB context with assoc_id (%d)"
,
unc
.
get
()
->
gnb_assoc_id
);
return
false
;
return
false
;
}
}
...
@@ -4322,7 +4324,7 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
...
@@ -4322,7 +4324,7 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
try
{
try
{
sst
=
std
::
stoi
(
s
.
sst
);
sst
=
std
::
stoi
(
s
.
sst
);
}
catch
(
const
std
::
exception
&
err
)
{
}
catch
(
const
std
::
exception
&
err
)
{
Logger
::
amf_
app
().
error
(
"Invalid SST"
);
Logger
::
amf_
n1
().
error
(
"Invalid SST"
);
return
false
;
return
false
;
}
}
nssai
.
setSst
(
sst
);
nssai
.
setSst
(
sst
);
...
...
src/amf-app/amf_n2.cpp
View file @
d0392a27
...
@@ -1366,7 +1366,7 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
...
@@ -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
(
timer_id_t
tid
=
itti_inst
->
timer_setup
(
MOBILE_REACHABLE_TIMER_NO_EMERGENCY_SERVICES_MIN
*
60
,
0
,
TASK_AMF_N1
,
MOBILE_REACHABLE_TIMER_NO_EMERGENCY_SERVICES_MIN
*
60
,
0
,
TASK_AMF_N1
,
TASK_AMF_MOBILE_REACHABLE_TIMER_EXPIRE
,
amf_ue_ngap_id
);
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
(
nc
,
tid
);
amf_n1_inst
->
set_mobile_reachable_timer_timeout
(
nc
,
false
);
amf_n1_inst
->
set_mobile_reachable_timer_timeout
(
nc
,
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