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
ecea7c50
Commit
ecea7c50
authored
Apr 21, 2022
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add (ngKSI already in use)handle and close guti
parent
9b5dc85a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
29 deletions
+79
-29
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+52
-5
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+25
-24
src/contexts/nas_context.cpp
src/contexts/nas_context.cpp
+1
-0
src/nas/common/3gpp_ts24501.hpp
src/nas/common/3gpp_ts24501.hpp
+1
-0
No files found.
src/amf-app/amf_n1.cpp
View file @
ecea7c50
...
...
@@ -228,10 +228,15 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind &nas_data_ind) {
bstring
decoded_plain_msg
;
std
::
shared_ptr
<
nas_context
>
nc
;
Logger
::
amf_n1
().
debug
(
"is_guti_valid %s"
,
nas_data_ind
.
is_guti_valid
?
"true"
:
"false"
);
if
(
nas_data_ind
.
is_guti_valid
)
{
std
::
string
guti
=
nas_data_ind
.
guti
;
if
(
is_guti_2_nas_context
(
guti
))
{
nc
=
guti_2_nas_context
(
guti
);
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
}
else
{
Logger
::
amf_n1
().
error
(
"No existing nas_context with GUTI %s"
,
nas_data_ind
.
guti
.
c_str
());
...
...
@@ -489,7 +494,7 @@ void amf_n1::uplink_nas_msg_handle(uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
case
REGISTRATION_COMPLETE
:
{
Logger
::
amf_n1
().
debug
(
"Received registration complete message, handling..."
);
registration_complete_handle
(
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
//
registration_complete_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
// TODO
}
break
;
default:
{
...
...
@@ -610,6 +615,32 @@ void amf_n1::service_request_handle(bool isNasSig,
std
::
shared_ptr
<
nas_context
>
nc
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
)
{
#if 0
{
// service reject
uint8_t nas[4];
nas[0] = EPD_5GS_MM_MSG;
nas[1] = PLAIN_5GS_MSG;
nas[2] = SERVICE_REJECT;
nas[3] = _5GMM_CAUSE_IMPLICITLY_DE_REGISTERED;
itti_dl_nas_transport *dnt =
new itti_dl_nas_transport(TASK_AMF_N1, TASK_AMF_N2);
dnt->nas = blk2bstr(nas, 4);
dnt->amf_ue_ngap_id = amf_ue_ngap_id;
dnt->ran_ue_ngap_id = ran_ue_ngap_id;
std::shared_ptr<itti_dl_nas_transport> i =
std::shared_ptr<itti_dl_nas_transport>(dnt);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N2",
i->get_msg_name());
}
return;
}
#endif
if
(
!
nc
.
get
())
{
// service reject
uint8_t
nas
[
4
];
...
...
@@ -727,8 +758,8 @@ void amf_n1::service_request_handle(bool isNasSig,
Logger
::
amf_n1
().
debug
(
"setting pdu session status 0x%02x"
,
htonl
(
pdu_session_status
));
// serApt->setPDU_session_status(0x2000);
serApt
->
setPDU_session_reactivation_result
(
0x0000
);
}
serApt
->
setPDU_session_reactivation_result
(
0x0000
);
uint8_t
buffer
[
BUFFER_SIZE_256
];
int
encoded_size
=
serApt
->
encode2buffer
(
buffer
,
BUFFER_SIZE_256
);
bstring
protectedNas
;
...
...
@@ -878,6 +909,7 @@ void amf_n1::registration_request_handle(bool isNasSig,
if
(
nc
.
get
())
{
nc
.
get
()
->
is_5g_guti_present
=
true
;
nc
.
get
()
->
to_be_register_by_new_suci
=
true
;
// nc.get()->is_imsi_present = false;
}
else
if
(
is_guti_2_nas_context
(
guti
))
{
nc
=
guti_2_nas_context
(
guti
);
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
...
...
@@ -1177,8 +1209,9 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context> &nc) {
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()->
ran_ue_ngap_id + 1);//
% (NGKSI_MAX_VALUE + 1);
ngksi
=
(
nc
.
get
()
->
amf_ue_ngap_id
+
1
);
// % (NGKSI_MAX_VALUE + 1);
}
nc
.
get
()
->
ngKsi
=
ngksi
;
handle_auth_vector_successful_result
(
nc
);
...
...
@@ -1194,7 +1227,7 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context> &nc) {
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()->
ran_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 ngKsi(%d)"
,
ngksi
);
// ... how to handle?
...
...
@@ -1797,12 +1830,13 @@ void amf_n1::handle_auth_vector_successful_result(
Logger
::
amf_n1
().
debug
(
"Received security vectors, try to setup security with the UE"
);
nc
.
get
()
->
is_auth_vectors_present
=
true
;
ngksi_t
ngksi
=
0
;
ngksi_t
ngksi
=
nc
.
get
()
->
ngKsi
;
if
(
!
nc
.
get
()
->
security_ctx
)
{
nc
.
get
()
->
security_ctx
=
new
nas_secu_ctx
();
if
(
nc
.
get
()
->
security_ctx
&&
nc
.
get
()
->
ngKsi
!=
NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE
)
ngksi
=
(
nc
.
get
()
->
amf_ue_ngap_id
+
1
)
%
(
NGKSI_MAX_VALUE
+
1
);
// ngksi = (nc.get()->ran_ue_ngap_id + 1);// % (NGKSI_MAX_VALUE + 1);
// ensure which vector is available?
nc
.
get
()
->
ngKsi
=
ngksi
;
}
...
...
@@ -2025,6 +2059,19 @@ void amf_n1::authentication_failure_handle(uint32_t ran_ue_ngap_id,
}
// authentication_failure_synch_failure_handle(nc, auts);
}
break
;
case
_5GMM_CAUSE_NGKSI_ALREADY_IN_USE
:
{
Logger
::
amf_n1
().
debug
(
"ngKSI already in use -> Initial new authentication procedure"
);
uint8_t
ngksi
=
nc
.
get
()
->
ngKsi
;
if
(
auth_vectors_generator
(
nc
))
{
// all authentication in one(AMF)
nc
.
get
()
->
ngKsi
=
ngksi
+
1
;
handle_auth_vector_successful_result
(
nc
);
}
else
{
Logger
::
amf_n1
().
error
(
"Request authentication vectors failure"
);
response_registration_reject_msg
(
_5GMM_CAUSE_ILLEGAL_UE
,
nc
.
get
()
->
ran_ue_ngap_id
,
nc
.
get
()
->
amf_ue_ngap_id
);
// cause?
}
}
break
;
}
}
...
...
src/amf-app/amf_n2.cpp
View file @
ecea7c50
...
...
@@ -492,7 +492,8 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
itti_msg
->
is_5g_s_tmsi_present
=
false
;
Logger
::
amf_n2
().
debug
(
"5g_s_tmsi not present"
);
}
else
{
itti_msg
->
is_5g_s_tmsi_present
=
true
;
// itti_msg->is_5g_s_tmsi_present = true;
itti_msg
->
is_5g_s_tmsi_present
=
false
;
itti_msg
->
_5g_s_tmsi
=
_5g_s_tmsi
;
Logger
::
amf_n2
().
debug
(
"5g_s_tmsi present"
);
...
...
@@ -682,29 +683,29 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
Logger
::
amf_n2
().
debug
(
"Encoding parameters for Service Request"
);
if
(
itti_msg
.
is_pdu_exist
)
{
std
::
vector
<
PDUSessionResourceSetupRequestItem_t
>
list
;
PDUSessionResourceSetupRequestItem_t
item
;
item
.
pduSessionId
=
itti_msg
.
pdu_session_id
;
// item.s_nssai.sst = "01";
// item.s_nssai.sd = "None";
item
.
s_nssai
.
sst
=
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sST
;
item
.
s_nssai
.
sd
=
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sD
;
item
.
pduSessionNAS_PDU
=
NULL
;
if
(
itti_msg
.
isn2sm_avaliable
)
{
//bstring n2sm = itti_msg.n2sm;
if
(
blength
(
itti_msg
.
n2sm
)
!=
0
)
{
Logger
::
amf_n2
().
debug
(
"*** test into itti_msg.n2sm ***"
);
item
.
pduSessionResourceSetupRequestTransfer
.
buf
=
(
uint8_t
*
)
bdata
(
itti_msg
.
n2sm
);
Logger
::
amf_n2
().
debug
(
"*** test into item.pduSessionResourceSetupRequestTransfer.buf ***"
);
item
.
pduSessionResourceSetupRequestTransfer
.
size
=
blength
(
itti_msg
.
n2sm
);
}
else
{
Logger
::
amf_n2
().
error
(
"n2sm empty!"
);
}
}
list
.
push_back
(
item
);
msg
->
setPduSessionResourceSetupRequestList
(
list
);
//
std::vector<PDUSessionResourceSetupRequestItem_t> list;
//
PDUSessionResourceSetupRequestItem_t item;
//
item.pduSessionId = itti_msg.pdu_session_id;
//
// item.s_nssai.sst = "01";
//
// item.s_nssai.sd = "None";
//
item.s_nssai.sst = amf_cfg.plmn_list[0].slice_list[0].sST;
//
item.s_nssai.sd = amf_cfg.plmn_list[0].slice_list[0].sD;
//
item.pduSessionNAS_PDU = NULL;
//
if (itti_msg.isn2sm_avaliable) {
//
//bstring n2sm = itti_msg.n2sm;
//
if (blength(itti_msg.n2sm) != 0) {
//
Logger::amf_n2().debug("*** test into itti_msg.n2sm ***");
//
item.pduSessionResourceSetupRequestTransfer.buf =
//
(uint8_t*) bdata(itti_msg.n2sm);
//
Logger::amf_n2().debug("*** test into item.pduSessionResourceSetupRequestTransfer.buf ***");
//
item.pduSessionResourceSetupRequestTransfer.size =
//
blength(itti_msg.n2sm);
//
} else {
//
Logger::amf_n2().error("n2sm empty!");
//
}
//
}
//
list.push_back(item);
//
msg->setPduSessionResourceSetupRequestList(list);
msg
->
setUEAggregateMaxBitRate
(
0x08a7d8c0
,
0x20989680
);
// TODO: remove hardcoded value
}
...
...
src/contexts/nas_context.cpp
View file @
ecea7c50
...
...
@@ -45,6 +45,7 @@ nas_context::nas_context() {
ueSecurityCaplen
=
2
;
ueSecurityCapEEnc
=
0
;
ueSecurityCapEInt
=
0
;
ngKsi
=
0
;
}
//------------------------------------------------------------------------------
...
...
src/nas/common/3gpp_ts24501.hpp
View file @
ecea7c50
...
...
@@ -135,6 +135,7 @@
#define _5GMM_CAUSE_SYNCH_FAILURE 0b00010101
#define _5GMM_CAUSE_IMPLICITLY_DE_REGISTERED 10
#define _5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED 9
#define _5GMM_CAUSE_NGKSI_ALREADY_IN_USE 71
// A.5 Causes related to invalid messages
//------------------------------------------------------------------------------
#define _5GMM_CAUSE_SEMANTICALLY_INCORRECT 95
...
...
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