csn1: Add unit test showing RadioAccess Capability decoding failure

This RA Cap creaes a decoding error on our CSN1 decoder, but seems to be
handled properly by wireshark's own decoder as well as pycrate.

The ending bit of last byte in "MS RA capability 1" has a "1" which
according to spec should flag the existance of
DownlinkDualCarrierCapability_r7, but nothing else comes after it. This
matches the expectancies as per Length field of the first RA Cap.

Related: SYS#5552
Related: OS#4955
Related: OS#5020
Change-Id: I51235e8575f4b992b44078713ec67bbccfd13293
This commit is contained in:
Pau Espin 2021-10-07 18:30:30 +02:00
parent c90e6f8de1
commit 089d734cd1
3 changed files with 150 additions and 0 deletions

View File

@ -676,6 +676,148 @@ MS Radio Access Capability
bitvec_free(bv_dec);
}
/* RAcap larger than 23 bytes */
void testRAcap4(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
bitvec *bv_dec = bitvec_alloc(22, test_ctx);
int rc;
/*
MS Radio Access Capability
Element ID: 0x13
1... .... = ext: 1
Length: 22
------------------------------------------- Hex bitstream starts here:
MS RA capability 1
0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
.... 0111 101. .... = Length in bits: 0x3d (61)
...1 00.. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: A5 bits follow (1)
A5/1: encryption algorithm available (1)
A5/2: encryption algorithm not available (0)
A5/3: encryption algorithm available (1)
A5/4: encryption algorithm not available (0)
A5/5: encryption algorithm not available (0)
A5/6: encryption algorithm not available (0)
A5/7: encryption algorithm not available (0)
.... ..1. = Controlled early Classmark Sending: Implemented
.... ...1 = Pseudo Synchronisation: Present
0... .... = Voice Group Call Service: no VGCS capability or no notifications wanted
.0.. .... = Voice Broadcast Service: no VBS capability or no notifications wanted
..1. .... = Multislot capability struct: Present
HSCSD multislot class: Bits are not available (0)
SMS_VALUE (Switch-Measure-Switch): Bits are not available (0)
ECSD multislot class: Bits are not available (0)
DTM GPRS Multi Slot Class: Bits are not available (0)
.... .011 00.. .... = GPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
..1. .... = GPRS Extended Dynamic Allocation Capability: Implemented
.... ..01 100. .... = EGPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
...1 .... = EGPRS Extended Dynamic Allocation Capability: Implemented
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..1. .... = UMTS FDD Radio Access Technology Capability: Supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
..0. .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... ...0 = Multiple TBF Capability: Not supported
00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0)
..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... .0.. = PS Handover Capability: Not supported
.... ..0. = DTM Handover Capability: Not supported
MS RA capability 2
.001 1... = Access Technology Type: GSM 1800 (3)
.... .010 0100 .... = Length in bits: 0x24 (36)
.... 001. RF Power Capability, GMSK Power Class: 1 W (30 dBm) (1)
A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
1... .... = Controlled early Classmark Sending: Implemented
.1.. .... = Pseudo Synchronisation: Present
..0. .... = Voice Group Call Service: no VGCS capability or no notifications wanted
...0 .... = Voice Broadcast Service: no VBS capability or no notifications wanted
.... 0... = Multislot capability struct: Not Present
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..1. .... = UMTS FDD Radio Access Technology Capability: Supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
..0. .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... ...0 = Multiple TBF Capability: Not supported
00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0)
..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... .0.. = PS Handover Capability: Not supported
.... ..0. = DTM Handover Capability: Not supported
MS RA capability 3
.011 1... = Access Technology Type: GSM 850 (7)
.... .010 0100 .... = Length in bits: 0x24 (36)
.... 100. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
1... .... = Controlled early Classmark Sending: Implemented
.1.. .... = Pseudo Synchronisation: Present
..0. .... = Voice Group Call Service: no VGCS capability or no notifications wanted
...0 .... = Voice Broadcast Service: no VBS capability or no notifications wanted
.... 0... = Multislot capability struct: Not Present
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..1. .... = UMTS FDD Radio Access Technology Capability: Supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
..0. .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... ...0 = Multiple TBF Capability: Not supported
00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0)
..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... .0.. = PS Handover Capability: Not supported
.... ..0. = DTM Handover Capability: Not supported
*/
bitvec_unhex(bv_dec, "17b3432b25966200019a42c6620001ba48c662000100");
printf("=== Test decoding of MS RA Capability 4===\n");
rc = decode_gsm_ra_cap(bv_dec, &data);
printf("decode_gsm_ra_cap() returns %d\n", rc);
OSMO_ASSERT(rc == -5); /* FIXME: should be 0 */
/* Make sure there's 3 values */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 0); /* FIXME: should be 3 */
/* Make sure GPRS / EGPRS multislot class is parsed correctly */
printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data)); /* FIXME: should be 12 */
printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data)); /* FIXME: should be 12 */
bitvec_free(bv_dec);
}
void testEGPRSPktChReq(void *test_ctx)
{
EGPRS_PacketChannelRequest_t req;
@ -752,5 +894,7 @@ int main(int argc, char *argv[])
testEGPRSPktChReq(ctx);
testRAcap4(ctx);
talloc_free(ctx);
}

