rlcmac: fix encode_gsm_*(): do not suppress encoding errors

Change-Id: Ieec8e6e0823c6f6985f9d343af6d503b8fe9e6ab
This commit is contained in:
Vadim Yanitskiy 2020-03-06 08:26:16 +07:00 committed by fixeria
parent 40d4e35fb3
commit 773cb74ec8
3 changed files with 14 additions and 11 deletions

View File

@ -5428,9 +5428,10 @@ int encode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data)
newline, so as a caller we are responisble for submitting it */
LOGPC(DCSN1, LOGL_INFO, "\n");
if (ret > 0) {
LOGP(DRLCMACDATA, LOGL_NOTICE, "Got %d remaining bits unhandled by encoder at the end of bitvec\n", ret);
ret = 0;
if (ret > 0 || ret == CSN_ERROR_NEED_MORE_BITS_TO_UNPACK) {
LOGP(DRLCMACDATA, LOGL_ERROR, "Failed to encode an Uplink block: not enough bits "
"in the output buffer (rc=%d)\n", ret);
ret = CSN_ERROR_NEED_MORE_BITS_TO_UNPACK;
}
return ret;
@ -5634,9 +5635,10 @@ int encode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data)
newline, so as a caller we are responisble for submitting it */
LOGPC(DCSN1, LOGL_INFO, "\n");
if (ret > 0) {
LOGP(DRLCMACDATA, LOGL_NOTICE, "Got %d remaining bits unhandled by encoder at the end of bitvec\n", ret);
ret = 0;
if (ret > 0 || ret == CSN_ERROR_NEED_MORE_BITS_TO_UNPACK) {
LOGP(DRLCMACDATA, LOGL_ERROR, "Failed to encode a Downlink block: not enough bits "
"in the output buffer (rc=%d)\n", ret);
ret = CSN_ERROR_NEED_MORE_BITS_TO_UNPACK;
}
return ret;
@ -5817,9 +5819,10 @@ int encode_gsm_ra_cap(bitvec *vector, MS_Radio_Access_capability_t *data)
ret = csnStreamEncoder(&ar, CSNDESCR(MS_Radio_Access_capability_t), vector, &writeIndex, data);
LOGPC(DCSN1, LOGL_INFO, "\n");
if (ret > 0) {
LOGP(DRLCMACDATA, LOGL_NOTICE, "Got %d remaining bits unhandled by encoder at the end of bitvec\n", ret);
ret = 0;
if (ret > 0 || ret == CSN_ERROR_NEED_MORE_BITS_TO_UNPACK) {
LOGP(DRLCMACDATA, LOGL_ERROR, "Failed to encode MS RA Capability IE: not enough bits "
"in the output buffer (rc=%d)\n", ret);
ret = CSN_ERROR_NEED_MORE_BITS_TO_UNPACK;
}
return ret;

View File

@ -34,5 +34,5 @@ DCSN1 INFO csnStreamDecoder (type=8): PayloadType = 1 | spare = 0 | R = 0 | MESS
DCSN1 INFO csnStreamDecoder (RAcap): MS_RA_capability_value { | Choice MS_RA_capability_value_Choice = 1 | u.Content length = 29 | offset = 4 | RF_Power_Capability = 1 | Exist_A5_bits = 0 | ES_IND = 1 | PS = 0 | VGCS = 0 | VBS = 0 | Exist_Multislot_capability = 1 | : Multislot_capability | Exist_HSCSD_multislot_class = 0 | Exist_GPRS_multislot_class = 1 | GPRS_multislot_class = 3 | GPRS_Extended_Dynamic_Allocation_Capability = 0 | Exist_SM = 0 | Exist_ECSD_multislot_class = 0 | Exist_EGPRS_multislot_class = 1 | EGPRS_multislot_class = 0 | EGPRS_Extended_Dynamic_Allocation_Capability = 0 | Exist_DTM_GPRS_multislot_class = 0 | : End Multislot_capability | Exist_Eight_PSK_Power_Capability = 0 | COMPACT_Interference_Measurement_Capability = 0 | Revision_Level_Indicator = NULL | UMTS_FDD_Radio_Access_Technology_Capability = NULL | UMTS_384_TDD_Radio_Access_Technology_Capability = NULL | CDMA2000_Radio_Access_Technology_Capability = NULL | UMTS_128_TDD_Radio_Access_Technology_Capability = NULL | GERAN_Feature_Package_1 = NULL | Modulation_based_multislot_class_support = NULL | GMSK_MultislotPowerProfile = NULL | EightPSK_MultislotProfile = NULL | MultipleTBF_Capability = NULL | DownlinkAdvancedReceiverPerformance = NULL | ExtendedRLC_MAC_ControlMessageSegmentionsCapability = NULL | DTM_EnhancementsCapability = NULL | PS_HandoverCapability = NULL | DTM_Handover_Capability = NULL | FlexibleTimeslotAssignment = NULL | GAN_PS_HandoverCapability = NULL | RLC_Non_persistentMode = NULL | ReducedLatencyCapability = NULL | UplinkEGPRS2 = NULL | DownlinkEGPRS2 = NULL | EUTRA_FDD_Support = NULL | EUTRA_TDD_Support = NULL | GERAN_To_EUTRAN_supportInGERAN_PTM = NULL | PriorityBasedReselectionSupport = NULL | MS_RA_capability_value } |
DRLCMACDATA NOTICE Got 143 remaining bits unhandled by decoder at the end of bitvec
DCSN1 INFO csnStreamEncoder (RAcap): MS_RA_capability_value { | u.Content = 1 | RF_Power_Capability = 1 | Exist_A5_bits = 0 | ES_IND = 1 | PS = 0 | VGCS = 0 | VBS = 0 | Exist_Multislot_capability = 1 | : Multislot_capability | Exist_HSCSD_multislot_class = 0 | Exist_GPRS_multislot_class = 1 | GPRS_multislot_class = 3 | GPRS_Extended_Dynamic_Allocation_Capability = 0 | Exist_SM = 0 | Exist_ECSD_multislot_class = 0 | Exist_EGPRS_multislot_class = 1 | EGPRS_multislot_class = 0 | EGPRS_Extended_Dynamic_Allocation_Capability = 0 | Exist_DTM_GPRS_multislot_class = 0 | : End Multislot_capability | Exist_Eight_PSK_Power_Capability = 0 | COMPACT_Interference_Measurement_Capability = 0 | Revision_Level_Indicator = 0 | UMTS_FDD_Radio_Access_Technology_Capability = 0 | UMTS_384_TDD_Radio_Access_Technology_Capability = 0 | CDMA2000_Radio_Access_Technology_Capability = 0 | UMTS_128_TDD_Radio_Access_Technology_Capability = 0 | GERAN_Feature_Package_1 = 0 | Exist_Extended_DTM_multislot_class = 0 | Modulation_based_multislot_class_support = 0 | Exist_HighMultislotCapability = 0 | Exist_GERAN_lu_ModeCapability = 0 | GMSK_MultislotPowerProfile = 0 | EightPSK_MultislotProfile = 0 | MultipleTBF_Capability = 0 | DownlinkAdvancedReceiverPerformance = 0 | ExtendedRLC_MAC_ControlMessageSegmentionsCapability = 0 | DTM_EnhancementsCapability = 0 | Exist_DTM_GPRS_HighMultislotClass = 0 | PS_HandoverCapability = 0 | DTM_Handover_Capability = 0 | Exist_DownlinkDualCarrierCapability_r7 = 0 | FlexibleTimeslotAssignment = 0 | GAN_PS_HandoverCapability = 0 | RLC_Non_persistentMode = 0 | ReducedLatencyCapability = 0 | UplinkEGPRS2 = 0 | DownlinkEGPRS2 = 0 | EUTRA_FDD_Support = 0 | EUTRA_TDD_Support = 0 | GERAN_To_EUTRAN_supportInGERAN_PTM = 0 | PriorityBasedReselectionSupport = 0 | u.Content length = 65 | MS_RA_capability_value } |
DRLCMACDATA NOTICE Got 107 remaining bits unhandled by encoder at the end of bitvec
DRLCMACDATA ERROR Failed to encode MS RA Capability IE: not enough bits in the output buffer (rc=107)
DCSN1 INFO csnStreamDecoder (RAcap): MS_RA_capability_value { | Choice MS_RA_capability_value_Choice = 1 | u.Content length = 21 | offset = 4 | RF_Power_Capability = 1 | Exist_A5_bits = 0 | ES_IND = 1 | PS = 0 | VGCS = 0 | VBS = 0 | Exist_Multislot_capability = 1 | : Multislot_capability | Exist_HSCSD_multislot_class = 0 | Exist_GPRS_multislot_class = 1 | GPRS_multislot_class = 3 | GPRS_Extended_Dynamic_Allocation_Capability = 0 | Exist_SM = 0 | Exist_ECSD_multislot_class = 0 | Exist_EGPRS_multislot_class = 1 | DCSN1 ERROR csnStreamDecoder: error NEED_MORE BITS TO UNPACK (-5) at EGPRS_multislot_class (idx 31): End Multislot_capability |

View File

@ -136,7 +136,7 @@ vector1 == vector2 : TRUE
GPRS multislot class = 3
EGPRS multislot class = 0
=== Test encoding of MS RA Capability ===
encode_gsm_ra_cap() returns 0
encode_gsm_ra_cap() returns -5
vector1 (len_ind=29) = 13 a5 14 62 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
vector2 (len_ind=65) = 18 25 14 62 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=== Test decoding of a malformed vector (short length indicator) ===