gsm48_ie: fix parsing of Bearer capability IE without octet 3a

The testcase in gsm0408_test is still failing because the encoder
produces a different result (with octet 3a present).  There is no
way to tell the encoder to use the implicit coding, and in general
this is not that critical, so we can live with that.

Change-Id: I722c168f01bffa915cb155eac234a796549d3762
This commit is contained in:
Mychaela Falconia 2022-07-03 05:15:30 +07:00 committed by Vadim Yanitskiy
parent 384e6a340c
commit 605c9e63bb
2 changed files with 20 additions and 3 deletions

View File

@ -203,6 +203,23 @@ int gsm48_decode_bearer_cap(struct gsm_mncc_bearer_cap *bcap,
case GSM_MNCC_BCAP_SPEECH:
i = 1;
s = 0;
if ((lv[1] & 0x80) != 0) { /* octet 3a is absent */
switch (bcap->radio) {
case GSM48_BCAP_RRQ_FR_ONLY:
bcap->speech_ver[s++] = GSM48_BCAP_SV_FR;
break;
case GSM48_BCAP_RRQ_DUAL_HR:
bcap->speech_ver[s++] = GSM48_BCAP_SV_HR;
bcap->speech_ver[s++] = GSM48_BCAP_SV_FR;
break;
case GSM48_BCAP_RRQ_DUAL_FR:
bcap->speech_ver[s++] = GSM48_BCAP_SV_FR;
bcap->speech_ver[s++] = GSM48_BCAP_SV_HR;
break;
}
bcap->speech_ver[s] = -1; /* end of list */
return 0;
}
while (!(lv[i] & 0x80)) {
i++; /* octet 3a etc */
if (in_len < i)

View File

@ -1,3 +1,3 @@
Incorrect decoded result of Speech, without octet 3a:
should: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
is: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Incorrect encoded result of Speech, without octet 3a:
should: 01 a0
is: 02 20 80