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(
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",
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
|| RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU
|| RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) {
......@@ -428,6 +428,7 @@ boolean_t pdcp_data_req(
else // SRB
{
#ifndef UETARGET
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_gNB_CU) ) {
......@@ -449,7 +450,9 @@ boolean_t pdcp_data_req(
LOG_I(PDCP, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
ret=TRUE;
} else{
} else
#endif
{
rlc_status = rlc_data_req(ctxt_pP
, srb_flagP
, MBMS_FLAG_NO
......
......@@ -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));
#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
else
proto_agent_send_pdcp_data_ind (
ctxt_pP,
srb_flagP,
MBMS_flagP,
rb_idP,
sdu_sizeP,
sdu_pP);
#endif
break;
default:
pdcp_data_ind (
ctxt_pP,
srb_flagP,
MBMS_flagP,
rb_idP,
sdu_sizeP,
sdu_pP);
break;
const ngran_node_t type = RC.rrc[ctxt_pP->module_id]->node_type;
AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU,
"Can't be CU, bad node type %d\n", type);
if (type == ngran_eNB_DU || type == 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);
} else {
proto_agent_send_pdcp_data_ind (ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP);
}
}
} 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,
......
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