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,49 +607,28 @@ void rlc_data_ind ( ...@@ -607,49 +607,28 @@ 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)
{
switch (RC.rrc[ctxt_pP->module_id]->node_type){
case ngran_eNB_CU:
case ngran_ng_eNB_CU:
case ngran_gNB_CU:
LOG_E(RLC, "Can't be CU, Bad Node type %d\n",RC.rrc[ctxt_pP->module_id]->node_type);
break;
case ngran_eNB_DU:
case ngran_gNB_DU:
if (srb_flagP == 1) {
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).srb_id = rb_idP;
F1AP_UL_RRC_MESSAGE(msg).rrc_container = sdu_pP->data;
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);
}
#ifndef UETARGET #ifndef UETARGET
else const ngran_node_t type = RC.rrc[ctxt_pP->module_id]->node_type;
proto_agent_send_pdcp_data_ind ( AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU,
ctxt_pP, "Can't be CU, bad node type %d\n", type);
srb_flagP,
MBMS_flagP, if (type == ngran_eNB_DU || type == ngran_gNB_DU) {
rb_idP, if (srb_flagP == 1) {
sdu_sizeP, MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE);
sdu_pP); F1AP_UL_RRC_MESSAGE(msg).rnti = ctxt_pP->rnti;
#endif F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_idP;
F1AP_UL_RRC_MESSAGE(msg).rrc_container = sdu_pP->data;
break; 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);
default: } else {
pdcp_data_ind ( proto_agent_send_pdcp_data_ind (ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP);
ctxt_pP,
srb_flagP,
MBMS_flagP,
rb_idP,
sdu_sizeP,
sdu_pP);
break;
} }
} else
} #endif
{ // case monolithic eNodeB or UE
pdcp_data_ind(ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP);
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_data_conf (const protocol_ctxt_t *const ctxt_pP, void rlc_data_conf (const protocol_ctxt_t *const ctxt_pP,
......
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