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
5cdcf37a
Commit
5cdcf37a
authored
May 06, 2022
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix Mobility registration process
parent
ecea7c50
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
34 deletions
+83
-34
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+71
-25
src/nas/ies/5GSMobilityIdentity.cpp
src/nas/ies/5GSMobilityIdentity.cpp
+12
-9
No files found.
src/amf-app/amf_n1.cpp
View file @
5cdcf37a
...
...
@@ -302,7 +302,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind &nas_data_ind) {
mac32_recv
);
if
(
mac32
==
mac32_recv
)
{
isMatched
=
true
;
Logger
::
amf_n1
().
error
(
"Integrity matched"
);
Logger
::
amf_n1
().
info
(
"Integrity matched"
);
// nc.get()->security_ctx->ul_count.seq_num ++;
}
if
(
!
isMatched
)
{
...
...
@@ -1078,19 +1078,25 @@ void amf_n1::registration_request_handle(bool isNasSig,
}
break
;
case
PERIODIC_REGISTRATION_UPDATING
:
{
char
*
pathvar
=
NULL
;
pathvar
=
getenv
(
"IS_AMF_PERIODIC"
);
if
(
pathvar
&&
!
strcmp
(
pathvar
,
"true"
))
{
Logger
::
amf_n1
().
debug
(
"Network handling periodic registration ..."
);
if
(
is_messagecontainer
)
run_periodic_registration_update_procedure
(
nc
,
nas_msg
);
else
run_periodic_registration_update_procedure
(
nc
,
pdu_session_status
);
}
else
{
Logger
::
amf_n1
().
warn
(
"Please set environment variable
\"
IS_AMF_PERIODIC
\"
"
);
Logger
::
amf_n1
().
error
(
"Network doesn't support periodic registration, reject ..."
);
}
// char *pathvar = NULL;
// pathvar = getenv("IS_AMF_PERIODIC");
// if(pathvar && !strcmp(pathvar, "true"))
// {
// Logger::amf_n1().debug("Network handling periodic registration ...");
// if(is_messagecontainer)
// run_periodic_registration_update_procedure(nc, nas_msg);
// else
// run_periodic_registration_update_procedure(nc, pdu_session_status);
// } else{
// Logger::amf_n1().warn("Please set environment variable \"IS_AMF_PERIODIC\"");
// Logger::amf_n1().error("Network doesn't support periodic registration, reject ...");
// }
if
(
is_messagecontainer
)
run_periodic_registration_update_procedure
(
nc
,
nas_msg
);
else
run_periodic_registration_update_procedure
(
nc
,
pdu_session_status
);
}
break
;
case
EMERGENCY_REGISTRATION
:
{
if
(
!
amf_cfg
.
is_emergency_support
.
compare
(
"false"
))
{
...
...
@@ -2230,12 +2236,12 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
std
::
istringstream
sst_istr
(
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sST
);
sst_istr
>>
sst
;
Logger
::
amf_n1
().
debug
(
"**************************** amf_cfg.plmn_list[0].slice_list[0].sST = %s"
,
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sST
.
c_str
());
Logger
::
amf_n1
().
debug
(
"**************************** sst value = %d"
,
sst
);
//
Logger::amf_n1().debug("**************************** amf_cfg.plmn_list[0].slice_list[0].sST = %s",amf_cfg.plmn_list[0].slice_list[0].sST.c_str());
//
Logger::amf_n1().debug("**************************** sst value = %d",sst);
std
::
istringstream
sd_istr
(
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sD
);
sd_istr
>>
sd
;
Logger
::
amf_n1
().
debug
(
"**************************** amf_cfg.plmn_list[0].slice_list[0].sD = %s"
,
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sD
.
c_str
());
Logger
::
amf_n1
().
debug
(
"**************************** sd value = %d"
,
sd
);
//
Logger::amf_n1().debug("**************************** amf_cfg.plmn_list[0].slice_list[0].sD = %s",amf_cfg.plmn_list[0].slice_list[0].sD.c_str());
//
Logger::amf_n1().debug("**************************** sd value = %d",sd);
if
(
sst
==
0
)
sst
=
1
;
...
...
@@ -2276,7 +2282,8 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
Logger
::
amf_n1
().
warn
(
"Please set environment variable
\"
AMF_T3512_MIN
\"
"
);
}
// regAccept->setT3512_Value(0x5, t3512_Value);
regAccept
->
setT3512_Value
(
0x2
,
0
);
// regAccept->setT3512_Value(0x2, 0);
regAccept
->
setT3512_Value
(
0x5
,
0x1
);
uint8_t
buffer
[
BUFFER_SIZE_1024
]
=
{
0
};
int
encoded_size
=
regAccept
->
encode2buffer
(
buffer
,
BUFFER_SIZE_1024
);
print_buffer
(
"amf_n1"
,
"Registration-Accept message buffer"
,
buffer
,
...
...
@@ -2937,7 +2944,8 @@ void amf_n1::run_mobility_registration_update_procedure(
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
0x264a34c0
);
// regAccept->setT3512_Value(0x5, 0x1e);
regAccept
->
setT3512_Value
(
0x2
,
0
);
// regAccept->setT3512_Value(0x2, 0);
regAccept
->
setT3512_Value
(
0x5
,
0x1
);
std
::
vector
<
p_tai_t
>
tai_list
;
p_tai_t
item0
;
...
...
@@ -3045,7 +3053,8 @@ void amf_n1::run_periodic_registration_update_procedure(
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
0x264a34c0
);
// regAccept->setT3512_Value(0x5, 0x1e);
regAccept
->
setT3512_Value
(
0x2
,
0
);
// regAccept->setT3512_Value(0x2, 0);
regAccept
->
setT3512_Value
(
0x5
,
0x1
);
std
::
vector
<
p_tai_t
>
tai_list
;
p_tai_t
item0
;
...
...
@@ -3130,11 +3139,25 @@ void amf_n1::run_periodic_registration_update_procedure(
RegistrationAccept
*
regAccept
=
new
RegistrationAccept
();
regAccept
->
setHeader
(
PLAIN_5GS_MSG
);
regAccept
->
set_5GS_Registration_Result
(
false
,
false
,
false
,
0x01
);
regAccept
->
set5G_GUTI
(
amf_cfg
.
guami
.
mcc
,
amf_cfg
.
guami
.
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
0x264a34c0
);
nas
::
_5G_GUTI_t
_5g_guti
;
if
(
regReq
->
ie_5gs_mobility_id
)
{
regReq
->
ie_5gs_mobility_id
->
get5GGUTI
(
_5g_guti
);
}
else
{
Logger
::
amf_n1
().
error
(
"no exist _5g_guti"
);
return
;
}
regAccept
->
set5G_GUTI
(
amf_cfg
.
guami
.
mcc
,
amf_cfg
.
guami
.
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
_5g_guti
.
_5g_tmsi
);
//guti
// regAccept->set5G_GUTI(amf_cfg.guami.mcc, amf_cfg.guami.mnc,
// amf_cfg.guami.regionID, amf_cfg.guami.AmfSetID,
// amf_cfg.guami.AmfPointer, 0x264a34c0); //guti
// regAccept->setT3512_Value(0x5, 0x1e);
regAccept
->
setT3512_Value
(
0x2
,
0
);
// regAccept->setT3512_Value(0x2, 0);
regAccept
->
setT3512_Value
(
0x5
,
0x1
);
std
::
vector
<
p_tai_t
>
tai_list
;
p_tai_t
item0
;
...
...
@@ -3180,6 +3203,29 @@ void amf_n1::run_periodic_registration_update_procedure(
}
else
{
delete
regAccept
;
}
std
::
string
guti_str
=
amf_cfg
.
guami
.
mcc
+
amf_cfg
.
guami
.
mnc
+
amf_cfg
.
guami
.
regionID
+
amf_cfg
.
guami
.
AmfSetID
+
amf_cfg
.
guami
.
AmfPointer
+
std
::
to_string
(
_5g_guti
.
_5g_tmsi
);
Logger
::
amf_n1
().
error
(
"_5g_guti is str(%s) tmsi is value(%d)"
,
guti_str
.
c_str
(),
_5g_guti
.
_5g_tmsi
);
if
((
nc
.
get
()
->
security_ctx
==
nullptr
)
&&
is_guti_2_nas_context
(
guti_str
))
{
long
amfid
=
nc
.
get
()
->
amf_ue_ngap_id
;
uint32_t
ranid
=
nc
.
get
()
->
ran_ue_ngap_id
;
nc
=
guti_2_nas_context
(
guti_str
);
nc
.
get
()
->
amf_ue_ngap_id
=
amfid
;
nc
.
get
()
->
ran_ue_ngap_id
=
ranid
;
set_amf_ue_ngap_id_2_nas_context
(
amfid
,
nc
);
}
else
{
if
(
is_guti_2_nas_context
(
guti_str
))
Logger
::
amf_n1
().
error
(
"guti_2_nas_context is nullptr"
);
if
(
nc
.
get
()
->
security_ctx
==
nullptr
)
{
Logger
::
amf_n1
().
error
(
"security_ctx is nullptr"
);
return
;
}
}
nas_secu_ctx
*
secu
=
nc
.
get
()
->
security_ctx
;
// protect nas message
bstring
protectedNas
;
...
...
src/nas/ies/5GSMobilityIdentity.cpp
View file @
5cdcf37a
...
...
@@ -659,24 +659,27 @@ int _5GSMobilityIdentity::_5g_guti_decodefrombuffer(uint8_t* buf, int len) {
octet
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"Octet 0x%x"
,
octet
);
digit
[
0
]
=
octet
;
tmsi
|=
octet
;
digit
[
3
]
=
octet
;
//
tmsi |= octet;
octet
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"Octet 0x%x"
,
octet
);
digit
[
1
]
=
octet
;
tmsi
|=
octet
<<
8
;
digit
[
2
]
=
octet
;
//
tmsi |= octet << 8;
octet
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"Octet 0x%x"
,
octet
);
digit
[
2
]
=
octet
;
tmsi
|=
octet
<<
16
;
digit
[
1
]
=
octet
;
//
tmsi |= octet << 16;
octet
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"Octet 0x%x"
,
octet
);
digit
[
3
]
=
octet
;
tmsi
|=
octet
<<
24
;
_5g_guti
->
_5g_tmsi
=
tmsi
;
digit
[
0
]
=
octet
;
// tmsi |= octet << 24;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
tmsi
|=
(
digit
[
i
]
<<
(
i
*
8
));
_5g_guti
->
_5g_tmsi
=
tmsi
;
Logger
::
nas_mm
().
debug
(
"decoding 5GSMobilityIdentity 5G-GUTI"
);
return
decoded_size
;
}
...
...
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