View File

@ -58,3 +58,4 @@ DCSN1 DEBUG csnStreamDecoder (EGPRS Packet Channel Request): Choice EGPRS_Packet
DCSN1 DEBUG csnStreamDecoder (EGPRS Packet Channel Request): Choice EGPRS_PacketChannelRequest_Choice = 51 | : Content | RandomBits = 17 | : End Content |
DCSN1 DEBUG csnStreamDecoder (EGPRS Packet Channel Request): Choice EGPRS_PacketChannelRequest_Choice = 55 | : Content | RandomBits = 25 | : End Content |
DCSN1 DEBUG csnStreamDecoder (EGPRS Packet Channel Request): DCSN1 ERROR csnStreamDecoder: error STREAM_NOT_SUPPORTED (-8) at EGPRS_PacketChannelRequest_Choice (idx 0)
DCSN1 INFO csnStreamDecoder (RAcap): MS_RA_capability_value { | Choice MS_RA_capability_value_Choice = 1 | u.Content length = 61 | offset = 1 | RF_Power_Capability = 4 | Exist_A5_bits = 1 | A5_bits = 80 | ES_IND = 1 | PS = 1 | VGCS = 0 | VBS = 0 | Exist_Multislot_capability = 1 | : Multislot_capability | Exist_HSCSD_multislot_class = 0 | Exist_GPRS_multislot_class = 1 | GPRS_multislot_class = 12 | GPRS_Extended_Dynamic_Allocation_Capability = 1 | Exist_SM = 0 | Exist_ECSD_multislot_class = 0 | Exist_EGPRS_multislot_class = 1 | EGPRS_multislot_class = 12 | EGPRS_Extended_Dynamic_Allocation_Capability = 1 | Exist_DTM_GPRS_multislot_class = 0 | : End Multislot_capability | Exist_Eight_PSK_Power_Capability = 1 | Eight_PSK_Power_Capability = 2 | COMPACT_Interference_Measurement_Capability = 0 | Revision_Level_Indicator = 1 | UMTS_FDD_Radio_Access_Technology_Capability = 1 | 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 = 1 | 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 = 1 | : DownlinkDualCarrierCapability_r7 | DCSN1 ERROR csnStreamDecoder: error NEED_MORE BITS TO UNPACK (-5) at MultislotCapabilityReductionForDL_DualCarrier (idx 72): End DownlinkDualCarrierCapability_r7 |

View File

@ -212,3 +212,8 @@ decode_egprs_pkt_ch_req(0x671) returns 0
decode_egprs_pkt_ch_req(0x6f9) returns 0
==> Emergency call
decode_egprs_pkt_ch_req(0x7ea) returns -8
*** testRAcap4 ***
=== Test decoding of MS RA Capability 4===
decode_gsm_ra_cap() returns -5
GPRS multislot class = 0
EGPRS multislot class = 0