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
1d292816
Commit
1d292816
authored
Apr 29, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use InitialUEContextSetup to convey PDUSessionResourceSetupTransfer
parent
c84fd646
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
35 deletions
+88
-35
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+77
-31
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+7
-2
src/secu_algorithms/5gaka/authentication_algorithms_with_5gaka.cpp
...algorithms/5gaka/authentication_algorithms_with_5gaka.cpp
+4
-2
No files found.
src/amf-app/amf_n1.cpp
View file @
1d292816
...
...
@@ -171,21 +171,68 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) {
i
->
get_msg_name
());
}
}
else
{
// PDU SESSION RESOURCE SETUP_REQUEST
itti_pdu_session_resource_setup_request
*
psrsr
=
new
itti_pdu_session_resource_setup_request
(
TASK_AMF_N1
,
TASK_AMF_N2
);
psrsr
->
nas
=
protected_nas
;
psrsr
->
n2sm
=
itti_msg
.
n2sm
;
psrsr
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
psrsr
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
psrsr
->
pdu_session_id
=
itti_msg
.
pdu_session_id
;
std
::
shared_ptr
<
itti_pdu_session_resource_setup_request
>
i
=
std
::
shared_ptr
<
itti_pdu_session_resource_setup_request
>
(
psrsr
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
ran_ue_ngap_id
)
+
":amfid_"
+
to_string
(
amf_ue_ngap_id
);
std
::
shared_ptr
<
ue_context
>
uc
;
uc
=
amf_app_inst
->
ran_amf_id_2_ue_context
(
ue_context_key
);
if
(
uc
.
get
()
==
nullptr
)
{
// TODO:
Logger
::
amf_n1
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N2"
,
i
->
get_msg_name
());
"ue_context in amf_app using ran_amf_id (%s) does not existed!"
,
ue_context_key
.
c_str
());
}
Logger
::
amf_n1
().
info
(
"Found ue_context (%p) in amf_app using ran_amf_id (%s)"
,
uc
.
get
(),
ue_context_key
.
c_str
());
if
(
uc
.
get
()
->
isUeContextRequest
)
{
// PDU SESSION RESOURCE SETUP_REQUEST
itti_pdu_session_resource_setup_request
*
psrsr
=
new
itti_pdu_session_resource_setup_request
(
TASK_AMF_N1
,
TASK_AMF_N2
);
psrsr
->
nas
=
protected_nas
;
psrsr
->
n2sm
=
itti_msg
.
n2sm
;
psrsr
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
psrsr
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
psrsr
->
pdu_session_id
=
itti_msg
.
pdu_session_id
;
std
::
shared_ptr
<
itti_pdu_session_resource_setup_request
>
i
=
std
::
shared_ptr
<
itti_pdu_session_resource_setup_request
>
(
psrsr
);
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
());
}
}
else
{
// send using InitialContextSetupRequest
uint8_t
*
kamf
=
nc
.
get
()
->
kamf
[
secu
->
vector_pointer
];
uint8_t
kgnb
[
32
];
uint32_t
ulcount
=
secu
->
ul_count
.
seq_num
|
(
secu
->
ul_count
.
overflow
<<
8
);
Authentication_5gaka
::
derive_kgnb
(
0
,
0x01
,
kamf
,
kgnb
);
ncc
=
1
;
print_buffer
(
"amf_n1"
,
"kamf"
,
kamf
,
32
);
// Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb);
bstring
kgnb_bs
=
blk2bstr
(
kgnb
,
32
);
itti_initial_context_setup_request
*
csr
=
new
itti_initial_context_setup_request
(
TASK_AMF_N1
,
TASK_AMF_N2
);
csr
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
csr
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
csr
->
kgnb
=
kgnb_bs
;
csr
->
nas
=
protected_nas
;
csr
->
pdu_session_id
=
itti_msg
.
pdu_session_id
;
csr
->
is_pdu_exist
=
true
;
csr
->
n2sm
=
itti_msg
.
n2sm
;
csr
->
is_sr
=
false
;
// TODO: for Service Request procedure
std
::
shared_ptr
<
itti_initial_context_setup_request
>
i
=
std
::
shared_ptr
<
itti_initial_context_setup_request
>
(
csr
);
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
());
}
}
}
}
else
{
...
...
@@ -734,7 +781,7 @@ void amf_n1::service_request_handle(
itti_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_msg
->
nas
=
protectedNas
;
itti_msg
->
kgnb
=
kgnb_bs
;
itti_msg
->
is_sr
=
true
;
//
service r
equest indicator
itti_msg
->
is_sr
=
true
;
//
Service R
equest indicator
itti_msg
->
is_pdu_exist
=
false
;
std
::
shared_ptr
<
itti_initial_context_setup_request
>
i
=
std
::
shared_ptr
<
itti_initial_context_setup_request
>
(
itti_msg
);
...
...
@@ -782,7 +829,7 @@ void amf_n1::service_request_handle(
itti_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_msg
->
nas
=
protectedNas
;
itti_msg
->
kgnb
=
kgnb_bs
;
itti_msg
->
is_sr
=
true
;
//
service r
equest indicator
itti_msg
->
is_sr
=
true
;
//
Service R
equest indicator
itti_msg
->
pdu_session_id
=
pdu_session_id
;
itti_msg
->
is_pdu_exist
=
true
;
if
(
psc
.
get
()
->
isn2sm_avaliable
)
{
...
...
@@ -2114,20 +2161,19 @@ void amf_n1::security_mode_complete_handle(
// IE: UEAggregateMaximumBitRate
// AllowedNSSAI
/* itti_dl_nas_transport* dnt =
new itti_dl_nas_transport(TASK_AMF_N1, TASK_AMF_N2);
dnt->nas = ;
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());
}
*/
itti_dl_nas_transport
*
dnt
=
new
itti_dl_nas_transport
(
TASK_AMF_N1
,
TASK_AMF_N2
);
dnt
->
nas
=
protectedNas
;
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
());
}
}
else
{
// use InitialContextSetupRequest (NGAP message) to convey Registration
...
...
@@ -2148,7 +2194,7 @@ void amf_n1::security_mode_complete_handle(
itti_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_msg
->
kgnb
=
kgnb_bs
;
itti_msg
->
nas
=
protectedNas
;
itti_msg
->
is_sr
=
false
;
// TODO: for Se
tup
Request procedure
itti_msg
->
is_sr
=
false
;
// TODO: for Se
rvice
Request procedure
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
);
...
...
src/amf-app/amf_n2.cpp
View file @
1d292816
...
...
@@ -728,14 +728,19 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
msg
->
setAllowedNssai
(
list
);
bdestroy
(
itti_msg
.
nas
);
bdestroy
(
itti_msg
.
kgnb
);
if
(
itti_msg
.
is_sr
)
{
if
(
itti_msg
.
is_sr
or
itti_msg
.
is_pdu_exist
)
{
// TODO: to add UEAggregateMaximumBitRate
bstring
ueCapability
=
gc
.
get
()
->
ue_radio_cap_ind
;
uint8_t
*
uecap
=
(
uint8_t
*
)
calloc
(
1
,
blength
(
ueCapability
)
+
1
);
memcpy
(
uecap
,
(
uint8_t
*
)
bdata
(
ueCapability
),
blength
(
ueCapability
));
uecap
[
blength
(
ueCapability
)]
=
'\0'
;
msg
->
setUERadioCapability
(
uecap
,
(
size_t
)
blength
(
ueCapability
));
free
(
uecap
);
Logger
::
amf_n2
().
debug
(
"Encoding parameters for Service Request"
);
if
(
itti_msg
.
is_sr
)
Logger
::
amf_n2
().
debug
(
"Encoding parameters for Service Request"
);
else
Logger
::
amf_n2
().
debug
(
"Encoding parameters for Initial Context Setup Request"
);
if
(
itti_msg
.
is_pdu_exist
)
{
std
::
vector
<
PDUSessionResourceSetupRequestItem_t
>
list
;
...
...
src/secu_algorithms/5gaka/authentication_algorithms_with_5gaka.cpp
View file @
1d292816
...
...
@@ -540,7 +540,7 @@ uint8_t* Authentication_5gaka::sqn_ms_derive(
uint8_t
*
mac_s
=
NULL
;
uint8_t
mac_s_computed
[
MAC_S_LENGTH
]
=
{
0
};
uint8_t
*
sqn_ms
=
NULL
;
uint8_t
amf
[
2
]
=
{
0x
80
,
0x00
};
uint8_t
amf
[
2
]
=
{
0x
00
,
0x00
};
// TODO: To be verified
int
i
=
0
;
conc_sqn_ms
=
auts
;
...
...
@@ -570,7 +570,9 @@ uint8_t* Authentication_5gaka::sqn_ms_derive(
// print_buffer ("MAC_S +: ", mac_s_computed, 8);
if
(
memcmp
(
mac_s_computed
,
mac_s
,
8
)
!=
0
)
{
// FPRINTF_ERROR ( "Failed to verify computed SQN_MS\n");
Logger
::
amf_n1
().
debug
(
"sqn_ms_derive, failed to verify computed SQN_MS (MAC does not "
"matched!)"
);
free
(
sqn_ms
);
return
NULL
;
}
...
...
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