diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c index 092c7c65f135f05827e36fcf46bc5c56f4d72a86..22c560470849bb1a392bfebfa2c640b9ef6db9e5 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c @@ -611,7 +611,10 @@ rlc_am_send_status_pdu( /* Now process all Segments of sn_cursor if PDU not fully received */ if ((!status_report_completed) && (all_segments_received == 0) && (sn_cursor != rlc_pP->vr_ms)) { - AssertFatal (sn_nack == sn_cursor, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id); + //AssertFatal (sn_nack == sn_cursor, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id); + if(sn_nack != sn_cursor){ + LOG_E(RLC, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id); + } /* First ensure there is enough TBS for at least 1 SOStart/SOEnd, else break */ if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) { @@ -757,8 +760,14 @@ rlc_am_send_status_pdu( } // End main while NACK_SN /* Clear E1 of last nack_sn entry */ - AssertFatal ((control_pdu_info.num_nack) || (all_segments_received == 0), "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n", - rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id); +// AssertFatal ((control_pdu_info.num_nack) || (all_segments_received == 0), "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n", +// rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id); + if (!((control_pdu_info.num_nack) || (all_segments_received == 0))){ + LOG_E(RLC, "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n", + rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id); + return; + } + if (control_pdu_info.num_nack) { control_pdu_info.nack_list[control_pdu_info.num_nack - 1].e1 = 0; } @@ -796,8 +805,13 @@ rlc_am_send_status_pdu( /* encode the control pdu */ pdu_size = (nb_bits_transmitted + 7) >> 3; - AssertFatal (pdu_size <= rlc_pP->nb_bytes_requested_by_mac, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n", +// AssertFatal (pdu_size <= rlc_pP->nb_bytes_requested_by_mac, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n", +// pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id); + if(pdu_size > rlc_pP->nb_bytes_requested_by_mac){ + LOG_E(RLC, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n", pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id); + return; + } #if TRACE_RLC_AM_STATUS_CREATION @@ -825,8 +839,14 @@ rlc_am_send_status_pdu( nb_bits_to_transmit >> 3); #endif - AssertFatal (pdu_size == ((nb_bits_transmitted + 7) >> 3), "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n", +// AssertFatal (pdu_size == ((nb_bits_transmitted + 7) >> 3), "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n", +// pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id); + if(pdu_size != ((nb_bits_transmitted + 7) >> 3)){ + LOG_E(RLC, "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n", pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id); + pdu_size = 0; + return; + } // remaining bytes to transmit for RLC (retrans pdus and new data pdus) rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - pdu_size; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c index 0b88e7c650fe4e3d4b9fb23e93eb7fbfb45c9f00..7069e099ebd641624be903c404e8628df1e42a30 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c @@ -87,9 +87,16 @@ rlc_am_check_timer_poll_retransmit( /* Look for the first retransmittable PDU starting from vtS - 1 */ while (sn != sn_end) { - tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE]; - AssertFatal (tx_data_pdu_buffer_p->mem_block != NULL, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n", - sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); + tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE]; + //AssertFatal (tx_data_pdu_buffer_p->mem_block != NULL, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n", + // sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); + if(tx_data_pdu_buffer_p->mem_block == NULL){ + LOG_E(RLC, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n", + sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); + sn = RLC_AM_PREV_SN(sn); + continue; + } + if ((tx_data_pdu_buffer_p->flags.ack == 0) && (tx_data_pdu_buffer_p->flags.max_retransmit == 0)) { tx_data_pdu_buffer_p->flags.retransmit = 1; tx_data_pdu_buffer_p->retx_payload_size = tx_data_pdu_buffer_p->payload_size; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c index b9383980a4231cd9f84dba7b276bf7c1787dd3be..92bb3d61550fa31c62ddcdbd7fee4fe23a74f4b7 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c @@ -70,7 +70,12 @@ rlc_am_check_timer_reordering( PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP)); #endif - AssertFatal (rlc_pP->vr_x != RLC_SN_UNDEFINED, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id); + //AssertFatal (rlc_pP->vr_x != RLC_SN_UNDEFINED, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id); + if(rlc_pP->vr_x == RLC_SN_UNDEFINED){ + LOG_E(RLC, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id); + return; + } + rlc_pP->t_reordering.running = 0; rlc_pP->t_reordering.timed_out = 1; @@ -81,8 +86,12 @@ rlc_am_check_timer_reordering( cursor = rlc_pP->receiver_buffer.head; rlc_usn_t vr_ms_new = rlc_pP->vr_x; - AssertFatal (cursor != NULL, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id); - + //AssertFatal (cursor != NULL, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id); + if(cursor == NULL){ + LOG_E(RLC, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id); + return; + } + /* go to memblock up to vrX*/ pdu_info = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info; while ((cursor != NULL) && (RLC_AM_DIFF_SN(pdu_info->sn,rlc_pP->vr_r) < RLC_AM_DIFF_SN(vr_ms_new,rlc_pP->vr_r))) { diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c index 864921ff8850dbe239f524fb5c89eb0850174b32..0718cdd93c2ddc8029da3ae78a154ce06425f450 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c @@ -568,7 +568,11 @@ rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP,cons l_rlc_p->stat_tx_data_pdu += 1; l_rlc_p->stat_tx_data_bytes += tb_size_in_bytes; - AssertFatal( tb_size_in_bytes > 0 , "RLC UM PDU LENGTH %d", tb_size_in_bytes); + //AssertFatal( tb_size_in_bytes > 0 , "RLC UM PDU LENGTH %d", tb_size_in_bytes); + if(tb_size_in_bytes <= 0) { + LOG_E(RLC, "RLC UM PDU LENGTH %d\n", tb_size_in_bytes); + } + #if TRACE_RLC_UM_PDU || MESSAGE_CHART_GENERATOR rlc_um_get_pdu_infos(ctxt_pP, l_rlc_p,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_req*) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length); #endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c index 4e2723a8f476489bb16fe1eb677f6e0ed4550ab2..499cdc70804fc66a0d74cab28db8b8977933dfa9 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c @@ -106,28 +106,48 @@ void config_req_rlc_um_asn1 ( #if defined(Rel10) || defined(Rel14) if (mbms_flagP) { - AssertFatal(dl_rlc_pP, "No RLC UM DL config"); - AssertFatal(ul_rlc_pP == NULL, "RLC UM UL config present"); + //AssertFatal(dl_rlc_pP, "No RLC UM DL config"); + if(dl_rlc_pP == NULL) { + LOG_E(RLC, "No RLC UM DL config\n"); + return; + } + //AssertFatal(ul_rlc_pP == NULL, "RLC UM UL config present"); + if(ul_rlc_pP != NULL) { + LOG_E(RLC, "RLC UM UL config present\n"); + return; + } + key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); - AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u", - ctxt_pP->module_id, - ctxt_pP->rnti, - ctxt_pP->enb_flag, - mbms_service_idP, - mbms_session_idP); + //AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u", + // ctxt_pP->module_id, + // ctxt_pP->rnti, + // ctxt_pP->enb_flag, + // mbms_service_idP, + // mbms_session_idP); + if(h_rc != HASH_TABLE_OK) { + LOG_E(RLC, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u\n", + ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP); + return; + } + rlc_p = &rlc_union_p->rlc.um; } else #endif { key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); - AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u", - ctxt_pP->module_id, - ctxt_pP->rnti, - ctxt_pP->enb_flag, - rb_idP, - srb_flagP); + //AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u", + // ctxt_pP->module_id, + // ctxt_pP->rnti, + // ctxt_pP->enb_flag, + // rb_idP, + // srb_flagP); + if(h_rc != HASH_TABLE_OK) { + LOG_E(RLC, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u\n", + ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); + return; + } rlc_p = &rlc_union_p->rlc.um; } @@ -269,7 +289,11 @@ rlc_um_init ( ) { - AssertFatal(rlc_pP, "Bad RLC UM pointer (NULL)"); + //AssertFatal(rlc_pP, "Bad RLC UM pointer (NULL)"); + if(rlc_pP == NULL) { + LOG_E(RLC, "Bad RLC UM pointer (NULL)\n"); + return; + } if (rlc_pP->initialized) { LOG_D(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [INIT] ALREADY DONE, DOING NOTHING\n", diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c index fe718392310a8ef4e9c854775cf46d5883a4b41c..cd92cf2c5e877b11aaae42b218e20c1085c9a0a0 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c @@ -47,7 +47,11 @@ signed int rlc_um_get_pdu_infos( pdu_info_pP->num_li = 0; - AssertFatal( total_sizeP > 0 , "RLC UM PDU LENGTH %d", total_sizeP); + //AssertFatal( total_sizeP > 0 , "RLC UM PDU LENGTH %d", total_sizeP); + if(total_sizeP <= 0) { + LOG_E(RLC, "RLC UM PDU LENGTH %d\n", total_sizeP); + return -1; + } if (sn_lengthP == 10) { pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03; @@ -62,7 +66,11 @@ signed int rlc_um_get_pdu_infos( pdu_info_pP->header_size = 1; pdu_info_pP->payload = &header_pP->b2; } else { - AssertFatal( sn_lengthP == 5 || sn_lengthP == 10, "RLC UM SN LENGTH %d", sn_lengthP); + //AssertFatal( sn_lengthP == 5 || sn_lengthP == 10, "RLC UM SN LENGTH %d", sn_lengthP); + if(!(sn_lengthP == 5 || sn_lengthP == 10)) { + LOG_E(RLC, "RLC UM SN LENGTH %d\n", sn_lengthP); + return -1; + } } @@ -77,15 +85,23 @@ signed int rlc_um_get_pdu_infos( li_length_in_bytes = li_length_in_bytes ^ 3; if (li_length_in_bytes == 2) { - AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP), - "DECODING PDU TOO FAR PDU size %d", total_sizeP); + //AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP), + // "DECODING PDU TOO FAR PDU size %d", total_sizeP); + if(total_sizeP < ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP)) { + LOG_E(RLC, "DECODING PDU TOO FAR PDU size %d\n", total_sizeP); + return -1; + } pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li_p->b1 << 4)) & 0x07F0; pdu_info_pP->li_list[pdu_info_pP->num_li] |= (((uint8_t)(e_li_p->b2 >> 4)) & 0x000F); li_to_read = e_li_p->b1 & 0x80; pdu_info_pP->header_size += 2; } else { - AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP), - "DECODING PDU TOO FAR PDU size %d", total_sizeP); + //AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP), + // "DECODING PDU TOO FAR PDU size %d", total_sizeP); + if(total_sizeP < ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP)) { + LOG_E(RLC, "DECODING PDU TOO FAR PDU size %d\n", total_sizeP); + return -1; + } pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li_p->b2 << 8)) & 0x0700; pdu_info_pP->li_list[pdu_info_pP->num_li] |= e_li_p->b3; li_to_read = e_li_p->b2 & 0x08; @@ -93,10 +109,16 @@ signed int rlc_um_get_pdu_infos( pdu_info_pP->header_size += 1; } - AssertFatal( pdu_info_pP->num_li <= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU, - PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ", + //AssertFatal( pdu_info_pP->num_li <= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU, + // PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ", + // PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), + // pdu_info_pP->sn); + if(pdu_info_pP->num_li > RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU) { + LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs \n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), pdu_info_pP->sn); + return -1; + } sum_li += pdu_info_pP->li_list[pdu_info_pP->num_li]; pdu_info_pP->num_li = pdu_info_pP->num_li + 1; @@ -308,9 +330,17 @@ rlc_um_try_reassembly( __LINE__); #endif } - AssertFatal(size >= 0, "invalid size!"); - AssertFatal((e==0) || (e==1), "invalid e!"); - AssertFatal((fi >= 0) && (fi <= 3), "invalid fi!"); + //AssertFatal(size >= 0, "invalid size!"); + //AssertFatal((e==0) || (e==1), "invalid e!"); + //AssertFatal((fi >= 0) && (fi <= 3), "invalid fi!"); + if((size < 0) || ((e!=0) && (e!=1)) || ((fi < 0) || (fi > 3))){ + LOG_E(RLC, "invalid size %d, e %d, fi %d\n", size, e, fi); + sn = (sn + 1) % rlc_pP->rx_sn_modulo; + if ((sn == rlc_pP->vr_uh) || (sn == end_snP)) { + continue_reassembly = 0; + } + continue; + } if (e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) { switch (fi) { @@ -400,11 +430,14 @@ rlc_um_try_reassembly( break; default: - AssertFatal( 0 , PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n", - PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), - fi, - __FILE__, - __LINE__); + //AssertFatal( 0 , PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n", + // PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), + // fi, + // __FILE__, + // __LINE__); + LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n", + PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), fi, __FILE__, __LINE__); + } } else { if (rlc_um_read_length_indicators(&data_p, e_li_p, li_array, &num_li, &size ) >= 0) { @@ -543,11 +576,14 @@ rlc_um_try_reassembly( // data_p is already ok, done by last loop above rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); } else { - AssertFatal( 0 !=0, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n", - PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), - size, - __FILE__, - __LINE__); + //AssertFatal( 0 !=0, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n", + // PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), + // size, + // __FILE__, + // __LINE__); + LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n", + PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), size, __FILE__, __LINE__); + //rlc_pP->stat_rx_data_pdu_dropped += 1; rlc_pP->stat_rx_data_bytes_dropped += size; } diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c index 758630b3cce88476ea49df4a253a60d7d36c9879..0a6bf44dda5bdd106fa7bf94dcd163c74ab9cb9d 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c @@ -52,7 +52,7 @@ rlc_um_fsm_notify_event ( LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM NULL_STATE\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), eventP); - AssertFatal(1==0,"RLC-UM FSM WARNING PROTOCOL ERROR - EVENT NOT EXPECTED FROM NULL_STATE"); + //AssertFatal(1==0,"RLC-UM FSM WARNING PROTOCOL ERROR - EVENT NOT EXPECTED FROM NULL_STATE"); return 0; } diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c index f9af7c1cc2b167a3935615aca9b973784ef3cd40..26a68849dd23e68a5258e5fb8fb77ad606014432 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c @@ -411,7 +411,11 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP #if TRACE_RLC_PAYLOAD rlc_util_print_hex_octets(RLC, pdu_mem_p->data, data_pdu_size); #endif - AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT10: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size); + //AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT10: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size); + if(pdu_tb_req_p->tb_size <= 0) { + LOG_E(RLC, "SEGMENT10: FINAL RLC UM PDU LENGTH %d\n", pdu_tb_req_p->tb_size); + break; + } pdu_p = NULL; pdu_mem_p = NULL; @@ -792,7 +796,11 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP) #if TRACE_RLC_PAYLOAD rlc_util_print_hex_octets(RLC, (unsigned char*)pdu_mem_p->data, data_pdu_size); #endif - AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT5: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size); + //AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT5: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size); + if(pdu_tb_req_p->tb_size <= 0) { + LOG_E(RLC, "SEGMENT5: FINAL RLC UM PDU LENGTH %d\n", pdu_tb_req_p->tb_size); + break; + } pdu_p = NULL; pdu_mem_p = NULL; diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index d25b30e7cc56b3dee8cfff62b736939bbff0c5c5..4353e213dc56ab6326d3da8f9cbea53ad0fe727c 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -135,7 +135,12 @@ rlc_op_status_t rlc_stat_req ( hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; - AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + if(rb_idP >= NB_RB_MAX){ + LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + return RLC_OP_STATUS_BAD_PARAMETER; + } + key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -348,13 +353,30 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, #endif if (MBMS_flagP) { - AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX); + //AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX); + if(rb_idP >= NB_RB_MBMS_MAX){ + LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX); + return RLC_OP_STATUS_BAD_PARAMETER; + } } else { - AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + if(rb_idP >= NB_RB_MAX){ + LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + return RLC_OP_STATUS_BAD_PARAMETER; + } } - DevAssert(sdu_pP != NULL); - DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0); + //DevAssert(sdu_pP != NULL); + if(sdu_pP == NULL){ + LOG_E(RLC, "sdu_pP == NULL\n"); + return RLC_OP_STATUS_BAD_PARAMETER; + } + + //DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0); + if(sdu_sizeP <= 0) { + LOG_E(RLC, "sdu_sizeP %d, file %s, line %s\n", sdu_sizeP, __FILE__ ,__LINE__); + return RLC_OP_STATUS_BAD_PARAMETER; + } #if !defined(Rel10) && !defined(Rel14) DevCheck(MBMS_flagP == 0, MBMS_flagP, 0, 0); @@ -386,7 +408,9 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, rlc_mode = rlc_union_p->mode; } else { rlc_mode = RLC_MODE_NONE; - AssertFatal (0 , "RLC not configured key %ju\n", key); + //AssertFatal (0 , "RLC not configured key %ju\n", key); + LOG_E("RLC not configured key %ju\n", key); + return RLC_OP_STATUS_OUT_OF_RESSOURCES; } if (MBMS_flagP == 0) { @@ -608,7 +632,11 @@ rlc_module_init (void) rlc_rrc_data_conf = NULL; rlc_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, rb_free_rlc_union); - AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed"); + //AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed"); + if(rlc_coll_p == NULL) { + LOG_E(RLC, "UNRECOVERABLE error, RLC hashtable_create failed\n"); + return -1; + } for (module_id1=0; module_id1 < NUMBER_OF_UE_MAX; module_id1++) { #if defined(Rel10) || defined(Rel14) diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index da9c29c4dee2dcb747cde6b3806eb103169e45c2..c949702ea3e50ca9eb13a24d7657673d2a4a8320 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -152,9 +152,17 @@ tbs_size_t mac_rlc_data_req( #endif // DEBUG_MAC_INTERFACE if (MBMS_flagP) { - AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC); + //AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC); + if(channel_idP >= RLC_MAX_MBMS_LC){ + LOG_E(RLC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC); + return 0; + } } else { - AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX); + //AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX); + if(channel_idP >= NB_RB_MAX){ + LOG_E(RLC, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX); + return 0; + } } if (MBMS_flagP) { @@ -174,7 +182,8 @@ tbs_size_t mac_rlc_data_req( rlc_mode = rlc_union_p->mode; } else { rlc_mode = RLC_MODE_NONE; - AssertFatal (0 , "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP); + //AssertFatal (0 , "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP); + LOG_E(RLC, "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP); } switch (rlc_mode) { @@ -419,8 +428,12 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( /* Assumptions : for UE only */ /* At each TTI, Buffer Occupancy is first computed in mac_rlc_status_ind called by MAC ue_scheduler() function */ /* Then this function is called during MAC multiplexing ue_get_sdu(), and it may be call several times for the same bearer if it is in AM mode and there are several PDU types to transmit */ - AssertFatal(enb_flagP == FALSE,"RLC Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%d\n", channel_idP); - + //AssertFatal(enb_flagP == FALSE,"RLC Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%d\n", channel_idP); + if(enb_flagP != FALSE){ + LOG_E("RLC Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%d\n", channel_idP); + return 0; + } + key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag); diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index dee6ba700017d6dc48151b32ccac8f7a82eead0c..f4acdb29df8c53aa32065a53e8e1c242f3a04f27 100644 --- a/openair2/LAYER2/RLC/rlc_rrc.c +++ b/openair2/LAYER2/RLC/rlc_rrc.c @@ -373,7 +373,10 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP rb_id, lc_id, RLC_MODE_UM); - AssertFatal(rlc_union_p != NULL, "ADD MBMS RLC UM FAILED"); + //AssertFatal(rlc_union_p != NULL, "ADD MBMS RLC UM FAILED"); + if(rlc_union_p == NULL){ + LOG_E(RLC, "ADD MBMS RLC UM FAILED\n"); + } } LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ MBMS ASN1 LC ID %u RB ID %u SESSION ID %u SERVICE ID %u\n", @@ -511,7 +514,11 @@ rlc_op_status_t rrc_rlc_remove_rlc ( } - AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + if(rb_idP >= NB_RB_MAX){ + LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + return RLC_OP_STATUS_BAD_PARAMETER; + } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -585,8 +592,17 @@ rlc_union_t* rrc_rlc_add_rlc ( #endif if (MBMS_flagP == FALSE) { - AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); - AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC); + //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + //AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC); + if(rb_idP >= NB_RB_MAX){ + LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + return NULL; + } + if(chan_idP >= RLC_MAX_LC){ + LOG_E(RLC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC); + return NULL; + } + } #if defined(Rel10) || defined(Rel14) @@ -623,8 +639,12 @@ rlc_union_t* rrc_rlc_add_rlc ( (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); - AssertFatal(rlc_union_p->mode == rlc_modeP, "Error rrc_rlc_add_rlc , already exist but RLC mode differ"); - return rlc_union_p; + //AssertFatal(rlc_union_p->mode == rlc_modeP, "Error rrc_rlc_add_rlc , already exist but RLC mode differ"); + if(rlc_union_p->mode != rlc_modeP){ + LOG_E(RLC, "Error rrc_rlc_add_rlc , already exist but RLC mode differ\n"); + return NULL; + } + return rlc_union_p; } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { rlc_union_p = calloc(1, sizeof(rlc_union_t)); h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p); @@ -687,7 +707,11 @@ rlc_op_status_t rrc_rlc_config_req ( PROTOCOL_CTXT_ARGS(ctxt_pP), rb_idP); - AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + if(rb_idP >= NB_RB_MAX){ + LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + return RLC_OP_STATUS_BAD_PARAMETER; + } switch (actionP) {