Avoid segmentation fault when RC.nrrrc is not present
This commit is contained in:
@@ -246,14 +246,14 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
|
||||
);
|
||||
|
||||
if (num_cells_available > 0) {
|
||||
if (RC.nrrrc[0]->node_type == ngran_gNB_CU) {
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) {
|
||||
itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p);
|
||||
} else {
|
||||
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p);
|
||||
}
|
||||
} else {
|
||||
CU_send_F1_SETUP_FAILURE(instance);
|
||||
if (RC.nrrrc[0]->node_type == ngran_gNB_CU) {
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) {
|
||||
itti_free(TASK_RRC_GNB,message_p);
|
||||
} else {
|
||||
itti_free(TASK_RRC_ENB,message_p);
|
||||
|
||||
@@ -116,7 +116,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
F1AP_ProtocolIE_ID_id_RRCContainer, true);
|
||||
AssertFatal(ie!=NULL,"RRCContainer is missing\n");
|
||||
// create an ITTI message and copy SDU
|
||||
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
if (RC.nrrrc && RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
message_p = itti_alloc_new_message (TASK_CU_F1, 0, NR_RRC_MAC_CCCH_DATA_IND);
|
||||
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
ccch_sdu_len = ie->value.choice.RRCContainer.size;
|
||||
@@ -150,7 +150,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
}
|
||||
// Find instance from nr_cellid
|
||||
int rrc_inst = -1;
|
||||
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
if (RC.nrrrc && RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
for (int i=0;i<RC.nb_nr_inst;i++) {
|
||||
// first get RRC instance (note, no the ITTI instance)
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[i];
|
||||
@@ -179,7 +179,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
}
|
||||
f1ap_cu_inst[rrc_inst].f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id;
|
||||
|
||||
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
if (RC.nrrrc && RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
|
||||
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
|
||||
|
||||
@@ -72,7 +72,7 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
|
||||
f1ap_du_data_from_du->sctp_out_streams = sctp_new_association_resp->out_streams;
|
||||
|
||||
/* setup parameters for F1U and start the server */
|
||||
const cudu_params_t params = RC.nrrrc[instance]->node_type == ngran_gNB_CU ? (cudu_params_t){
|
||||
const cudu_params_t params = (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_CU) ? (cudu_params_t){
|
||||
.local_ipv4_address = RC.nrrrc[instance]->eth_params_s.my_addr,
|
||||
.local_port = RC.nrrrc[instance]->eth_params_s.my_portd,
|
||||
.remote_ipv4_address = RC.nrrrc[instance]->eth_params_s.remote_addr,
|
||||
@@ -114,7 +114,7 @@ void cu_task_send_sctp_init_req(instance_t enb_id) {
|
||||
message_p->ittiMsg.sctp_init.ipv4 = 1;
|
||||
message_p->ittiMsg.sctp_init.ipv6 = 0;
|
||||
message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1;
|
||||
if (RC.nrrrc[0]->node_type == ngran_gNB_CU) {
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) {
|
||||
message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.nrrrc[enb_id]->eth_params_s.my_addr);
|
||||
} else{
|
||||
message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr);
|
||||
|
||||
@@ -600,7 +600,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
|
||||
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
assoc_id);
|
||||
|
||||
if (RC.nrrrc[0]->node_type == ngran_gNB_DU) {
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_DU) {
|
||||
LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to GNB_APP with assoc_id (%d->%d)\n",
|
||||
assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id));
|
||||
itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p);
|
||||
@@ -1212,7 +1212,7 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance,
|
||||
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
assoc_id);
|
||||
|
||||
if (RC.nrrrc[0]->node_type == ngran_gNB_DU) {
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_DU) {
|
||||
LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message to GNB_APP with assoc_id (%d->%d)\n",
|
||||
assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id));
|
||||
itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p);
|
||||
|
||||
@@ -88,7 +88,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
|
||||
uint32_t stream,
|
||||
F1AP_F1AP_PDU_t *pdu) {
|
||||
|
||||
if (RC.nrrrc[instance]->node_type == ngran_gNB_DU) {
|
||||
if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) {
|
||||
LOG_I(F1AP, "node is gNB DU, call DU_handle_DL_NR_RRC_MESSAGE_TRANSFER \n");
|
||||
return DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance, assoc_id, stream, pdu);
|
||||
}
|
||||
@@ -893,7 +893,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (RC.nrrrc[module_idP]->node_type == ngran_gNB_DU) {
|
||||
if (RC.nrrrc && RC.nrrrc[module_idP]->node_type == ngran_gNB_DU) {
|
||||
struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]);
|
||||
ue_context_p->ue_id_rnti = rntiP;
|
||||
ue_context_p->ue_context.rnti = rntiP;
|
||||
|
||||
@@ -102,7 +102,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
|
||||
f1ap_du_data->default_sctp_stream_id = 0;
|
||||
|
||||
/* setup parameters for F1U and start the server */
|
||||
const cudu_params_t params = RC.nrrrc[instance]->node_type == ngran_gNB_DU ? (cudu_params_t){
|
||||
const cudu_params_t params = (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) ? (cudu_params_t){
|
||||
.local_ipv4_address = RC.nrmac[instance]->eth_params_n.my_addr,
|
||||
.local_port = RC.nrmac[instance]->eth_params_n.my_portd,
|
||||
.remote_ipv4_address = RC.nrmac[instance]->eth_params_n.remote_addr,
|
||||
@@ -201,7 +201,7 @@ void *F1AP_DU_task(void *arg) {
|
||||
|
||||
case F1AP_UL_RRC_MESSAGE: // to rrc
|
||||
LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n");
|
||||
if (RC.nrrrc[0]->node_type == ngran_gNB_DU) {
|
||||
if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_DU) {
|
||||
DU_send_UL_NR_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
|
||||
&F1AP_UL_RRC_MESSAGE(received_msg));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user