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
lizhongxiao
OpenXG-RAN
Commits
a853a087
Commit
a853a087
authored
Mar 13, 2023
by
laurent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
free memory to reduce the memory leaks
parent
36783a3a
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
54 additions
and
39 deletions
+54
-39
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+1
-1
openair2/COMMON/ngap_messages_types.h
openair2/COMMON/ngap_messages_types.h
+6
-3
openair2/COMMON/sctp_messages_types.h
openair2/COMMON/sctp_messages_types.h
+1
-1
openair2/E1AP/e1ap_common.c
openair2/E1AP/e1ap_common.c
+1
-0
openair2/F1AP/f1ap_itti_messaging.c
openair2/F1AP/f1ap_itti_messaging.c
+1
-0
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+7
-1
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+23
-29
openair2/RRC/NR/MESSAGES/asn1_msg.h
openair2/RRC/NR/MESSAGES/asn1_msg.h
+1
-1
openair2/RRC/NR/rrc_gNB.c
openair2/RRC/NR/rrc_gNB.c
+1
-1
openair2/RRC/NR/rrc_gNB_NGAP.c
openair2/RRC/NR/rrc_gNB_NGAP.c
+7
-0
openair2/X2AP/x2ap_eNB_itti_messaging.c
openair2/X2AP/x2ap_eNB_itti_messaging.c
+1
-0
openair3/NGAP/ngap_gNB_context_management_procedures.c
openair3/NGAP/ngap_gNB_context_management_procedures.c
+1
-1
openair3/NGAP/ngap_gNB_itti_messaging.c
openair3/NGAP/ngap_gNB_itti_messaging.c
+1
-0
openair3/SCTP/sctp_eNB_task.c
openair3/SCTP/sctp_eNB_task.c
+2
-1
No files found.
executables/nr-uesoftmodem.c
View file @
a853a087
...
...
@@ -550,7 +550,7 @@ int main( int argc, char **argv ) {
// Sleep a while before checking all parameters have been used
// Some are used directly in external threads, asynchronously
sleep
(
20
);
sleep
(
20
0
);
config_check_unknown_cmdlineopt
(
CONFIG_CHECKALLSECTIONS
);
while
(
true
)
...
...
openair2/COMMON/ngap_messages_types.h
View file @
a853a087
...
...
@@ -350,9 +350,12 @@ typedef enum ngap_Cause_e {
NGAP_CAUSE_NAS
,
NGAP_CAUSE_PROTOCOL
,
NGAP_CAUSE_MISC
,
/* Extensions may appear below */
}
ngap_Cause_t
;
NGAP_Cause_PR_choice_ExtensionS
,
//Evilish manual duplicate of asn.1 grammar
//because it is human work, whereas it can be generated by machine
//and because humans manual copy creates bugs
//and we create multiple names for the same thing, that is a source of confusion
}
ngap_Cause_t
;
typedef
enum
ngap_Cause_radio_network_e
{
NGAP_CAUSE_RADIO_NETWORK_UNSPECIFIED
,
...
...
openair2/COMMON/sctp_messages_types.h
View file @
a853a087
...
...
@@ -119,7 +119,7 @@ typedef struct sctp_data_ind_s {
/* Buffer to send over SCTP */
uint32_t
buffer_length
;
uint8_t
*
buffer
;
bool
freeAfterSend
;
/* Streams on which data will be sent/received */
uint16_t
stream
;
}
sctp_data_ind_t
;
...
...
openair2/E1AP/e1ap_common.c
View file @
a853a087
...
...
@@ -227,6 +227,7 @@ int e1ap_encode_send(E1_t type, e1ap_setup_req_t *setupReq, E1AP_E1AP_PDU_t *pdu
s
->
buffer
=
buffer
;
s
->
buffer_length
=
encoded
;
s
->
stream
=
stream
;
s
->
freeAfterSend
=
true
;
LOG_I
(
E1AP
,
"%s: Sending ITTI message to SCTP Task
\n
"
,
func
);
itti_send_msg_to_task
(
TASK_SCTP
,
0
/*unused by callee*/
,
message
);
}
...
...
openair2/F1AP/f1ap_itti_messaging.c
View file @
a853a087
...
...
@@ -32,6 +32,7 @@ void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffe
sctp_data_req
->
buffer
=
buffer
;
sctp_data_req
->
buffer_length
=
buffer_length
;
sctp_data_req
->
stream
=
stream
;
sctp_data_req
->
freeAfterSend
=
true
;
LOG_D
(
F1AP
,
"Sending ITTI message to SCTP Task
\n
"
);
itti_send_msg_to_task
(
TASK_SCTP
,
instance
,
message_p
);
}
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
View file @
a853a087
...
...
@@ -2799,7 +2799,13 @@ void nr_mac_update_timers(module_id_t module_id,
(
void
**
)
&
cg
,
(
uint8_t
*
)
UE
->
cg_buf
,
(
UE
->
enc_rval
.
encoded
+
7
)
/
8
,
0
,
0
);
UE
->
CellGroup
=
cg
;
if
(
UE
->
CellGroup
)
{
NR_CellGroupConfig_t
*
tmp
=
UE
->
CellGroup
;
UE
->
CellGroup
=
cg
;
ASN_STRUCT_FREE
(
asn_DEF_NR_CellGroupConfig
,
tmp
);
}
else
UE
->
CellGroup
=
cg
;
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
))
{
xer_fprint
(
stdout
,
&
asn_DEF_NR_CellGroupConfig
,
(
const
void
*
)
UE
->
CellGroup
);
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
a853a087
...
...
@@ -1298,27 +1298,24 @@ uint8_t do_NR_SecurityModeCommand(
uint8_t
*
const
buffer
,
const
uint8_t
Transaction_id
,
const
uint8_t
cipheringAlgorithm
,
NR_IntegrityProtAlgorithm_t
*
integrityProtAlgorithm
NR_IntegrityProtAlgorithm_t
integrityProtAlgorithm
)
//------------------------------------------------------------------------------
{
NR_DL_DCCH_Message_t
dl_dcch_msg
;
NR_DL_DCCH_Message_t
dl_dcch_msg
=
{
0
}
;
asn_enc_rval_t
enc_rval
;
memset
(
&
dl_dcch_msg
,
0
,
sizeof
(
NR_DL_DCCH_Message_t
));
dl_dcch_msg
.
message
.
present
=
NR_DL_DCCH_MessageType_PR_c1
;
dl_dcch_msg
.
message
.
choice
.
c1
=
CALLOC
(
1
,
sizeof
(
struct
NR_DL_DCCH_MessageType__c1
)
);
dl_dcch_msg
.
message
.
choice
.
c1
->
present
=
NR_DL_DCCH_MessageType__c1_PR_securityModeCommand
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeCommand
=
CALLOC
(
1
,
sizeof
(
struct
NR_SecurityModeCommand
)
);
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeCommand
->
rrc_TransactionIdentifier
=
Transaction_id
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeCommand
->
criticalExtensions
.
present
=
NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand
;
asn1cCalloc
(
dl_dcch_msg
.
message
.
choice
.
c1
,
c1
);
c1
->
present
=
NR_DL_DCCH_MessageType__c1_PR_securityModeCommand
;
asn1cCalloc
(
c1
->
choice
.
securityModeCommand
,
scm
);
scm
->
rrc_TransactionIdentifier
=
Transaction_id
;
scm
->
criticalExtensions
.
present
=
NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
=
CALLOC
(
1
,
sizeof
(
struct
NR_SecurityModeCommand_IEs
));
asn1cCalloc
(
scm
->
criticalExtensions
.
choice
.
securityModeCommand
,
scmIE
);
// the two following information could be based on the mod_id
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
->
securityConfigSMC
.
securityAlgorithmConfig
.
cipheringAlgorithm
scmIE
->
securityConfigSMC
.
securityAlgorithmConfig
.
cipheringAlgorithm
=
(
NR_CipheringAlgorithm_t
)
cipheringAlgorithm
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
->
securityConfigSMC
.
securityAlgorithmConfig
.
integrityProtAlgorithm
=
integrityProtAlgorithm
;
asn1cCallocOne
(
scmIE
->
securityConfigSMC
.
securityAlgorithmConfig
.
integrityProtAlgorithm
,
integrityProtAlgorithm
);
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
)
)
{
xer_fprint
(
stdout
,
&
asn_DEF_NR_DL_DCCH_Message
,
(
void
*
)
&
dl_dcch_msg
);
...
...
@@ -1332,7 +1329,7 @@ uint8_t do_NR_SecurityModeCommand(
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_NR_DL_DCCH_Message
,
&
dl_dcch_msg
);
LOG_D
(
NR_RRC
,
"[gNB %d] securityModeCommand for UE %lx Encoded %zd bits (%zd bytes)
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
rntiMaybeUEid
,
enc_rval
.
encoded
,
(
enc_rval
.
encoded
+
7
)
/
8
);
// rrc_ue_process_ueCapabilityEnquiry(0,1000,&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry,0);
...
...
@@ -1751,29 +1748,26 @@ do_NR_DLInformationTransfer(
//------------------------------------------------------------------------------
{
ssize_t
encoded
;
NR_DL_DCCH_Message_t
dl_dcch_msg
;
memset
(
&
dl_dcch_msg
,
0
,
sizeof
(
NR_DL_DCCH_Message_t
));
NR_DL_DCCH_Message_t
dl_dcch_msg
=
{
0
};
dl_dcch_msg
.
message
.
present
=
NR_DL_DCCH_MessageType_PR_c1
;
dl_dcch_msg
.
message
.
choice
.
c1
=
CALLOC
(
1
,
sizeof
(
struct
NR_DL_DCCH_MessageType__c1
)
);
dl_dcch_msg
.
message
.
choice
.
c1
->
present
=
NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer
;
asn1cCalloc
(
dl_dcch_msg
.
message
.
choice
.
c1
,
c1
);
c1
->
present
=
NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
dlInformationTransfer
=
CALLOC
(
1
,
sizeof
(
NR_DLInformationTransfer_t
)
);
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
dlInformation
Transfer
->
rrc_TransactionIdentifier
=
transaction_id
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
dlInformation
Transfer
->
criticalExtensions
.
present
=
asn1cCalloc
(
c1
->
choice
.
dlInformationTransfer
,
infoTransfer
);
info
Transfer
->
rrc_TransactionIdentifier
=
transaction_id
;
info
Transfer
->
criticalExtensions
.
present
=
NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
dlInformationTransfer
->
criticalExtensions
.
choice
.
dlInformationTransfer
=
CALLOC
(
1
,
sizeof
(
NR_DLInformationTransfer_IEs_t
));
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
dlInformationTransfer
->
criticalExtensions
.
choice
.
dlInformationTransfer
->
dedicatedNAS_Message
=
CALLOC
(
1
,
sizeof
(
NR_DedicatedNAS_Message_t
));
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
dlInformationTransfer
->
criticalExtensions
.
choice
.
dlInformationTransfer
->
dedicatedNAS_Message
->
buf
=
pdu_buffer
;
dl_dcch_msg
.
message
.
choice
.
c1
->
choice
.
dlInformationTransfer
->
criticalExtensions
.
choice
.
dlInformationTransfer
->
dedicatedNAS_Message
->
size
=
pdu_length
;
asn1cCalloc
(
infoTransfer
->
criticalExtensions
.
choice
.
dlInformationTransfer
,
dlInfoTransfer
);
asn1cCalloc
(
dlInfoTransfer
->
dedicatedNAS_Message
,
msg
);
// we will free the caller buffer
msg
->
buf
=
pdu_buffer
;
msg
->
size
=
pdu_length
;
encoded
=
uper_encode_to_new_buffer
(
&
asn_DEF_NR_DL_DCCH_Message
,
NULL
,
(
void
*
)
&
dl_dcch_msg
,
(
void
**
)
buffer
);
AssertFatal
(
encoded
>
0
,
"ASN1 message encoding failed (%s, %ld)!
\n
"
,
"DLInformationTransfer"
,
encoded
);
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_NR_DL_DCCH_Message
,
&
dl_dcch_msg
);
LOG_D
(
NR_RRC
,
"DLInformationTransfer Encoded %zd bytes
\n
"
,
encoded
);
//for (int i=0;i<encoded;i++) printf("%02x ",(*buffer)[i]);
return
encoded
;
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.h
View file @
a853a087
...
...
@@ -113,7 +113,7 @@ uint8_t do_NR_SecurityModeCommand(
uint8_t
*
const
buffer
,
const
uint8_t
Transaction_id
,
const
uint8_t
cipheringAlgorithm
,
NR_IntegrityProtAlgorithm_t
*
integrityProtAlgorithm
);
NR_IntegrityProtAlgorithm_t
integrityProtAlgorithm
);
uint8_t
do_NR_SA_UECapabilityEnquiry
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
uint8_t
*
const
buffer
,
...
...
openair2/RRC/NR/rrc_gNB.c
View file @
a853a087
...
...
@@ -3868,7 +3868,7 @@ rrc_gNB_generate_SecurityModeCommand(
T
(
T_ENB_RRC_SECURITY_MODE_COMMAND
,
T_INT
(
ctxt_pP
->
module_id
),
T_INT
(
ctxt_pP
->
frame
),
T_INT
(
ctxt_pP
->
subframe
),
T_INT
(
ctxt_pP
->
rntiMaybeUEid
));
NR_IntegrityProtAlgorithm_t
integrity_algorithm
=
(
NR_IntegrityProtAlgorithm_t
)
ue_p
->
integrity_algorithm
;
size
=
do_NR_SecurityModeCommand
(
ctxt_pP
,
buffer
,
rrc_gNB_get_next_transaction_identifier
(
ctxt_pP
->
module_id
),
ue_p
->
ciphering_algorithm
,
&
integrity_algorithm
);
size
=
do_NR_SecurityModeCommand
(
ctxt_pP
,
buffer
,
rrc_gNB_get_next_transaction_identifier
(
ctxt_pP
->
module_id
),
ue_p
->
ciphering_algorithm
,
integrity_algorithm
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_RRC
,(
char
*
)
buffer
,
size
,
"[MSG] RRC Security Mode Command
\n
"
);
LOG_I
(
NR_RRC
,
"UE %04x Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)
\n
"
,
ue_p
->
rnti
,
size
);
...
...
openair2/RRC/NR/rrc_gNB_NGAP.c
View file @
a853a087
...
...
@@ -279,6 +279,9 @@ static void fill_qos(NGAP_QosFlowSetupRequestList_t *qos, pdusession_t *session)
static
int
decodePDUSessionResourceSetup
(
pdusession_t
*
session
)
{
NGAP_PDUSessionResourceSetupRequestTransfer_t
*
pdusessionTransfer
;
for
(
int
i
=
0
;
i
<
session
->
pdusessionTransfer
.
length
;
i
++
)
printf
(
"%02x:"
,
session
->
pdusessionTransfer
.
buffer
[
i
]);
printf
(
"
\n
"
);
asn_codec_ctx_t
st
=
{.
max_stack_size
=
100
*
1000
};
asn_dec_rval_t
dec_rval
=
aper_decode
(
&
st
,
&
asn_DEF_NGAP_PDUSessionResourceSetupRequestTransfer
,
(
void
**
)
&
pdusessionTransfer
,
session
->
pdusessionTransfer
.
buffer
,
session
->
pdusessionTransfer
.
length
,
0
,
0
);
...
...
@@ -345,6 +348,8 @@ static int decodePDUSessionResourceSetup(pdusession_t *session)
return
-
1
;
}
}
ASN_STRUCT_FREE
(
asn_DEF_NGAP_PDUSessionResourceSetupRequestTransfer
,
pdusessionTransfer
);
return
0
;
}
...
...
@@ -629,6 +634,7 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu
AssertFatal
(
srb_id
>
0
&&
srb_id
<
maxSRBs
,
""
);
/* Transfer data to PDCP */
nr_rrc_data_req
(
&
ctxt
,
srb_id
,
(
*
rrc_gNB_mui
)
++
,
SDU_CONFIRM_NO
,
length
,
buffer
,
PDCP_TRANSMISSION_MODE_CONTROL
);
free
(
buffer
);
// nr_rrc_data_req do a second malloc and copy
}
break
;
case
ngran_gNB_DU
:
...
...
@@ -924,6 +930,7 @@ static void decodePDUSessionResourceModify(pdusession_t *param, const ngap_pdu_t
return
;
}
}
ASN_STRUCT_FREE
(
asn_DEF_NGAP_PDUSessionResourceModifyRequestTransfer
,
pdusessionTransfer
);
}
//------------------------------------------------------------------------------
...
...
openair2/X2AP/x2ap_eNB_itti_messaging.c
View file @
a853a087
...
...
@@ -44,6 +44,7 @@ void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin
sctp_data_req
->
buffer
=
buffer
;
sctp_data_req
->
buffer_length
=
buffer_length
;
sctp_data_req
->
stream
=
stream
;
sctp_data_req
->
freeAfterSend
=
true
;
itti_send_msg_to_task
(
TASK_SCTP
,
instance
,
message_p
);
}
...
...
openair3/NGAP/ngap_gNB_context_management_procedures.c
View file @
a853a087
...
...
@@ -187,7 +187,7 @@ int ngap_ue_context_release_req(instance_t instance,
ie
->
id
=
NGAP_ProtocolIE_ID_id_Cause
;
ie
->
criticality
=
NGAP_Criticality_ignore
;
ie
->
value
.
present
=
NGAP_UEContextReleaseRequest_IEs__value_PR_Cause
;
DevAssert
(
ue_release_req_p
->
cause
<=
NGAP_Cause_PR_choice_Extension
s
);
DevAssert
(
ue_release_req_p
->
cause
<=
NGAP_Cause_PR_choice_Extension
S
);
ie
->
value
.
choice
.
Cause
.
present
=
ue_release_req_p
->
cause
;
ie
->
value
.
choice
.
Cause
.
choice
.
misc
=
ue_release_req_p
->
cause_value
;
}
...
...
openair3/NGAP/ngap_gNB_itti_messaging.c
View file @
a853a087
...
...
@@ -45,6 +45,7 @@ void ngap_gNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin
sctp_data_req
->
buffer
=
buffer
;
sctp_data_req
->
buffer_length
=
buffer_length
;
sctp_data_req
->
stream
=
stream
;
sctp_data_req
->
freeAfterSend
=
true
;
itti_send_msg_to_task
(
TASK_SCTP
,
instance
,
message_p
);
}
...
...
openair3/SCTP/sctp_eNB_task.c
View file @
a853a087
...
...
@@ -650,7 +650,8 @@ static void sctp_send_data(sctp_data_req_t *sctp_data_req_p)
/* TODO: notify upper layer */
return
;
}
if
(
sctp_data_req_p
->
freeAfterSend
)
free
(
sctp_data_req_p
->
buffer
);
SCTP_DEBUG
(
"Successfully sent %u bytes on stream %d for assoc_id %u
\n
"
,
sctp_data_req_p
->
buffer_length
,
sctp_data_req_p
->
stream
,
sctp_cnx
->
assoc_id
);
...
...
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