Commit 20c35748 authored by Robert Schmidt's avatar Robert Schmidt

Fix lte-uesoftmodem: segfaults & logic errors

* prevent segfault: guard access to RC.rrc with UETARGET
* in rlc_data_ind(): correct logic to test for all cases eNB, CU, DU, UE
parent 05ebea4a
...@@ -370,10 +370,10 @@ boolean_t pdcp_data_req( ...@@ -370,10 +370,10 @@ boolean_t pdcp_data_req(
if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1))
{ {
#ifndef UETARGET
LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n",
rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type); rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type);
#ifndef UETARGET
if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU
|| RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU
|| RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) { || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) {
...@@ -428,6 +428,7 @@ boolean_t pdcp_data_req( ...@@ -428,6 +428,7 @@ boolean_t pdcp_data_req(
else // SRB else // SRB
{ {
#ifndef UETARGET
if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU) || if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU) ||
(RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU)|| (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU)||
(RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) ) { (RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) ) {
...@@ -449,7 +450,9 @@ boolean_t pdcp_data_req( ...@@ -449,7 +450,9 @@ boolean_t pdcp_data_req(
LOG_I(PDCP, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); LOG_I(PDCP, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
ret=TRUE; ret=TRUE;
} else{ } else
#endif
{
rlc_status = rlc_data_req(ctxt_pP rlc_status = rlc_data_req(ctxt_pP
, srb_flagP , srb_flagP
, MBMS_FLAG_NO , MBMS_FLAG_NO
......
...@@ -607,16 +607,13 @@ void rlc_data_ind ( ...@@ -607,16 +607,13 @@ void rlc_data_ind (
T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP)); T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP));
#endif #endif
if (ctxt_pP->enb_flag == 1)
{ #ifndef UETARGET
switch (RC.rrc[ctxt_pP->module_id]->node_type){ const ngran_node_t type = RC.rrc[ctxt_pP->module_id]->node_type;
case ngran_eNB_CU: AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU,
case ngran_ng_eNB_CU: "Can't be CU, bad node type %d\n", type);
case ngran_gNB_CU:
LOG_E(RLC, "Can't be CU, Bad Node type %d\n",RC.rrc[ctxt_pP->module_id]->node_type); if (type == ngran_eNB_DU || type == ngran_gNB_DU) {
break;
case ngran_eNB_DU:
case ngran_gNB_DU:
if (srb_flagP == 1) { if (srb_flagP == 1) {
MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE); MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE);
F1AP_UL_RRC_MESSAGE(msg).rnti = ctxt_pP->rnti; F1AP_UL_RRC_MESSAGE(msg).rnti = ctxt_pP->rnti;
...@@ -624,31 +621,13 @@ void rlc_data_ind ( ...@@ -624,31 +621,13 @@ void rlc_data_ind (
F1AP_UL_RRC_MESSAGE(msg).rrc_container = sdu_pP->data; F1AP_UL_RRC_MESSAGE(msg).rrc_container = sdu_pP->data;
F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = sdu_sizeP; F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = sdu_sizeP;
itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg);
} else {
proto_agent_send_pdcp_data_ind (ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP);
} }
#ifndef UETARGET } else
else
proto_agent_send_pdcp_data_ind (
ctxt_pP,
srb_flagP,
MBMS_flagP,
rb_idP,
sdu_sizeP,
sdu_pP);
#endif #endif
{ // case monolithic eNodeB or UE
break; pdcp_data_ind(ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP);
default:
pdcp_data_ind (
ctxt_pP,
srb_flagP,
MBMS_flagP,
rb_idP,
sdu_sizeP,
sdu_pP);
break;
}
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment