Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
ZhouShuya
OpenXG-RAN
Commits
78f6031f
Commit
78f6031f
authored
Nov 26, 2020
by
cucengineer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nas massage OK
updated security mode complete debug registration request
parent
1a38a436
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
168 additions
and
6 deletions
+168
-6
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+4
-3
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
+40
-0
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
+1
-0
openair3/NAS/NR_UE/nas_nrue_task.c
openair3/NAS/NR_UE/nas_nrue_task.c
+109
-3
openair3/NAS/NR_UE/nas_nrue_task.h
openair3/NAS/NR_UE/nas_nrue_task.h
+14
-0
No files found.
cmake_targets/CMakeLists.txt
View file @
78f6031f
...
...
@@ -2510,7 +2510,7 @@ if(NAS_UE)
endif
()
if
(
ITTI_SIM
)
#
if(ITTI_SIM)
set
(
libnas_ue_api_OBJS
${
NAS_SRC
}
UE/API/USER/at_command.c
${
NAS_SRC
}
UE/API/USER/at_error.c
...
...
@@ -2626,7 +2626,7 @@ if(ITTI_SIM)
include_directories
(
${
NAS_SRC
}
UE/EMM/SAP
)
include_directories
(
${
NAS_SRC
}
UE/ESM
)
include_directories
(
${
NAS_SRC
}
UE/ESM/SAP
)
endif
()
#
endif()
# nbiot
add_definitions
(
"-DNUMBER_OF_UE_MAX_NB_IoT=16"
)
...
...
@@ -3096,6 +3096,7 @@ add_executable(nr-uesoftmodem
${
OPENAIR2_DIR
}
/RRC/NAS/rb_config.c
${
OPENAIR1_DIR
}
/SIMULATION/ETH_TRANSPORT/netlink_init.c
${
OPENAIR3_DIR
}
/NAS/NR_UE/nas_nrue_task.c
${
OPENAIR3_DIR
}
/NAS/NR_UE/nr_nas_msg_sim.c
${
OPENAIR_DIR
}
/common/utils/utils.c
${
OPENAIR_DIR
}
/common/utils/system.c
${
OPENAIR_DIR
}
/common/utils/nr/nr_common.c
...
...
@@ -3110,7 +3111,7 @@ target_link_libraries (nr-uesoftmodem
-Wl,--start-group
RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB S1AP_LIB S1AP_ENB
NFAPI_USER_LIB S1AP_LIB S1AP_ENB
${
NAS_SIM_LIB
}
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
LFDS7
${
ATLAS_LIBRARIES
}
LIB_5GNAS_GNB
-Wl,--end-group z dl
)
...
...
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
View file @
78f6031f
...
...
@@ -41,6 +41,8 @@ static int decode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_
static
int
encode_guti_5gs_mobile_identity
(
Guti5GSMobileIdentity_t
*
guti
,
uint8_t
*
buffer
);
static
int
encode_suci_5gs_mobile_identity
(
Suci5GSMobileIdentity_t
*
suci
,
uint8_t
*
buffer
);
int
decode_5gs_mobile_identity
(
FGSMobileIdentity
*
fgsmobileidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
decoded_rc
=
TLV_DECODE_VALUE_DOESNT_MATCH
;
...
...
@@ -87,6 +89,11 @@ int encode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei
buffer
+
encoded
);
}
if
(
fgsmobileidentity
->
guti
.
typeofidentity
==
FGS_MOBILE_IDENTITY_SUCI
)
{
encoded_rc
=
encode_suci_5gs_mobile_identity
(
&
fgsmobileidentity
->
suci
,
buffer
+
encoded
);
}
if
(
encoded_rc
<
0
)
{
return
encoded_rc
;
}
...
...
@@ -173,3 +180,36 @@ static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_
return
encoded
;
}
static
int
encode_suci_5gs_mobile_identity
(
Suci5GSMobileIdentity_t
*
suci
,
uint8_t
*
buffer
)
{
uint32_t
encoded
=
0
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
supiformat
&
0x7
)
<<
4
)
|
(
suci
->
typeofidentity
&
0x7
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
mccdigit2
&
0xf
)
<<
4
)
|
(
suci
->
mccdigit1
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
mncdigit3
&
0xf
)
<<
4
)
|
(
suci
->
mccdigit3
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
mncdigit2
&
0xf
)
<<
4
)
|
(
suci
->
mncdigit1
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
routingindicatordigit2
&
0xf
)
<<
4
)
|
(
suci
->
routingindicatordigit1
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
routingindicatordigit4
&
0xf
)
<<
4
)
|
(
suci
->
routingindicatordigit3
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
(
suci
->
protectionschemeId
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
suci
->
homenetworkpki
;
encoded
++
;
IES_ENCODE_U32
(
buffer
,
encoded
,
suci
->
msin
);
return
encoded
;
}
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
View file @
78f6031f
...
...
@@ -64,6 +64,7 @@ typedef struct {
uint8_t
spare6
:
1
;
uint8_t
protectionschemeId
:
4
;
uint8_t
homenetworkpki
;
uint32_t
msin
;
}
Suci5GSMobileIdentity_t
;
typedef
struct
{
...
...
openair3/NAS/NR_UE/nas_nrue_task.c
View file @
78f6031f
...
...
@@ -91,10 +91,11 @@ void *nas_ue_task(void *args_p)
case
NAS_CELL_SELECTION_CNF
:
//CUC:NAS_CELL_SELECTION_CNF √
LOG_I
(
NAS
,
"[UE %d] Received %s: errCode %u, cellID %u, tac %u
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NAS_CELL_SELECTION_CNF
(
msg_p
).
errCode
,
NAS_CELL_SELECTION_CNF
(
msg_p
).
cellID
,
NAS_CELL_SELECTION_CNF
(
msg_p
).
tac
);
as_stmsi_t
s_tmsi
=
{
0
,
0
};
as_stmsi_t
s_tmsi
=
{
0
,
0
};
as_nas_info_t
nas_info
;
plmn_t
plmnID
=
{
0
,
0
,
0
,
0
};
Byte_t
data
=
0
;
nas_itti_nas_establish_req
(
0
,
AS_TYPE_ORIGINATING_SIGNAL
,
s_tmsi
,
plmnID
,
&
data
,
0
,
0
);
SUCIRegistrationRequest
(
&
nas_info
)
;
nas_itti_nas_establish_req
(
0
,
AS_TYPE_ORIGINATING_SIGNAL
,
s_tmsi
,
plmnID
,
nas_info
.
data
,
nas_info
.
length
,
0
);
break
;
case
NAS_CELL_SELECTION_IND
:
...
...
@@ -152,6 +153,74 @@ void *nas_ue_task(void *args_p)
return
NULL
;
}
void
SUCIRegistrationRequest
(
as_nas_info_t
*
initialNasMsg
)
{
int
size
=
sizeof
(
mm_msg_header_t
);
UENAS_msg
nas_msg
;
memset
(
&
nas_msg
,
0
,
sizeof
(
UENAS_msg
));
UENAS_msg
*
mm_msg
;
mm_msg
=
&
nas_msg
;
// set header
mm_msg
->
header
.
ex_protocol_discriminator
=
FGS_MOBILITY_MANAGEMENT_MESSAGE
;
mm_msg
->
header
.
security_header_type
=
PLAIN_5GS_MSG
;
mm_msg
->
header
.
message_type
=
REGISTRATION_REQUEST
;
// set registration request
mm_msg
->
registration_request
.
protocoldiscriminator
=
FGS_MOBILITY_MANAGEMENT_MESSAGE
;
size
+=
1
;
mm_msg
->
registration_request
.
securityheadertype
=
PLAIN_5GS_MSG
;
size
+=
1
;
mm_msg
->
registration_request
.
messagetype
=
REGISTRATION_REQUEST
;
size
+=
1
;
mm_msg
->
registration_request
.
fgsregistrationtype
=
INITIAL_REGISTRATION
;
mm_msg
->
registration_request
.
naskeysetidentifier
.
naskeysetidentifier
=
NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE
;
size
+=
1
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
supiformat
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
typeofidentity
=
FGS_MOBILE_IDENTITY_SUCI
;
//SGS mobile idengtity
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mccdigit2
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mccdigit1
=
2
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mncdigit3
=
15
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mccdigit3
=
8
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mncdigit2
=
3
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mncdigit1
=
9
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
routingindicatordigit2
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
routingindicatordigit1
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
routingindicatordigit4
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
routingindicatordigit3
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
protectionschemeId
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
homenetworkpki
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
msin
=
0x00004778
;
size
+=
14
;
mm_msg
->
registration_request
.
presencemask
|=
REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT
;
mm_msg
->
registration_request
.
fgmmcapability
.
iei
=
REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI
;
mm_msg
->
registration_request
.
fgmmcapability
.
length
=
1
;
mm_msg
->
registration_request
.
fgmmcapability
.
value
=
0x7
;
size
+=
3
;
mm_msg
->
registration_request
.
presencemask
|=
REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_PRESENT
;
mm_msg
->
registration_request
.
nruesecuritycapability
.
iei
=
REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_IEI
;
mm_msg
->
registration_request
.
nruesecuritycapability
.
length
=
8
;
mm_msg
->
registration_request
.
nruesecuritycapability
.
fg_EA
=
0x80
;
mm_msg
->
registration_request
.
nruesecuritycapability
.
fg_IA
=
0x20
;
mm_msg
->
registration_request
.
nruesecuritycapability
.
EEA
=
0
;
mm_msg
->
registration_request
.
nruesecuritycapability
.
EIA
=
0
;
size
+=
10
;
// encode the message
initialNasMsg
->
data
=
(
Byte_t
*
)
malloc
(
size
*
sizeof
(
Byte_t
));
initialNasMsg
->
length
=
encodeNasMsg
(
mm_msg
,
(
uint8_t
*
)(
initialNasMsg
->
data
),
size
);
}
void
nr_nas_proc_dl_transfer_ind
(
UENAS_msg
*
msg
,
Byte_t
*
data
,
uint32_t
len
)
{
//QUES: 解出的msg干什么
uint8_t
buffer
[
100
];
UENAS_msg
msg1
;
...
...
@@ -255,6 +324,18 @@ void tesths(void) //CUC:test
string2ByteArray
(
Registrationrequest
,
data3
);
nr_nas_proc_dl_transfer_ind
(
&
msg3
,
data3
,
len3
);
printf
(
"Registration request:
\n
"
);
as_nas_info_t
nas_info
;
SUCIRegistrationRequest
(
&
nas_info
);
printf
(
"encodeaaaencode:"
);
for
(
int
i
=
0
;
i
<
nas_info
.
length
;
i
++
)
{
printf
(
"%02x "
,
*
(
nas_info
.
data
+
i
));
}
printf
(
"encodeaaaencode
\n
"
);
//******************************
}
int
decodeNasMsg
(
UENAS_msg
*
msg
,
uint8_t
*
buffer
,
uint32_t
len
)
{
...
...
@@ -331,6 +412,10 @@ int encodeNasMsg(UENAS_msg *msg, uint8_t *buffer, uint32_t len) { //QUES:UENAS_m
encode_result
=
encode_registration_complete5g
(
&
msg
->
registration_complete
,
buffer
,
len
);
//TODO:encode_security_mode_complete5g
break
;
}
case
REGISTRATION_REQUEST
:
encode_result
=
encode_registration_request
(
&
msg
->
registration_request
,
buffer
,
len
);
break
;
}
LOG_FUNC_RETURN
(
header_result
+
encode_result
);
}
...
...
@@ -409,6 +494,20 @@ int encode_security_mode_complete5g(securityModeComplete_t *securitymodecomplete
{
int
encoded
=
0
;
if
(
securitymodecomplete
->
sgsmobileidentityimeisv
.
iei
>
0
)
{
*
buffer
=
securitymodecomplete
->
sgsmobileidentityimeisv
.
iei
;
encoded
++
;
}
*
(
buffer
+
encoded
)
=
0x00
|
securitymodecomplete
->
sgsmobileidentityimeisv
.
len
>>
4
;
encoded
++
;
*
(
buffer
+
encoded
)
=
securitymodecomplete
->
sgsmobileidentityimeisv
.
len
;
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
securitymodecomplete
->
sgsmobileidentityimeisv
.
digit1
&
0x0f
)
<<
4
)
|
((
securitymodecomplete
->
sgsmobileidentityimeisv
.
indic
&
0x01
)
<<
3
)
|
(
securitymodecomplete
->
sgsmobileidentityimeisv
.
mi
&
0x0f
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
securitymodecomplete
->
sgsmobileidentityimeisv
.
digit3
&
0x0f
)
<<
4
)
|
(
securitymodecomplete
->
sgsmobileidentityimeisv
.
digit2
&
0x0f
);
encoded
++
;
return
encoded
;
}
...
...
@@ -435,6 +534,13 @@ int securityModeComplete5g(securityModeComplete_t *msg) {
msg
->
epd
=
SGSmobilitymanagementmessages
;
msg
->
sh
=
0
;
msg
->
mt
=
Securitymodecomplete
;
msg
->
sgsmobileidentityimeisv
.
iei
=
0x77
;
msg
->
sgsmobileidentityimeisv
.
len
=
2
;
msg
->
sgsmobileidentityimeisv
.
indic
=
0
;
msg
->
sgsmobileidentityimeisv
.
mi
=
IMEISV
;
msg
->
sgsmobileidentityimeisv
.
digit1
=
1
;
msg
->
sgsmobileidentityimeisv
.
digit2
=
1
;
msg
->
sgsmobileidentityimeisv
.
digit3
=
1
;
return
sizeof
(
securityModeComplete_t
);
}
...
...
openair3/NAS/NR_UE/nas_nrue_task.h
View file @
78f6031f
...
...
@@ -36,10 +36,22 @@
# define REGISTRATION_ACCEPT 0b01000010
# define REGISTRATION_COMPLETE 0b01000011
typedef
struct
__attribute__
((
packed
))
{
unsigned
int
iei
:
8
;
unsigned
int
len
:
16
;
identitytype_t
mi
:
3
;
unsigned
int
indic
:
1
;
unsigned
int
digit1
:
4
;
unsigned
int
digit2
:
4
;
unsigned
int
digit3
:
4
;
}
SGSmobileidentityIMEISV_t
;
typedef
struct
__attribute__
((
packed
))
{
Extendedprotocoldiscriminator_t
epd
:
8
;
Security_header_t
sh
:
8
;
SGSmobilitymanagementmessages_t
mt
:
8
;
/* Optional fields */
SGSmobileidentityIMEISV_t
sgsmobileidentityimeisv
;
}
securityModeComplete_t
;
typedef
struct
__attribute__
((
packed
))
{
...
...
@@ -71,6 +83,7 @@ typedef union {
securityModeComplete_t
securitymode_complete
;
registrationaccept_t
registration_accept
;
registrationcomplete_t
registration_complete
;
registration_request_msg
registration_request
;
}
UENAS_msg
;
void
*
nas_nrue_task
(
void
*
args_p
);
...
...
@@ -83,6 +96,7 @@ int encode_registration_complete5g(registrationcomplete_t *registrationcomplete,
int
authenticationResponse5g
(
authenticationresponse_t
*
msg
);
int
securityModeComplete5g
(
securityModeComplete_t
*
msg
);
int
registrationComplete5g
(
registrationcomplete_t
*
msg
);
void
SUCIRegistrationRequest
(
as_nas_info_t
*
initialNasMsg
);
int
string2ByteArray
(
char
*
input
,
uint8_t
*
output
);
//CUC:test
void
tesths
(
void
);
...
...
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