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
60ba82f5
Commit
60ba82f5
authored
Apr 28, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue for PLMN (MNC length=2, starting with 0)
parent
b598727b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
47 deletions
+85
-47
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+52
-29
src/nas/msgs/ULNASTransport.cpp
src/nas/msgs/ULNASTransport.cpp
+1
-0
src/ngap/ngapIEs/PlmnId.cpp
src/ngap/ngapIEs/PlmnId.cpp
+25
-15
src/ngap/ngapIEs/PlmnId.hpp
src/ngap/ngapIEs/PlmnId.hpp
+3
-3
src/ngap/ngapIEs/ResetType.cpp
src/ngap/ngapIEs/ResetType.cpp
+1
-0
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionItem.cpp
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionItem.cpp
+2
-0
src/ngap/ngapMsgs/NGReset.cpp
src/ngap/ngapMsgs/NGReset.cpp
+1
-0
No files found.
src/amf-app/amf_n1.cpp
View file @
60ba82f5
...
@@ -2075,14 +2075,6 @@ void amf_n1::security_mode_complete_handle(
...
@@ -2075,14 +2075,6 @@ void amf_n1::security_mode_complete_handle(
return
;
return
;
}
}
if
(
!
uc
.
get
()
->
isUeContextRequest
)
{
Logger
::
amf_n1
().
debug
(
"UE Context is not requested, UE with ran_ue_ngap_id %d, "
"amf_ue_ngap_id %d attached"
,
ran_ue_ngap_id
,
amf_ue_ngap_id
);
// send registration accept back
}
else
{
// encoding InitialContextSetupRequest(NGAP message) back
std
::
shared_ptr
<
nas_context
>
nc
;
std
::
shared_ptr
<
nas_context
>
nc
;
nc
=
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
nc
=
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
Logger
::
amf_n1
().
info
(
Logger
::
amf_n1
().
info
(
...
@@ -2111,6 +2103,36 @@ void amf_n1::security_mode_complete_handle(
...
@@ -2111,6 +2103,36 @@ void amf_n1::security_mode_complete_handle(
encode_nas_message_protected
(
encode_nas_message_protected
(
secu
,
false
,
INTEGRITY_PROTECTED_AND_CIPHERED
,
NAS_MESSAGE_DOWNLINK
,
secu
,
false
,
INTEGRITY_PROTECTED_AND_CIPHERED
,
NAS_MESSAGE_DOWNLINK
,
buffer
,
encoded_size
,
protectedNas
);
buffer
,
encoded_size
,
protectedNas
);
if
(
!
uc
.
get
()
->
isUeContextRequest
)
{
Logger
::
amf_n1
().
debug
(
"UE Context is not requested, UE with ran_ue_ngap_id %d, "
"amf_ue_ngap_id %d attached"
,
ran_ue_ngap_id
,
amf_ue_ngap_id
);
// TODO: Use DownlinkNasTransport to convey Registration Accept
// 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());
}
*/
}
else
{
// use InitialContextSetupRequest (NGAP message) to convey Registration
// Accept
uint8_t
*
kamf
=
nc
.
get
()
->
kamf
[
secu
->
vector_pointer
];
uint8_t
*
kamf
=
nc
.
get
()
->
kamf
[
secu
->
vector_pointer
];
uint8_t
kgnb
[
32
];
uint8_t
kgnb
[
32
];
uint32_t
ulcount
=
secu
->
ul_count
.
seq_num
|
(
secu
->
ul_count
.
overflow
<<
8
);
uint32_t
ulcount
=
secu
->
ul_count
.
seq_num
|
(
secu
->
ul_count
.
overflow
<<
8
);
...
@@ -2119,6 +2141,7 @@ void amf_n1::security_mode_complete_handle(
...
@@ -2119,6 +2141,7 @@ void amf_n1::security_mode_complete_handle(
print_buffer
(
"amf_n1"
,
"kamf"
,
kamf
,
32
);
print_buffer
(
"amf_n1"
,
"kamf"
,
kamf
,
32
);
// Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb);
// Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb);
bstring
kgnb_bs
=
blk2bstr
(
kgnb
,
32
);
bstring
kgnb_bs
=
blk2bstr
(
kgnb
,
32
);
itti_initial_context_setup_request
*
itti_msg
=
itti_initial_context_setup_request
*
itti_msg
=
new
itti_initial_context_setup_request
(
TASK_AMF_N1
,
TASK_AMF_N2
);
new
itti_initial_context_setup_request
(
TASK_AMF_N1
,
TASK_AMF_N2
);
itti_msg
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
itti_msg
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
...
...
src/nas/msgs/ULNASTransport.cpp
View file @
60ba82f5
...
@@ -412,4 +412,5 @@ int ULNASTransport::decodefrombuffer(
...
@@ -412,4 +412,5 @@ int ULNASTransport::decodefrombuffer(
}
}
Logger
::
nas_mm
().
debug
(
Logger
::
nas_mm
().
debug
(
"decoded ULNASTransport message len(%d)"
,
decoded_size
);
"decoded ULNASTransport message len(%d)"
,
decoded_size
);
return
0
;
}
}
src/ngap/ngapIEs/PlmnId.cpp
View file @
60ba82f5
...
@@ -58,13 +58,17 @@ void PlmnId::setMccMnc(const std::string mcc, const std::string mnc) {
...
@@ -58,13 +58,17 @@ void PlmnId::setMccMnc(const std::string mcc, const std::string mnc) {
int
mncValue
=
fromString
<
int
>
(
mnc
);
int
mncValue
=
fromString
<
int
>
(
mnc
);
mcc_digit1
=
mccValue
/
100
;
mcc_digit1
=
mccValue
/
100
;
mcc_digit2
=
(
uint8_t
)
floor
((
double
)
(
mccValue
%
100
)
/
10
);
mcc_digit2
=
(
mccValue
-
mcc_digit1
*
100
)
/
10
;
mcc_digit3
=
mccValue
%
10
;
mcc_digit3
=
mccValue
%
10
;
mnc_digit1
=
(
uint8_t
)
floor
(((
double
)
mncValue
/
100
));
if
(
mncValue
>
99
)
{
if
(
!
mnc_digit1
)
mnc_digit1
=
0xf
;
mnc_digit3
=
mncValue
/
100
;
mnc_digit2
=
(
uint8_t
)
floor
((
double
)
(
mncValue
%
100
)
/
10
);
}
else
{
mnc_digit3
=
mncValue
%
10
;
mnc_digit3
=
0xf
;
}
mnc_digit1
=
(
uint8_t
)
floor
((
double
)
(
mncValue
%
100
)
/
10
);
mnc_digit2
=
mncValue
%
10
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -76,10 +80,15 @@ void PlmnId::getMcc(std::string& mcc) {
...
@@ -76,10 +80,15 @@ void PlmnId::getMcc(std::string& mcc) {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
PlmnId
::
getMnc
(
std
::
string
&
mnc
)
{
void
PlmnId
::
getMnc
(
std
::
string
&
mnc
)
{
int
m_mnc
=
0
;
int
m_mnc
=
0
;
if
(
mnc_digit1
==
0xf
)
if
(
mnc_digit3
==
0xf
)
{
m_mnc
=
mnc_digit2
*
10
+
mnc_digit3
;
m_mnc
=
mnc_digit1
*
10
+
mnc_digit2
;
else
if
(
mnc_digit1
==
0
)
{
m_mnc
=
mnc_digit1
*
100
+
mnc_digit2
*
10
+
mnc_digit3
;
mnc
=
"0"
+
to_string
(
m_mnc
);
return
;
}
}
else
{
m_mnc
=
mnc_digit3
*
100
+
mnc_digit1
*
10
+
mnc_digit2
;
}
mnc
=
to_string
(
m_mnc
);
mnc
=
to_string
(
m_mnc
);
}
}
...
@@ -89,9 +98,9 @@ bool PlmnId::encode2octetstring(Ngap_PLMNIdentity_t& plmn) {
...
@@ -89,9 +98,9 @@ bool PlmnId::encode2octetstring(Ngap_PLMNIdentity_t& plmn) {
uint8_t
*
buffer
=
(
uint8_t
*
)
calloc
(
1
,
3
*
sizeof
(
uint8_t
));
uint8_t
*
buffer
=
(
uint8_t
*
)
calloc
(
1
,
3
*
sizeof
(
uint8_t
));
if
(
!
buffer
)
return
false
;
if
(
!
buffer
)
return
false
;
buffer
[
0
]
=
(
mcc_digit1
&
0x0f
)
|
((
mcc_digit2
&
0x0f
)
<<
4
);
buffer
[
0
]
=
0x00
|
((
mcc_digit2
&
0x0f
)
<<
4
)
|
(
mcc_digit1
&
0x0f
);
buffer
[
1
]
=
(
mcc_digit3
&
0x0f
)
|
((
mnc_digit1
&
0x0f
)
<<
4
);
buffer
[
1
]
=
0x00
|
((
mnc_digit3
&
0x0f
)
<<
4
)
|
(
mcc_digit3
&
0x0f
);
buffer
[
2
]
=
(
mnc_digit2
&
0x0f
)
|
((
mnc_digit3
&
0x0f
)
<<
4
);
buffer
[
2
]
=
0x00
|
((
mnc_digit2
&
0x0f
)
<<
4
)
|
(
mnc_digit1
&
0x0f
);
plmn
.
buf
=
buffer
;
plmn
.
buf
=
buffer
;
return
true
;
return
true
;
...
@@ -102,10 +111,11 @@ bool PlmnId::decodefromoctetstring(Ngap_PLMNIdentity_t& plmn) {
...
@@ -102,10 +111,11 @@ bool PlmnId::decodefromoctetstring(Ngap_PLMNIdentity_t& plmn) {
if
(
!
plmn
.
buf
)
return
false
;
if
(
!
plmn
.
buf
)
return
false
;
mcc_digit1
=
plmn
.
buf
[
0
]
&
0x0f
;
mcc_digit1
=
plmn
.
buf
[
0
]
&
0x0f
;
mcc_digit2
=
plmn
.
buf
[
0
]
>>
4
;
mcc_digit2
=
plmn
.
buf
[
0
]
>>
4
;
mcc_digit3
=
plmn
.
buf
[
1
]
&
0x0f
;
mcc_digit3
=
plmn
.
buf
[
1
]
&
0x0f
;
mnc_digit
1
=
plmn
.
buf
[
1
]
>>
4
;
mnc_digit
3
=
plmn
.
buf
[
1
]
>>
4
;
mnc_digit
2
=
plmn
.
buf
[
2
]
&
0x0f
;
mnc_digit
1
=
plmn
.
buf
[
2
]
&
0x0f
;
mnc_digit
3
=
plmn
.
buf
[
2
]
>>
4
;
mnc_digit
2
=
plmn
.
buf
[
2
]
>>
4
;
return
true
;
return
true
;
}
}
...
...
src/ngap/ngapIEs/PlmnId.hpp
View file @
60ba82f5
...
@@ -49,12 +49,12 @@ class PlmnId {
...
@@ -49,12 +49,12 @@ class PlmnId {
void
getMnc
(
std
::
string
&
mnc
);
void
getMnc
(
std
::
string
&
mnc
);
private:
private:
uint8_t
mcc_digit1
;
uint8_t
mcc_digit2
;
uint8_t
mcc_digit2
;
uint8_t
mcc_digit1
;
uint8_t
mnc_digit3
;
// in case of 2 digit MNC, it should be 0xf
uint8_t
mcc_digit3
;
uint8_t
mcc_digit3
;
uint8_t
mnc_digit1
;
// in case of 2 digit MNC, it should be 0xf
uint8_t
mnc_digit2
;
uint8_t
mnc_digit2
;
uint8_t
mnc_digit
3
;
uint8_t
mnc_digit
1
;
};
};
}
// namespace ngap
}
// namespace ngap
...
...
src/ngap/ngapIEs/ResetType.cpp
View file @
60ba82f5
...
@@ -85,6 +85,7 @@ bool ResetType::decode(Ngap_ResetType_t* type) {
...
@@ -85,6 +85,7 @@ bool ResetType::decode(Ngap_ResetType_t* type) {
}
else
{
}
else
{
return
false
;
return
false
;
}
}
return
true
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
src/ngap/ngapIEs/UEAssociationLogicalNGConnectionItem.cpp
View file @
60ba82f5
...
@@ -89,6 +89,7 @@ bool UEAssociationLogicalNGConnectionItem::encode(
...
@@ -89,6 +89,7 @@ bool UEAssociationLogicalNGConnectionItem::encode(
amfUeNgapId
->
encode2AMF_UE_NGAP_ID
(
*
item
.
aMF_UE_NGAP_ID
);
amfUeNgapId
->
encode2AMF_UE_NGAP_ID
(
*
item
.
aMF_UE_NGAP_ID
);
item
.
rAN_UE_NGAP_ID
=
new
Ngap_RAN_UE_NGAP_ID_t
();
item
.
rAN_UE_NGAP_ID
=
new
Ngap_RAN_UE_NGAP_ID_t
();
ranUeNgapId
->
encode2RAN_UE_NGAP_ID
(
*
item
.
rAN_UE_NGAP_ID
);
ranUeNgapId
->
encode2RAN_UE_NGAP_ID
(
*
item
.
rAN_UE_NGAP_ID
);
return
true
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -98,6 +99,7 @@ bool UEAssociationLogicalNGConnectionItem::encode(
...
@@ -98,6 +99,7 @@ bool UEAssociationLogicalNGConnectionItem::encode(
item
.
amfUeNgapId
=
amfUeNgapId
;
item
.
amfUeNgapId
=
amfUeNgapId
;
item
.
ranUeNgapId
=
new
RAN_UE_NGAP_ID
();
item
.
ranUeNgapId
=
new
RAN_UE_NGAP_ID
();
item
.
ranUeNgapId
=
ranUeNgapId
;
item
.
ranUeNgapId
=
ranUeNgapId
;
return
true
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
src/ngap/ngapMsgs/NGReset.cpp
View file @
60ba82f5
...
@@ -108,6 +108,7 @@ bool NGResetMsg::getResetType(ResetType& resetType) {
...
@@ -108,6 +108,7 @@ bool NGResetMsg::getResetType(ResetType& resetType) {
this
->
resetType
->
getResetType
()
==
Ngap_ResetType_PR_partOfNG_Interface
)
{
this
->
resetType
->
getResetType
()
==
Ngap_ResetType_PR_partOfNG_Interface
)
{
// TODO
// TODO
}
}
return
true
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
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