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
fec5f8fd
Commit
fec5f8fd
authored
Aug 05, 2021
by
Niuhaiwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stateless-procedure-code-available
parent
8866f3e9
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
197 additions
and
15 deletions
+197
-15
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+36
-3
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+2
-2
src/contexts/nas_context.cpp
src/contexts/nas_context.cpp
+159
-10
No files found.
src/amf-app/amf_n1.cpp
View file @
fec5f8fd
...
...
@@ -143,6 +143,26 @@ amf_n1::~amf_n1() {}
void
amf_n1
::
handle_itti_message
(
itti_downlink_nas_transfer
&
itti_msg
)
{
long
amf_ue_ngap_id
=
itti_msg
.
amf_ue_ngap_id
;
uint32_t
ran_ue_ngap_id
=
itti_msg
.
ran_ue_ngap_id
;
std
::
shared_ptr
<
nas_context
>
nc
;
Logger
::
amf_n1
().
debug
(
"try to get sequence_number"
);
nlohmann
::
json
udsf_response
;
std
::
string
record_id
=
"amf_ue_ngap_id=
\'
"
+
to_string
(
amf_ue_ngap_id
)
+
"
\'
"
;
std
::
string
udsf_url
=
"http://10.103.239.53:7123/nudsf-dr/v1/amfdata/"
+
std
::
string
(
"nas_context/records/"
)
+
record_id
;
if
(
!
amf_n2_inst
->
curl_http_client_udsf
(
udsf_url
,
""
,
"GET"
,
udsf_response
)){
Logger
::
amf_n1
().
debug
(
"No existing nas_context from UDSF using amf_ue_ngap_id (%d) ..."
,
amf_ue_ngap_id
);
}
else
if
(
udsf_response
.
dump
().
length
()
<
8
){
Logger
::
amf_n1
().
debug
(
"No existing nas_context from UDSF using amf_ue_ngap_id (%d) ....."
,
amf_ue_ngap_id
);
}
else
{
Logger
::
amf_n1
().
debug
(
"udsf_response %s"
,
udsf_response
.
dump
().
c_str
());
nc
=
std
::
shared_ptr
<
nas_context
>
(
new
nas_context
());
nc
.
get
()
->
nas_context_from_json
(
udsf_response
);
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
Logger
::
amf_n1
().
debug
(
"GET nas_context (%p) from UDSF using amf_ue_ngap_id (%d) ....."
,
nc
.
get
(),
amf_ue_ngap_id
);
}
#if 0
std::shared_ptr<nas_context> nc;
if (is_amf_ue_id_2_nas_context(amf_ue_ngap_id))
nc = amf_ue_id_2_nas_context(amf_ue_ngap_id);
...
...
@@ -151,7 +171,10 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer &itti_msg) {
amf_ue_ngap_id);
return;
}
#endif
nas_secu_ctx
*
secu
=
nc
.
get
()
->
security_ctx
;
print_buffer
(
"amf_n1"
,
"dukl kas_int:"
,
secu
->
knas_int
,
16
);
Logger
::
amf_n1
().
debug
(
"dukl dl.seq %d"
,
secu
->
dl_count
.
seq_num
);
bstring
protected_nas
;
encode_nas_message_protected
(
secu
,
false
,
INTEGRITY_PROTECTED_AND_CIPHERED
,
NAS_MESSAGE_DOWNLINK
,
...
...
@@ -2787,6 +2810,7 @@ bool amf_n1::start_authentication_procedure(std::shared_ptr<nas_context> nc,
//Update nas_context into UDSF
http_update_nas_context_into_udsf
(
nc
);
Logger
::
amf_n1
().
debug
(
"dukl start_authentication_procedure dl.seq %d"
,
nc
.
get
()
->
security_ctx
->
dl_count
.
seq_num
);
itti_send_dl_nas_buffer_to_task_n2
(
b
,
nc
.
get
()
->
ran_ue_ngap_id
,
nc
.
get
()
->
amf_ue_ngap_id
);
...
...
@@ -3061,6 +3085,7 @@ bool amf_n1::start_security_mode_control_procedure(
Authentication_5gaka
::
derive_knas
(
NAS_ENC_ALG
,
secu_ctx
->
nas_algs
.
encryption
,
nc
.
get
()
->
kamf
[
secu_ctx
->
vector_pointer
],
secu_ctx
->
knas_enc
);
print_buffer
(
"amf_n1"
,
"dukl in SMC, Knas_int"
,
secu_ctx
->
knas_int
,
16
);
security_context_is_new
=
true
;
nc
.
get
()
->
is_current_security_available
=
true
;
#if 0
...
...
@@ -3143,6 +3168,7 @@ bool amf_n1::start_security_mode_control_procedure(
nc
.
get
()
->
amf_ue_ngap_id
);
// secu_ctx->dl_count.seq_num ++;
http_update_nas_context_into_udsf
(
nc
);
Logger
::
amf_n1
().
debug
(
"dukl security_mode_command dl.seq %d"
,
nc
.
get
()
->
security_ctx
->
dl_count
.
seq_num
);
return
true
;
}
...
...
@@ -3334,6 +3360,10 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
itti_msg
->
nas
=
protectedNas
;
itti_msg
->
is_sr
=
false
;
// TODO: for Setup Request procedure
http_update_nas_context_into_udsf
(
nc
);
Logger
::
amf_n1
().
debug
(
"dukl security mode complete dl.seq %d"
,
nc
.
get
()
->
security_ctx
->
dl_count
.
seq_num
);
#if 0
/****************************hsx add*****************************/
std::string udsf_url = "http://10.28.234.76:7123/nudsf-dr/v1/amfdata/" + std::string("nas_context/records/") + to_string(nc.get()->amf_ue_ngap_id) ;
nlohmann::json udsf_response;
...
...
@@ -3344,7 +3374,7 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
amf_n2_inst->curl_http_client_udsf(udsf_url,udsf_nas_context.dump(),"PUT",udsf_response);
/****************************hsx add*****************************/
#endif
std
::
shared_ptr
<
itti_initial_context_setup_request
>
i
=
std
::
shared_ptr
<
itti_initial_context_setup_request
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
...
...
@@ -3410,7 +3440,7 @@ void amf_n1::registration_complete_handle(uint32_t ran_ue_ngap_id,
}
nas_secu_ctx
*
secu
=
nc
.
get
()
->
security_ctx
;
#if 0
//向UDSF 同步全部NAS消息
/********************** hxs add *******************************/
string auts;
...
...
@@ -3668,10 +3698,13 @@ void amf_n1::registration_complete_handle(uint32_t ran_ue_ngap_id,
amf_n2_inst->curl_http_client_udsf(udsf_url,udsf_nas_context.dump(),"PUT",udsf_response);
/********************** hxs add *******************************/
#endif
// protect nas message
bstring
protectedNas
;
encode_nas_message_protected
(
secu
,
false
,
INTEGRITY_PROTECTED_AND_CIPHERED
,
NAS_MESSAGE_DOWNLINK
,
conf
,
45
,
protectedNas
);
http_update_nas_context_into_udsf
(
nc
);
Logger
::
amf_n1
().
debug
(
"dukl registration complete complete dl.seq %d"
,
nc
.
get
()
->
security_ctx
->
dl_count
.
seq_num
);
itti_send_dl_nas_buffer_to_task_n2
(
protectedNas
,
ran_ue_ngap_id
,
amf_ue_ngap_id
);
...
...
@@ -4565,7 +4598,7 @@ void amf_n1::http_update_nas_context_into_udsf(std::shared_ptr<nas_context> nc){
{{
"Content-ID"
,
"is_common_procedure_for_nas_transport_running"
},{
"Content-Type"
,
"varchar(32)"
},{
"content"
,
to_string
(
nc
.
get
()
->
is_common_procedure_for_nas_transport_running
)}},
{{
"Content-ID"
,
"Href"
},{
"Content-Type"
,
"varchar(1024)"
},{
"content"
,
nc
.
get
()
->
Href
}},
//
{{"Content-ID", "is_current_security_available"},{"Content-Type", "varchar(32)"},{"content", to_string(nc.get()->is_current_security_available)}},
{{
"Content-ID"
,
"is_current_security_available"
},{
"Content-Type"
,
"varchar(32)"
},{
"content"
,
to_string
(
nc
.
get
()
->
is_current_security_available
)}},
{{
"Content-ID"
,
"registration_attempt_counter"
},{
"Content-Type"
,
"varchar(32)"
},{
"content"
,
to_string
(
nc
.
get
()
->
registration_attempt_counter
)}},
{{
"Content-ID"
,
"is_imsi_present"
},{
"Content-Type"
,
"varchar(32)"
},{
"content"
,
to_string
(
nc
.
get
()
->
is_imsi_present
)}},
...
...
src/amf-app/amf_n2.cpp
View file @
fec5f8fd
...
...
@@ -529,7 +529,7 @@ bool amf_n2::curl_http_client_udsf(std::string remoteUrl,std::string jsonData,st
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
std
::
string
response
=
*
httpData
.
get
();
Logger
::
amf_n2
().
debug
(
"response from udsf =(%d) %s "
,
response
.
length
(),
response
.
c_str
());
//
Logger::amf_n2().debug("response from udsf =(%d) %s ",response.length(),response.c_str());
nlohmann
::
json
response_data
=
{};
Logger
::
amf_n2
().
debug
(
"Send message to UDSF, response from UDSF, HTTP Code: %d"
,
httpCode
);
if
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_0
)
{
...
...
@@ -545,7 +545,7 @@ bool amf_n2::curl_http_client_udsf(std::string remoteUrl,std::string jsonData,st
try
{
//response_data = nlohmann::json::parse(response);
udsf_response
=
nlohmann
::
json
::
parse
(
response
);
Logger
::
amf_n2
().
debug
(
"UDSF RESPONSE in curl_http_client_udsf:
\n
%s"
,
udsf_response
.
dump
().
c_str
());
//
Logger::amf_n2().debug("UDSF RESPONSE in curl_http_client_udsf:\n %s", udsf_response.dump().c_str());
//Logger::amf_n2().debug("Get response with jsonData: %s", response_data.dump().c_str());
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
Logger
::
amf_n11
().
warn
(
"Could not get Json content from usdf the response"
);
...
...
src/contexts/nas_context.cpp
View file @
fec5f8fd
This diff is collapsed.
Click to expand it.
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