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
27b6e5bf
Commit
27b6e5bf
authored
Apr 12, 2022
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sctp-server: increase receive bytes, encode size bits -> bytes
parent
f13af891
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
123 additions
and
26 deletions
+123
-26
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+93
-13
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+18
-11
src/nas/ies/UENetworkCapability.cpp
src/nas/ies/UENetworkCapability.cpp
+4
-0
src/ngap/libngap/per_encoder.c
src/ngap/libngap/per_encoder.c
+7
-1
src/sctp/sctp_server.hpp
src/sctp/sctp_server.hpp
+1
-1
No files found.
src/amf-app/amf_n1.cpp
View file @
27b6e5bf
...
...
@@ -28,6 +28,8 @@
#include "amf_n1.hpp"
#include <sstream>
#include "AuthenticationFailure.hpp"
#include "AuthenticationRequest.hpp"
#include "AuthenticationResponse.hpp"
...
...
@@ -567,6 +569,40 @@ void amf_n1::identity_response_handle(uint32_t ran_ue_ngap_id,
if
(
nc
.
get
()
->
to_be_register_by_new_suci
)
{
run_registration_procedure
(
nc
);
}
if
(
!
nc
.
get
()
->
is_stacs_available
)
{
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->amf_ue_id_2_ue_context(amf_ue_ngap_id);
Logger
::
amf_n1
().
info
(
"Try to find ue_context in amf_app using ran_amf_id (%s)"
,
ue_context_key
.
c_str
());
uc
=
amf_app_inst
->
ran_amf_id_2_ue_context
(
ue_context_key
);
ue_info_t
ueItem
;
ueItem
.
connStatus
=
"5GMM-CONNECTED"
;
//"CM-CONNECTED";
ueItem
.
registerStatus
=
"5GMM-REG-INITIATED"
;
// 5GMM-COMMON-PROCEDURE-INITIATED
ueItem
.
ranid
=
ran_ue_ngap_id
;
ueItem
.
amfid
=
amf_ue_ngap_id
;
ueItem
.
imsi
=
nc
.
get
()
->
imsi
;
ueItem
.
mcc
=
uc
.
get
()
->
cgi
.
mcc
;
ueItem
.
mnc
=
uc
.
get
()
->
cgi
.
mnc
;
ueItem
.
cellId
=
uc
.
get
()
->
cgi
.
nrCellID
;
std
::
shared_ptr
<
ue_ngap_context
>
unc
;
unc
=
amf_n2_inst
->
ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
);
if
(
unc
.
get
()
==
nullptr
)
{
Logger
::
amf_n2
().
error
(
"Illegal UE with ran_ue_ngap_id (0x%x)"
,
ran_ue_ngap_id
);
return
;
}
ueItem
.
gnb_assoc_id
=
unc
.
get
()
->
gnb_assoc_id
;
stacs
.
update_ue_info
(
ueItem
);
set_5gmm_state
(
nc
,
_5GMM_COMMON_PROCEDURE_INITIATED
);
nc
.
get
()
->
is_stacs_available
=
true
;
}
}
//------------------------------------------------------------------------------
...
...
@@ -828,7 +864,8 @@ void amf_n1::registration_request_handle(bool isNasSig,
}
if(add_new_ue)
stacs.ues.push_back(ueItem);
*/
}
*/
}
// nc.get()->imsi = //need interface to transfer SUCI_imsi_t to string
}
}
break
;
...
...
@@ -1213,7 +1250,7 @@ bool amf_n1::auth_vectors_generator(std::shared_ptr<nas_context> &nc) {
return
true
;
}
//------------------------------------------------------------------------------
#define CURL_TIMEOUT_MS
3
00L
#define CURL_TIMEOUT_MS
10
00L
std
::
size_t
callback_ausf
(
const
char
*
in
,
std
::
size_t
size
,
std
::
size_t
num
,
std
::
string
*
out
)
{
...
...
@@ -2141,8 +2178,27 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
std
::
vector
<
struct
SNSSAI_s
>
nssai
=
{};
SNSSAI_t
snssai
=
{};
snssai
.
sst
=
1
;
snssai
.
sd
=
-
1
;
uint32_t
sst
=
1
;
int32_t
sd
=
-
1
;
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
);
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
);
if
(
sst
==
0
)
sst
=
1
;
if
(
sd
==
0
)
sd
=
-
1
;
snssai
.
sst
=
sst
;
snssai
.
sd
=
sd
;
snssai
.
mHplmnSst
=
-
1
;
snssai
.
mHplmnSd
=
-
1
;
nssai
.
push_back
(
snssai
);
...
...
@@ -2154,7 +2210,9 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id,
Logger
::
amf_n1
().
debug
(
"Allocated GUTI %s"
,
guti
.
c_str
());
// TODO: remove hardcoded values
regAccept
->
set_5GS_Network_Feature_Support
(
0x01
,
0x00
);
// regAccept->set_5GS_Network_Feature_Support(0x01, 0x00);
regAccept
->
set_5GS_Network_Feature_Support
(
0x00
,
0x00
);
char
*
pathvar
=
NULL
;
pathvar
=
getenv
(
"AMF_T3512_MIN"
);
uint8_t
t3512_Value
=
0x1e
;
...
...
@@ -2170,7 +2228,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(0x5, t3512_Value);
regAccept
->
setT3512_Value
(
0x2
,
0
);
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
,
...
...
@@ -2830,7 +2889,8 @@ void amf_n1::run_mobility_registration_update_procedure(
regAccept
->
set5G_GUTI
(
amf_cfg
.
guami
.
mcc
,
amf_cfg
.
guami
.
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
0x264a34c0
);
regAccept
->
setT3512_Value
(
0x5
,
0x1e
);
// regAccept->setT3512_Value(0x5, 0x1e);
regAccept
->
setT3512_Value
(
0x2
,
0
);
std
::
vector
<
p_tai_t
>
tai_list
;
p_tai_t
item0
;
...
...
@@ -2845,8 +2905,22 @@ void amf_n1::run_mobility_registration_update_procedure(
std
::
vector
<
struct
SNSSAI_s
>
nssai
;
SNSSAI_t
snssai
;
snssai
.
sst
=
0
;
snssai
.
sd
=
-
1
;
uint32_t
sst
=
1
;
int32_t
sd
=
-
1
;
std
::
istringstream
sst_istr
(
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sST
);
sst_istr
>>
sst
;
std
::
istringstream
sd_istr
(
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sD
);
sd_istr
>>
sd
;
if
(
sst
==
0
)
sst
=
1
;
if
(
sd
==
0
)
sd
=
-
1
;
snssai
.
sst
=
sst
;
snssai
.
sd
=
sd
;
snssai
.
mHplmnSst
=
-
1
;
snssai
.
mHplmnSd
=
-
1
;
nssai
.
push_back
(
snssai
);
...
...
@@ -2859,6 +2933,8 @@ void amf_n1::run_mobility_registration_update_procedure(
Logger
::
amf_n1
().
debug
(
"Allocated GUTI %s"
,
guti
.
c_str
());
regAccept
->
set_5GS_Network_Feature_Support
(
0x00
,
0x00
);
// regAccept->set_5GS_Network_Feature_Support(0x01, 0x00);
uint8_t
buffer
[
1024
]
=
{
0
};
int
encoded_size
=
regAccept
->
encode2buffer
(
buffer
,
1024
);
print_buffer
(
"amf_n1"
,
"Registration-Accept Message Buffer"
,
buffer
,
...
...
@@ -2921,7 +2997,8 @@ void amf_n1::run_periodic_registration_update_procedure(
regAccept
->
set5G_GUTI
(
amf_cfg
.
guami
.
mcc
,
amf_cfg
.
guami
.
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
0x264a34c0
);
regAccept
->
setT3512_Value
(
0x5
,
0x1e
);
// regAccept->setT3512_Value(0x5, 0x1e);
regAccept
->
setT3512_Value
(
0x2
,
0
);
std
::
vector
<
p_tai_t
>
tai_list
;
p_tai_t
item0
;
...
...
@@ -2952,7 +3029,8 @@ void amf_n1::run_periodic_registration_update_procedure(
// serApt->setPDU_session_status(0x2000);
}
regAccept
->
set_5GS_Network_Feature_Support
(
0x01
,
0x00
);
regAccept
->
set_5GS_Network_Feature_Support
(
0x00
,
0x00
);
// regAccept->set_5GS_Network_Feature_Support(0x01, 0x00);
uint8_t
buffer
[
1024
]
=
{
0
};
int
encoded_size
=
regAccept
->
encode2buffer
(
buffer
,
1024
);
print_buffer
(
"amf_n1"
,
"Registration-Accept Message Buffer"
,
buffer
,
...
...
@@ -3008,7 +3086,8 @@ void amf_n1::run_periodic_registration_update_procedure(
regAccept
->
set5G_GUTI
(
amf_cfg
.
guami
.
mcc
,
amf_cfg
.
guami
.
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
0x264a34c0
);
regAccept
->
setT3512_Value
(
0x5
,
0x1e
);
// regAccept->setT3512_Value(0x5, 0x1e);
regAccept
->
setT3512_Value
(
0x2
,
0
);
std
::
vector
<
p_tai_t
>
tai_list
;
p_tai_t
item0
;
...
...
@@ -3042,7 +3121,8 @@ void amf_n1::run_periodic_registration_update_procedure(
}
delete
regReq
;
regAccept
->
set_5GS_Network_Feature_Support
(
0x01
,
0x00
);
regAccept
->
set_5GS_Network_Feature_Support
(
0x00
,
0x00
);
// regAccept->set_5GS_Network_Feature_Support(0x01, 0x00);
uint8_t
buffer
[
1024
]
=
{
0
};
int
encoded_size
=
regAccept
->
encode2buffer
(
buffer
,
1024
);
print_buffer
(
"amf_n1"
,
"Registration-Accept Message Buffer"
,
buffer
,
...
...
src/amf-app/amf_n2.cpp
View file @
27b6e5bf
...
...
@@ -653,13 +653,14 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
msg
->
setGuami
(
guami
);
std
::
vector
<
S_Nssai
>
list
;
S_Nssai
item
;
item
.
sst
=
"01"
;
item
.
sd
=
"None"
;
// item.sst = "01";
// item.sd = "None";
item
.
sst
=
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sST
;
item
.
sd
=
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sD
;
list
.
push_back
(
item
);
msg
->
setAllowedNssai
(
list
);
msg
->
setUESecurityCapability
(
0xe000
,
0xe000
,
0xe000
,
0xe000
);
// TODO: remove hardcoded value
// msg->setUESecurityCapability(0xe000, 0xe000, 0xe000,0xe000); // TODO: remove hardcoded value
msg
->
setUESecurityCapability
(
0xe000
,
0xe000
,
0x0000
,
0x0000
);
msg
->
setSecurityKey
((
uint8_t
*
)
bdata
(
itti_msg
.
kgnb
));
msg
->
setNasPdu
((
uint8_t
*
)
bdata
(
itti_msg
.
nas
),
blength
(
itti_msg
.
nas
));
...
...
@@ -684,8 +685,10 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
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 = "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;
...
...
@@ -745,8 +748,10 @@ void amf_n2::handle_itti_message(
nas_pdu
[
blength
(
itti_msg
.
nas
)]
=
'\0'
;
item
.
pduSessionNAS_PDU
=
nas_pdu
;
item
.
sizeofpduSessionNAS_PDU
=
blength
(
itti_msg
.
nas
);
item
.
s_nssai
.
sst
=
"01"
;
// TODO: get from N1N2msgTranferMsg
item
.
s_nssai
.
sd
=
"none"
;
// TODO: get from N1N2msgTranferMsg
// item.s_nssai.sst = "01"; // TODO: get from N1N2msgTranferMsg
// item.s_nssai.sd = "none"; // TODO: get from N1N2msgTranferMsg
item
.
s_nssai
.
sst
=
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sST
;
// TODO: get from N1N2msgTranferMsg
item
.
s_nssai
.
sd
=
amf_cfg
.
plmn_list
[
0
].
slice_list
[
0
].
sD
;
// TODO: get from N1N2msgTranferMsg
// Get NSSAI from PDU Session Context
std
::
shared_ptr
<
nas_context
>
nc
;
...
...
@@ -1075,8 +1080,10 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
std
::
vector
<
PDUSessionResourceSetupRequestItem_t
>
list
;
PDUSessionResourceSetupRequestItem_t
item
;
item
.
pduSessionId
=
psc
.
get
()
->
pdu_session_id
;
item
.
s_nssai
.
sst
=
"01"
;
item
.
s_nssai
.
sd
=
""
;
// item.s_nssai.sst = "01";
// item.s_nssai.sd = "";
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
;
bstring
n2sm
=
psc
.
get
()
->
n2sm
;
if
(
blength
(
psc
.
get
()
->
n2sm
)
!=
0
)
{
...
...
src/nas/ies/UENetworkCapability.cpp
View file @
27b6e5bf
...
...
@@ -113,6 +113,10 @@ int UENetworkCapability::decodefrombuffer(
decoded_size
++
;
_5g_EIASel
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
if
(
length
>
(
decoded_size
-
2
))
decoded_size
=
length
+
2
;
Logger
::
nas_mm
().
debug
(
"decoded UENetworkCapability EA(0x%d),IA(0x%d)"
,
_5g_EEASel
,
_5g_EIASel
);
Logger
::
nas_mm
().
debug
(
"decoded UENetworkCapability len(%d)"
,
decoded_size
);
...
...
src/ngap/libngap/per_encoder.c
View file @
27b6e5bf
...
...
@@ -165,7 +165,13 @@ asn_enc_rval_t aper_encode_to_buffer(
if
(
td
)
ASN_DEBUG
(
"Encoding
\"
%s
\"
using ALIGNED PER"
,
td
->
name
);
return
aper_encode
(
td
,
constraints
,
sptr
,
encode_to_buffer_cb
,
&
key
);
asn_enc_rval_t
er
;
er
=
aper_encode
(
td
,
constraints
,
sptr
,
encode_to_buffer_cb
,
&
key
);
if
(
er
.
encoded
>
0
)
er
.
encoded
=
(
er
.
encoded
+
7
)
>>
3
;
return
er
;
}
ssize_t
aper_encode_to_new_buffer
(
...
...
src/sctp/sctp_server.hpp
View file @
27b6e5bf
...
...
@@ -39,7 +39,7 @@ extern "C" {
#include <vector>
#include <iostream>
#define SCTP_RECV_BUFFER_SIZE
2048
#define SCTP_RECV_BUFFER_SIZE
4096
#define SCTP_RC_ERROR -1
#define SCTP_RC_NORMAL_READ 0
#define SCTP_RC_DISCONNECT 1
...
...
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