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
wangjie
OpenXG-RAN
Commits
7d84db10
Commit
7d84db10
authored
Jul 07, 2021
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix gcc v9 new warnings (address-of-packed-member) and go on with cpu measurement enhancement
parent
daebec00
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
150 additions
and
92 deletions
+150
-92
common/utils/telnetsrv/telnetsrv.c
common/utils/telnetsrv/telnetsrv.c
+4
-3
openair1/PHY/TOOLS/time_meas.c
openair1/PHY/TOOLS/time_meas.c
+4
-2
openair1/PHY/TOOLS/time_meas.h
openair1/PHY/TOOLS/time_meas.h
+26
-16
openair2/COMMON/rrc_messages_types.h
openair2/COMMON/rrc_messages_types.h
+1
-1
openair2/LAYER2/PDCP_v10.1.0/pdcp.h
openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+1
-1
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+21
-5
openair2/RRC/LTE/rrc_UE.c
openair2/RRC/LTE/rrc_UE.c
+8
-1
openair2/RRC/LTE/rrc_defs.h
openair2/RRC/LTE/rrc_defs.h
+1
-1
openair3/NAS/COMMON/API/NETWORK/as_message.c
openair3/NAS/COMMON/API/NETWORK/as_message.c
+40
-26
openair3/NAS/UE/EMM/SAP/emm_as.c
openair3/NAS/UE/EMM/SAP/emm_as.c
+31
-23
openair3/NAS/UE/nas_network.c
openair3/NAS/UE/nas_network.c
+13
-13
No files found.
common/utils/telnetsrv/telnetsrv.c
View file @
7d84db10
...
...
@@ -681,9 +681,6 @@ void run_telnetclt(void) {
struct
sockaddr_in
name
;
pthread_setname_np
(
pthread_self
(),
"telnetclt"
);
set_sched
(
pthread_self
(),
0
,
telnetparams
.
priority
);
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sock
<
0
)
fprintf
(
stderr
,
"[TELNETSRV] Error %s on socket call
\n
"
,
strerror
(
errno
));
char
prompt
[
sizeof
(
TELNET_PROMPT_PREFIX
)
+
10
];
sprintf
(
prompt
,
"%s_%s> "
,
TELNET_PROMPT_PREFIX
,
get_softmodem_function
(
NULL
));
name
.
sin_family
=
AF_INET
;
...
...
@@ -691,6 +688,10 @@ void run_telnetclt(void) {
inet_aton
(
"127.0.0.1"
,
&
addr
)
;
name
.
sin_addr
.
s_addr
=
addr
.
s_addr
;
name
.
sin_port
=
htons
((
unsigned
short
)(
telnetparams
.
listenport
));
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sock
<
0
)
fprintf
(
stderr
,
"[TELNETSRV] Error %s on socket call
\n
"
,
strerror
(
errno
));
if
(
connect
(
sock
,
(
void
*
)
&
name
,
sizeof
(
name
)))
fprintf
(
stderr
,
"[TELNETSRV] Error %s on connect call
\n
"
,
strerror
(
errno
));
...
...
openair1/PHY/TOOLS/time_meas.c
View file @
7d84db10
...
...
@@ -147,7 +147,7 @@ double get_time_meas_us(time_stats_t *ts)
#ifndef PHYSIM
int
register_meas
(
char
*
name
,
time_stats_t
*
dst_ts
)
time_stats_t
*
register_meas
(
char
*
name
,
time_stats_t
*
dst_ts
)
{
for
(
int
i
=
0
;
i
<
max_cpumeasur
;
i
++
)
{
if
(
measur_table
[
i
]
==
NULL
)
{
...
...
@@ -155,7 +155,9 @@ int register_meas(char *name, time_stats_t *dst_ts)
memset
(
measur_table
[
i
]
,
0
,
sizeof
(
time_stats_t
));
measur_table
[
i
]
->
meas_name
=
strdup
(
name
);
measur_table
[
i
]
->
meas_index
=
i
;
return
i
;
measur_table
[
i
]
->
tpoolmsg
=
newNotifiedFIFO_elt
(
sizeof
(
time_stats_msg_t
),
0
,
NULL
,
NULL
);
measur_table
[
i
]
->
tstatptr
=
(
time_stats_msg_t
*
)
NotifiedFifoData
(
msg
);
return
measur_table
[
i
];
}
}
return
-
1
;
...
...
openair1/PHY/TOOLS/time_meas.h
View file @
7d84db10
...
...
@@ -45,8 +45,20 @@ extern double cpu_freq_GHz __attribute__ ((aligned(32)));;
#else
#error "building on unsupported CPU architecture"
#endif
#define TIMESTAT_MSGID_START 0
#define TIMESTAT_MSGID_STOP 1
#define TIMESTAT_MSGID_DISPLAY 2
typedef
struct
{
int
msgid
;
/*!< \brief message id, as defined by TIMESTAT_MSGID_X macros */
int
timestat_id
;
/*!< \brief points to the time_stats_t entry in cpumeas table */
OAI_CPUTIME_TYPE
ts
;
/*!< \brief time stamp */
void
(
*
displayFunc
)(
void
*
);
/*!< \brief function to call when DISPLAY message is received*/
}
time_stats_msg_t
;
typedef
struct
{
OAI_CPUTIME_TYPE
in
;
/*!< \brief time at measue starting point */
OAI_CPUTIME_TYPE
in
;
/*!< \brief time at measu
r
e starting point */
OAI_CPUTIME_TYPE
diff
;
/*!< \brief average difference between time at starting point and time at endpoint*/
OAI_CPUTIME_TYPE
p_time
;
/*!< \brief absolute process duration */
OAI_CPUTIME_TYPE
diff_square
;
/*!< \brief process duration square */
...
...
@@ -55,17 +67,13 @@ typedef struct {
int
meas_flag
;
/*!< \brief 1: stop_meas not called (consecutive calls of start_meas) */
char
*
meas_name
;
/*!< \brief name to use when printing the measure (not used for PHY simulators)*/
int
meas_index
;
/*!< \brief index of this measure in the measure array (not used for PHY simulators)*/
bool
meas_enabled
;
/*!< \brief per measure enablement flag. send_meas tests this flag, unused today in start_meas and stop_meas*/
notifiedFIFO_elt_t
*
tpoolmsg
;
/*!< \brief message pushed to the cpu measurment queue to report a measure START or STOP */
time_stats_msg_t
*
tstatptr
;
/*!< \brief pointer to the time_stats_msg_t data in the tpoolmsg, stored here for perf considerations*/
}
time_stats_t
;
#define MEASURE_ENABLED(X) (X->meas_enabled)
#define TIMESTAT_MSGID_START 0
#define TIMESTAT_MSGID_STOP 1
#define TIMESTAT_MSGID_DISPLAY 2
typedef
struct
{
int
msgid
;
/*!< \brief message id, as defined by TIMESTAT_MSGID_X macros */
int
timestat_id
;
/*!< \brief points to the time_stats_t entry in cpumeas table */
OAI_CPUTIME_TYPE
ts
;
/*!< \brief time stamp */
void
(
*
displayFunc
)(
void
*
);
/*!< \brief function to call when DISPLAY message is received*/
}
time_stats_msg_t
;
static
inline
void
start_meas
(
time_stats_t
*
ts
)
__attribute__
((
always_inline
));
...
...
@@ -161,12 +169,14 @@ extern notifiedFIFO_t measur_fifo;
void
init_meas
(
void
);
int
register_meas
(
char
*
name
,
time_stats_t
*
ts
);
static
inline
void
send_meas
(
int
measur_idx
)
{
if
(
opp_enabled
)
{
notifiedFIFO_elt_t
*
msg
=
newNotifiedFIFO_elt
(
sizeof
(
time_stats_msg_t
),
0
,
NULL
,
NULL
);
time_stats_msg_t
*
tsm
=
(
time_stats_msg_t
*
)
NotifiedFifoData
(
msg
);
tsm
->
ts
=
rdtsc_oai
();
pushNotifiedFIFO
(
&
measur_fifo
,
msg
);
#define START_MEAS(X) send_meas(X, TIMESTAT_MSGID_START)
#define STOP_MEAS(X) send_meas(X, TIMESTAT_MSGID_STOP)
static
inline
void
send_meas
(
time_stats_t
*
ts
,
int
msgid
)
{
if
(
opp_enabled
&&
MEASURE_ENABLED
(
ts
)
)
{
ts
->
tstatptr
->
timestat_id
=
ts
->
meas_index
;
ts
->
tstatptr
->
msgid
=
msgid
;
ts
->
tstatptr
->
ts
=
rdtsc_oai
();
pushNotifiedFIFO
(
&
measur_fifo
,
ts
->
tpoolmsg
);
}
}
#endif //ifndef PHYSIM
...
...
openair2/COMMON/rrc_messages_types.h
View file @
7d84db10
...
...
@@ -418,7 +418,7 @@ typedef struct NRRrcConfigurationReq_s {
// UE: NAS -> RRC messages
typedef
kenb_refresh_req_t
NasKenbRefreshReq
;
typedef
cell_info_req_t
NasCellSelectionReq
;
typedef
cell_info_req_t
NasCellSelectionReq
__attribute__
((
aligned
(
__alignof__
(
char
))
))
;
typedef
nas_establish_req_t
NasConnEstabliReq
;
typedef
ul_info_transfer_req_t
NasUlDataReq
;
...
...
openair2/LAYER2/PDCP_v10.1.0/pdcp.h
View file @
7d84db10
...
...
@@ -483,7 +483,7 @@ typedef struct {
uint8_t
status
;
PC5SignallingMessage
pc5_signalling_message
;
}
pc5sPrimitive
;
}
__attribute__
((
__packed__
))
sidelink_pc5s_element
;
}
__attribute__
((
__packed__
,
aligned
(
__alignof__
(
char
))
))
sidelink_pc5s_element
;
/*
...
...
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
View file @
7d84db10
...
...
@@ -603,7 +603,7 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
//int optval;
int
bytes_received
;
sidelink_pc5s_element
*
sl_pc5s_msg_send
=
NULL
;
pc5s_header_t
*
pc5s_header
=
NULL
;
pc5s_header_t
*
pc5s_header
=
NULL
;
rb_id_t
rab_id
=
0
;
//TTN for D2D (PC5S)
// receive a message from ProSe App
...
...
@@ -704,6 +704,12 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
pc5s_header
->
rb_id
,
rab_id
,
pc5s_header
->
data_size
);
/* pointers to pc5s_header fields possibly not aligned because pc5s_header points to a packed structure
* Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and
* gcc, from v9, now warns about it. fix these warnings by using local variables
*/
uint32_t
sourceL2Id
=
pc5s_header
->
sourceL2Id
;
uint32_t
destinationL2Id
=
pc5s_header
->
destinationL2Id
;
pdcp_data_req
(
&
ctxt
,
SRB_FLAG_NO
,
...
...
@@ -713,9 +719,11 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
pc5s_header
->
data_size
,
(
unsigned
char
*
)
receive_buf
,
PDCP_TRANSMISSION_MODE_DATA
,
&
pc5s_header
->
sourceL2Id
,
&
pc5s_header
->
destinationL2Id
&
sourceL2Id
,
&
destinationL2Id
);
pc5s_header
->
sourceL2Id
=
sourceL2Id
;
pc5s_header
->
destinationL2Id
=
destinationL2Id
;
}
else
{
/* else of h_rc == HASH_TABLE_OK */
MSC_LOG_RX_DISCARDED_MESSAGE
(
(
ctxt_pP
->
enb_flag
==
ENB_FLAG_YES
)
?
MSC_PDCP_ENB
:
MSC_PDCP_UE
,
...
...
@@ -759,6 +767,12 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
pc5s_header
->
rb_id
,
DEFAULT_RAB_ID
,
pc5s_header
->
data_size
);
/* pointers to pc5s_header fields possibly not aligned because pc5s_header points to a packed structure
* Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and
* gcc, from v9, now warns about it. fix these warnings by using local variables
*/
uint32_t
sourceL2Id
=
pc5s_header
->
sourceL2Id
;
uint32_t
destinationL2Id
=
pc5s_header
->
destinationL2Id
;
pdcp_data_req
(
&
ctxt
,
SRB_FLAG_NO
,
...
...
@@ -768,9 +782,11 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
pc5s_header
->
data_size
,
(
unsigned
char
*
)
receive_buf
,
PDCP_TRANSMISSION_MODE_DATA
,
&
pc5s_header
->
sourceL2Id
,
&
pc5s_header
->
destinationL2Id
&
sourceL2Id
,
&
destinationL2Id
);
pc5s_header
->
sourceL2Id
=
sourceL2Id
;
pc5s_header
->
destinationL2Id
=
destinationL2Id
;
}
}
/* end of !ctxt.enb_flag */
...
...
openair2/RRC/LTE/rrc_UE.c
View file @
7d84db10
...
...
@@ -2969,6 +2969,12 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
UE_rrc_inst
[
ctxt_pP
->
module_id
].
Info
[
eNB_index
].
SIwindowsize
=
siWindowLength_int
[
sib1
->
si_WindowLength
];
LOG_I
(
RRC
,
"[FRAME unknown][RRC_UE][MOD %02"
PRIu8
"][][--- MAC_CONFIG_REQ (SIB1 params eNB %"
PRIu8
") --->][MAC_UE][MOD %02"
PRIu8
"][]
\n
"
,
ctxt_pP
->
module_id
,
eNB_index
,
ctxt_pP
->
module_id
);
/* pointers to SIperiod inthe Info struct points to a packed structure
* Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and
* gcc, from v9, now warns about it. fix these warnings by removing the indirection on data
* Not sure if SiPeriod can be modified, reassign after function call for security
*/
uint16_t
Aligned_SIperiod
=
UE_rrc_inst
[
ctxt_pP
->
module_id
].
Info
[
eNB_index
].
SIperiod
;
rrc_mac_config_req_ue
(
ctxt_pP
->
module_id
,
0
,
eNB_index
,
(
LTE_RadioResourceConfigCommonSIB_t
*
)
NULL
,
(
struct
LTE_PhysicalConfigDedicated
*
)
NULL
,
...
...
@@ -2981,7 +2987,7 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
UE_rrc_inst
[
ctxt_pP
->
module_id
].
sib1
[
eNB_index
]
->
tdd_Config
,
(
LTE_MobilityControlInfo_t
*
)
NULL
,
&
UE_rrc_inst
[
ctxt_pP
->
module_id
].
Info
[
eNB_index
].
SIwindowsize
,
&
UE_rrc_inst
[
ctxt_pP
->
module_id
].
Info
[
eNB_index
].
SIperiod
,
&
Aligned_SIperiod
,
NULL
,
NULL
,
NULL
,
...
...
@@ -2995,6 +3001,7 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
(
struct
LTE_NonMBSFN_SubframeConfig_r14
*
)
NULL
,
(
LTE_MBSFN_AreaInfoList_r9_t
*
)
NULL
);
UE_rrc_inst
[
ctxt_pP
->
module_id
].
Info
[
eNB_index
].
SIperiod
=
Aligned_SIperiod
;
LOG_I
(
RRC
,
"Setting SIStatus bit 0 to 1
\n
"
);
UE_rrc_inst
[
ctxt_pP
->
module_id
].
Info
[
eNB_index
].
SIStatus
=
1
;
UE_rrc_inst
[
ctxt_pP
->
module_id
].
Info
[
eNB_index
].
SIB1systemInfoValueTag
=
sib1
->
systemInfoValueTag
;
...
...
openair2/RRC/LTE/rrc_defs.h
View file @
7d84db10
...
...
@@ -376,7 +376,7 @@ typedef struct UE_RRC_INFO_s {
uint32_t
N310_cnt
;
uint32_t
N311_cnt
;
rnti_t
rnti
;
}
__attribute__
((
__packed__
))
__attribute__
((
aligned
(
1
)))
UE_RRC_INFO
;
}
__attribute__
((
__packed__
))
UE_RRC_INFO
;
typedef
struct
UE_S_TMSI_s
{
boolean_t
presence
;
...
...
openair3/NAS/COMMON/API/NETWORK/as_message.c
View file @
7d84db10
...
...
@@ -81,7 +81,12 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length)
LOG_FUNC_IN
;
int
bytes
;
Byte_t
**
data
=
NULL
;
/* pointers to msg fields possibly not aligned because msg points to a packed structure
* Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and
* gcc, from v9, now warns about it. fix these warnings by removing the indirection on data
* (in fact i don't understand this code data seems to be useless...)
*/
Byte_t
*
data
=
NULL
;
/* Get the message type */
msg
->
msgID
=
*
(
uint16_t
*
)(
buffer
);
...
...
@@ -91,49 +96,49 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length)
case
AS_NAS_ESTABLISH_REQ
:
/* NAS signalling connection establish request */
bytes
+=
sizeof
(
nas_establish_req_t
)
-
sizeof
(
Byte_t
*
);
data
=
&
msg
->
msg
.
nas_establish_req
.
initialNasMsg
.
data
;
data
=
msg
->
msg
.
nas_establish_req
.
initialNasMsg
.
data
;
break
;
case
AS_NAS_ESTABLISH_IND
:
/* NAS signalling connection establishment indication */
bytes
+=
sizeof
(
nas_establish_ind_t
)
-
sizeof
(
Byte_t
*
);
data
=
&
msg
->
msg
.
nas_establish_ind
.
initialNasMsg
.
data
;
data
=
msg
->
msg
.
nas_establish_ind
.
initialNasMsg
.
data
;
break
;
case
AS_NAS_ESTABLISH_RSP
:
/* NAS signalling connection establishment response */
bytes
+=
sizeof
(
nas_establish_rsp_t
)
-
sizeof
(
Byte_t
*
);
data
=
&
msg
->
msg
.
nas_establish_rsp
.
nasMsg
.
data
;
data
=
msg
->
msg
.
nas_establish_rsp
.
nasMsg
.
data
;
break
;
case
AS_NAS_ESTABLISH_CNF
:
/* NAS signalling connection establishment confirm */
bytes
+=
sizeof
(
nas_establish_cnf_t
)
-
sizeof
(
Byte_t
*
);
data
=
&
msg
->
msg
.
nas_establish_cnf
.
nasMsg
.
data
;
data
=
msg
->
msg
.
nas_establish_cnf
.
nasMsg
.
data
;
break
;
case
AS_UL_INFO_TRANSFER_REQ
:
/* Uplink L3 data transfer request */
bytes
+=
sizeof
(
ul_info_transfer_req_t
)
-
sizeof
(
Byte_t
*
);
data
=
&
msg
->
msg
.
ul_info_transfer_req
.
nasMsg
.
data
;
data
=
msg
->
msg
.
ul_info_transfer_req
.
nasMsg
.
data
;
break
;
case
AS_UL_INFO_TRANSFER_IND
:
/* Uplink L3 data transfer indication */
bytes
+=
sizeof
(
ul_info_transfer_ind_t
)
-
sizeof
(
Byte_t
*
);
data
=
&
msg
->
msg
.
ul_info_transfer_ind
.
nasMsg
.
data
;
data
=
msg
->
msg
.
ul_info_transfer_ind
.
nasMsg
.
data
;
break
;
case
AS_DL_INFO_TRANSFER_REQ
:
/* Downlink L3 data transfer request */
bytes
+=
sizeof
(
dl_info_transfer_req_t
)
-
sizeof
(
Byte_t
*
);
data
=
&
msg
->
msg
.
dl_info_transfer_req
.
nasMsg
.
data
;
data
=
msg
->
msg
.
dl_info_transfer_req
.
nasMsg
.
data
;
break
;
case
AS_DL_INFO_TRANSFER_IND
:
/* Downlink L3 data transfer indication */
bytes
+=
sizeof
(
dl_info_transfer_ind_t
)
-
sizeof
(
Byte_t
*
);
data
=
&
msg
->
msg
.
dl_info_transfer_ind
.
nasMsg
.
data
;
data
=
msg
->
msg
.
dl_info_transfer_ind
.
nasMsg
.
data
;
break
;
case
AS_BROADCAST_INFO_IND
:
...
...
@@ -166,7 +171,8 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length)
if
(
bytes
>
0
)
{
if
(
data
)
{
/* Set the pointer to dedicated NAS information */
*
data
=
(
Byte_t
*
)(
buffer
+
bytes
);
/* wasn't data already computed above for specific cases here we override ?? */
data
=
(
Byte_t
*
)
buffer
+
bytes
;
}
/* Decode the message */
...
...
@@ -201,8 +207,10 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
LOG_FUNC_IN
;
int
bytes
=
sizeof
(
msg
->
msgID
);
as_nas_info_t
*
nas_msg
=
NULL
;
as_nas_info_t
nas_msg
;
Byte_t
*
dataptr
=
NULL
;
uint32_t
len
=
0
;
switch
(
msg
->
msgID
)
{
case
AS_BROADCAST_INFO_IND
:
/* Broadcast information */
...
...
@@ -237,25 +245,30 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
case
AS_NAS_ESTABLISH_REQ
:
/* NAS signalling connection establish request */
bytes
+=
sizeof
(
nas_establish_req_t
)
-
sizeof
(
Byte_t
*
);
nas_msg
=
&
msg
->
msg
.
nas_establish_req
.
initialNasMsg
;
nas_msg
=
msg
->
msg
.
nas_establish_req
.
initialNasMsg
;
break
;
case
AS_NAS_ESTABLISH_IND
:
/* NAS signalling connection establish indication */
bytes
+=
sizeof
(
nas_establish_ind_t
)
-
sizeof
(
Byte_t
*
);
nas_msg
=
&
msg
->
msg
.
nas_establish_ind
.
initialNasMsg
;
nas_msg
=
msg
->
msg
.
nas_establish_ind
.
initialNasMsg
;
dataptr
=
(
Byte_t
*
)
&
(
msg
->
msg
.
nas_establish_ind
.
initialNasMsg
.
data
);
len
=
msg
->
msg
.
nas_establish_ind
.
initialNasMsg
.
length
;
break
;
case
AS_NAS_ESTABLISH_RSP
:
/* NAS signalling connection establish response */
bytes
+=
sizeof
(
nas_establish_rsp_t
)
-
sizeof
(
Byte_t
*
);
nas_msg
=
&
msg
->
msg
.
nas_establish_rsp
.
nasMsg
;
nas_msg
=
msg
->
msg
.
nas_establish_rsp
.
nasMsg
;
break
;
case
AS_NAS_ESTABLISH_CNF
:
/* NAS signalling connection establish confirm */
bytes
+=
sizeof
(
nas_establish_cnf_t
)
-
sizeof
(
Byte_t
*
);
nas_msg
=
&
msg
->
msg
.
nas_establish_cnf
.
nasMsg
;
nas_msg
=
msg
->
msg
.
nas_establish_cnf
.
nasMsg
;
dataptr
=
(
Byte_t
*
)
&
(
msg
->
msg
.
nas_establish_cnf
.
nasMsg
.
data
);
len
=
msg
->
msg
.
nas_establish_ind
.
initialNasMsg
.
length
;
break
;
case
AS_NAS_RELEASE_REQ
:
...
...
@@ -271,7 +284,7 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
case
AS_UL_INFO_TRANSFER_REQ
:
/* Uplink L3 data transfer request */
bytes
+=
sizeof
(
ul_info_transfer_req_t
)
-
sizeof
(
Byte_t
*
);
nas_msg
=
&
msg
->
msg
.
ul_info_transfer_req
.
nasMsg
;
nas_msg
=
msg
->
msg
.
ul_info_transfer_req
.
nasMsg
;
break
;
case
AS_UL_INFO_TRANSFER_CNF
:
...
...
@@ -282,13 +295,13 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
case
AS_UL_INFO_TRANSFER_IND
:
/* Uplink L3 data transfer indication */
bytes
+=
sizeof
(
ul_info_transfer_ind_t
)
-
sizeof
(
Byte_t
*
);
nas_msg
=
&
msg
->
msg
.
ul_info_transfer_ind
.
nasMsg
;
nas_msg
=
msg
->
msg
.
ul_info_transfer_ind
.
nasMsg
;
break
;
case
AS_DL_INFO_TRANSFER_REQ
:
/* Downlink L3 data transfer */
bytes
+=
sizeof
(
dl_info_transfer_req_t
)
-
sizeof
(
Byte_t
*
);
nas_msg
=
&
msg
->
msg
.
dl_info_transfer_req
.
nasMsg
;
nas_msg
=
msg
->
msg
.
dl_info_transfer_req
.
nasMsg
;
break
;
case
AS_DL_INFO_TRANSFER_CNF
:
...
...
@@ -299,7 +312,8 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
case
AS_DL_INFO_TRANSFER_IND
:
/* Downlink L3 data transfer indication */
bytes
+=
sizeof
(
dl_info_transfer_ind_t
)
-
sizeof
(
Byte_t
*
);
nas_msg
=
&
msg
->
msg
.
dl_info_transfer_ind
.
nasMsg
;
nas_msg
=
msg
->
msg
.
dl_info_transfer_ind
.
nasMsg
;
break
;
case
AS_RAB_ESTABLISH_REQ
:
...
...
@@ -343,14 +357,14 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
/* Encode the AS message */
memcpy
(
buffer
,
(
unsigned
char
*
)
msg
,
bytes
);
if
(
nas_msg
&&
(
nas_msg
->
length
>
0
)
)
{
if
(
(
dataptr
!=
NULL
)
&&
(
len
>
0
)
)
{
/* Copy the NAS message */
memcpy
(
buffer
+
bytes
,
nas_msg
->
data
,
nas_msg
->
length
);
bytes
+=
nas_msg
->
length
;
memcpy
(
buffer
+
bytes
,
nas_msg
.
data
,
nas_msg
.
length
);
bytes
+=
len
;
/* Release NAS message memory */
free
(
nas_msg
->
data
);
nas_msg
->
length
=
0
;
nas_msg
->
data
=
NULL
;
free
(
nas_msg
.
data
);
len
=
0
;
dataptr
=
NULL
;
}
LOG_FUNC_RETURN
(
bytes
);
...
...
openair3/NAS/UE/EMM/SAP/emm_as.c
View file @
7d84db10
...
...
@@ -136,17 +136,25 @@ static int _emm_as_encrypt(
static
int
_emm_as_send
(
const
nas_user_t
*
user
,
const
emm_as_t
*
msg
);
static
int
_emm_as_security_res
(
const
emm_data_t
*
emm_data
,
const
emm_as_security_t
*
,
ul_info_transfer_req_t
*
);
static
int
_emm_as_establish_req
(
const
emm_data_t
*
emm_data
,
const
emm_as_establish_t
*
,
nas_establish_req_t
*
);
static
int
_emm_as_cell_info_req
(
const
emm_as_cell_info_t
*
,
cell_info_req_t
*
);
static
int
_emm_as_data_req
(
const
emm_data_t
*
emm_data
,
const
emm_as_data_t
*
msg
,
ul_info_transfer_req_t
*
);
static
int
_emm_as_status_ind
(
const
emm_data_t
*
emm_data
,
const
emm_as_status_t
*
,
ul_info_transfer_req_t
*
);
static
int
_emm_as_release_req
(
const
emm_as_release_t
*
,
nas_release_req_t
*
);
static
int
_emm_as_cell_info_req
(
const
emm_as_cell_info_t
*
,
cell_info_req_t
*
);
/* prototyping of the following function modified: the last parameter turned to a void pointer
* instead of a ponter to the union field of the as_msg packed structure. This is to avoid new warnings introduced
* from gcc V9 which warns when accessing fields in a packed structure which may result in an alignment problem
* at run time. Modifications allow gcc to know at compile time that it cannot assume any alignment for those pointers.
* On X86 this is not fatal, as at run time the problem can be fixed (but it's better for perf to avoid). On other
* processor as Arm i think it can end in seg fault
*/
static
int
_emm_as_security_res
(
const
emm_data_t
*
emm_data
,
const
emm_as_security_t
*
,
void
*
ul_info_transfer_req_unaligned
);
static
int
_emm_as_establish_req
(
const
emm_data_t
*
emm_data
,
const
emm_as_establish_t
*
,
void
*
nas_establish_req_unaligned
);
static
int
_emm_as_data_req
(
const
emm_data_t
*
emm_data
,
const
emm_as_data_t
*
msg
,
void
*
ul_info_transfer_req_unaligned
);
static
int
_emm_as_status_ind
(
const
emm_data_t
*
emm_data
,
const
emm_as_status_t
*
,
void
*
ul_info_transfer_req_unaligned
);
static
int
_emm_as_release_req
(
const
emm_as_release_t
*
,
void
*
nas_release_req_unaligned
);
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
...
...
@@ -938,32 +946,32 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg)
case
_EMMAS_DATA_REQ
:
as_msg
.
msgID
=
_emm_as_data_req
(
user
->
emm_data
,
&
msg
->
u
.
data
,
&
as_msg
.
msg
.
ul_info_transfer_req
);
(
void
*
)(
&
as_msg
.
msg
.
ul_info_transfer_req
)
);
break
;
case
_EMMAS_STATUS_IND
:
as_msg
.
msgID
=
_emm_as_status_ind
(
user
->
emm_data
,
&
msg
->
u
.
status
,
&
as_msg
.
msg
.
ul_info_transfer_req
);
(
void
*
)(
&
as_msg
.
msg
.
ul_info_transfer_req
)
);
break
;
case
_EMMAS_RELEASE_REQ
:
as_msg
.
msgID
=
_emm_as_release_req
(
&
msg
->
u
.
release
,
&
as_msg
.
msg
.
nas_release_req
);
(
void
*
)(
&
as_msg
.
msg
.
nas_release_req
)
);
break
;
case
_EMMAS_SECURITY_RES
:
as_msg
.
msgID
=
_emm_as_security_res
(
user
->
emm_data
,
&
msg
->
u
.
security
,
&
as_msg
.
msg
.
ul_info_transfer_req
);
(
void
*
)(
&
as_msg
.
msg
.
ul_info_transfer_req
)
);
break
;
case
_EMMAS_ESTABLISH_REQ
:
as_msg
.
msgID
=
_emm_as_establish_req
(
user
->
emm_data
,
&
msg
->
u
.
establish
,
&
as_msg
.
msg
.
nas_establish_req
);
(
void
*
)(
&
as_msg
.
msg
.
nas_establish_req
)
);
break
;
...
...
@@ -1069,10 +1077,10 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg)
** **
***************************************************************************/
static
int
_emm_as_data_req
(
const
emm_data_t
*
emm_data
,
const
emm_as_data_t
*
msg
,
ul_info_transfer_req_t
*
as_msg
)
void
*
ul_info_transfer_req_unaligned
)
{
LOG_FUNC_IN
;
ul_info_transfer_req_t
*
as_msg
=
(
ul_info_transfer_req_t
*
)
ul_info_transfer_req_unaligned
;
int
size
=
0
;
int
is_encoded
=
FALSE
;
...
...
@@ -1165,12 +1173,12 @@ static int _emm_as_data_req(const emm_data_t *emm_data, const emm_as_data_t *msg
** **
***************************************************************************/
static
int
_emm_as_status_ind
(
const
emm_data_t
*
emm_data
,
const
emm_as_status_t
*
msg
,
ul_info_transfer_req_t
*
as_msg
)
void
*
ul_info_transfer_req_unaligned
)
{
LOG_FUNC_IN
;
int
size
=
0
;
ul_info_transfer_req_t
*
as_msg
=
(
ul_info_transfer_req_t
*
)
ul_info_transfer_req_unaligned
;
LOG_TRACE
(
INFO
,
"EMMAS-SAP - Send AS status indication (cause=%d)"
,
msg
->
emm_cause
);
...
...
@@ -1239,12 +1247,12 @@ static int _emm_as_status_ind(const emm_data_t *emm_data, const emm_as_status_t
** **
***************************************************************************/
static
int
_emm_as_release_req
(
const
emm_as_release_t
*
msg
,
nas_release_req_t
*
as_msg
)
void
*
nas_release_req_unaligned
)
{
LOG_FUNC_IN
;
LOG_TRACE
(
INFO
,
"EMMAS-SAP - Send AS release request"
);
nas_release_req_t
*
as_msg
=
(
nas_release_req_t
*
)
nas_release_req_unaligned
;
/* Setup the AS message */
if
(
msg
->
guti
)
{
as_msg
->
s_tmsi
.
MMEcode
=
msg
->
guti
->
gummei
.
MMEcode
;
...
...
@@ -1279,10 +1287,10 @@ static int _emm_as_release_req(const emm_as_release_t *msg,
** **
***************************************************************************/
static
int
_emm_as_security_res
(
const
emm_data_t
*
emm_data
,
const
emm_as_security_t
*
msg
,
ul_info_transfer_req_t
*
as_msg
)
void
*
ul_info_transfer_req_unaligned
)
{
LOG_FUNC_IN
;
ul_info_transfer_req_t
*
as_msg
=
(
ul_info_transfer_req_t
*
)
ul_info_transfer_req_unaligned
;
int
size
=
0
;
LOG_TRACE
(
INFO
,
"EMMAS-SAP - Send AS security response"
);
...
...
@@ -1373,12 +1381,12 @@ static int _emm_as_security_res(const emm_data_t *emm_data, const emm_as_securit
** **
***************************************************************************/
static
int
_emm_as_establish_req
(
const
emm_data_t
*
emm_data
,
const
emm_as_establish_t
*
msg
,
nas_establish_req_t
*
as_msg
)
void
*
nas_establish_req_unaligned
)
{
LOG_FUNC_IN
;
int
size
=
0
;
nas_establish_req_t
*
as_msg
=
(
nas_establish_req_t
*
)
nas_establish_req_unaligned
;
LOG_TRACE
(
INFO
,
"EMMAS-SAP - Send AS connection establish request"
);
nas_message_t
nas_msg
;
...
...
openair3/NAS/UE/nas_network.c
View file @
7d84db10
...
...
@@ -141,11 +141,11 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data)
case
AS_CELL_INFO_CNF
:
{
/* Received cell information confirm */
const
cell_info_cnf_t
*
info
=
&
msg
->
msg
.
cell_info_cnf
;
int
cell_found
=
(
info
->
errCode
==
AS_SUCCESS
);
rc
=
nas_proc_cell_info
(
user
,
cell_found
,
info
->
tac
,
info
->
cellID
,
info
->
rat
,
info
->
rsrp
,
info
->
rsrq
);
/* remove using pointers to fiels of the packed structure msg as it
* triggers warnings with gcc version 9 */
const
cell_info_cnf_t
info
=
msg
->
msg
.
cell_info_cnf
;
int
cell_found
=
(
info
.
errCode
==
AS_SUCCESS
);
rc
=
nas_proc_cell_info
(
user
,
cell_found
,
info
.
tac
,
info
.
cellID
,
info
.
rat
,
info
.
rsrp
,
info
.
rsrq
);
break
;
}
...
...
@@ -157,12 +157,12 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data)
case
AS_NAS_ESTABLISH_CNF
:
{
/* Received NAS signalling connection establishment confirm */
const
nas_establish_cnf_t
*
confirm
=
&
msg
->
msg
.
nas_establish_cnf
;
const
nas_establish_cnf_t
confirm
=
msg
->
msg
.
nas_establish_cnf
;
if
(
(
confirm
->
errCode
==
AS_SUCCESS
)
||
(
confirm
->
errCode
==
AS_TERMINATED_NAS
)
)
{
rc
=
nas_proc_establish_cnf
(
user
,
confirm
->
nasMsg
.
data
,
confirm
->
nasMsg
.
length
);
if
(
(
confirm
.
errCode
==
AS_SUCCESS
)
||
(
confirm
.
errCode
==
AS_TERMINATED_NAS
)
)
{
rc
=
nas_proc_establish_cnf
(
user
,
confirm
.
nasMsg
.
data
,
confirm
.
nasMsg
.
length
);
}
else
{
LOG_TRACE
(
WARNING
,
"NET-MAIN - "
"Initial NAS message not delivered"
);
...
...
@@ -191,10 +191,10 @@ int nas_network_process_data(nas_user_t *user, int msg_id, const void *data)
break
;
case
AS_DL_INFO_TRANSFER_IND
:
{
const
dl_info_transfer_ind_t
*
info
=
&
msg
->
msg
.
dl_info_transfer_ind
;
const
dl_info_transfer_ind_t
info
=
msg
->
msg
.
dl_info_transfer_ind
;
/* Received downlink data transfer indication */
rc
=
nas_proc_dl_transfer_ind
(
user
,
info
->
nasMsg
.
data
,
info
->
nasMsg
.
length
);
rc
=
nas_proc_dl_transfer_ind
(
user
,
info
.
nasMsg
.
data
,
info
.
nasMsg
.
length
);
break
;
}
...
...
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