fix bts_supports_cm(): properly check feature flags for VGCS/VBS

cm->spd_ind can take only three values defined in enum rsl_cmod_spd:

  0000 0001   RSL_CMOD_SPD_SPEECH
  0000 0010   RSL_CMOD_SPD_DATA
  0000 0011   RSL_CMOD_SPD_SIGN

According to 3GPP TS 48.058, section 9.3.6, all other values are
reserved, so expecting RSL_CMOD_CRT_TCH_{GROUP,BCAST}_{Lm,Bm} there
is wrong.  These values are part of enum rsl_cmod_crt, so the right
field would be not cm->spd_ind, but cm->chan_rt.

Let's check these channel types in a separate stage, before checking
the requested codec.  Group them with VAMOS specific types for the
sake of consistency.

Change-Id: I914c84be04da819df9e60e2f5ecc5bac9b61b2e5
Fixes: 44c94fdea "validate RSL "channel rate and type" against VGCS/VBS flags"
Related: OS#4851
This commit is contained in:
Vadim Yanitskiy 2023-07-11 03:40:07 +07:00
parent 84d220abc1
commit 2bdb2201f6
1 changed files with 16 additions and 14 deletions

View File

@ -791,6 +791,13 @@ bool bts_supports_cm(const struct gsm_bts *bts,
return true;
case RSL_CMOD_SPD_SPEECH:
break;
case RSL_CMOD_SPD_DATA:
default:
return false;
}
/* Stage 1: check support for the requested channel type */
switch (cm->chan_rt) {
case RSL_CMOD_CRT_TCH_GROUP_Bm:
case RSL_CMOD_CRT_TCH_GROUP_Lm:
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VGCS))
@ -801,21 +808,19 @@ bool bts_supports_cm(const struct gsm_bts *bts,
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VBS))
return false;
break;
case RSL_CMOD_SPD_DATA:
default:
return false;
}
/* Before the requested pchan/cm combination can be checked, we need to
* convert it to a feature identifier we can check */
switch (cm->chan_rt) {
case RSL_CMOD_CRT_OSMO_TCH_VAMOS_Bm:
case RSL_CMOD_CRT_OSMO_TCH_VAMOS_Lm:
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VAMOS))
return false;
/* fall-through */
case RSL_CMOD_CRT_TCH_Bm:
break;
}
/* Stage 2: check support for the requested codec */
switch (cm->chan_rt) {
case RSL_CMOD_CRT_OSMO_TCH_VAMOS_Bm:
case RSL_CMOD_CRT_TCH_GROUP_Bm:
case RSL_CMOD_CRT_TCH_BCAST_Bm:
case RSL_CMOD_CRT_TCH_Bm:
switch (cm->chan_rate) {
case RSL_CMOD_SP_GSM1:
feature = BTS_FEAT_SPEECH_F_V1;
@ -833,12 +838,9 @@ bool bts_supports_cm(const struct gsm_bts *bts,
break;
case RSL_CMOD_CRT_OSMO_TCH_VAMOS_Lm:
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VAMOS))
return false;
/* fall-through */
case RSL_CMOD_CRT_TCH_Lm:
case RSL_CMOD_CRT_TCH_GROUP_Lm:
case RSL_CMOD_CRT_TCH_BCAST_Lm:
case RSL_CMOD_CRT_TCH_Lm:
switch (cm->chan_rate) {
case RSL_CMOD_SP_GSM1:
feature = BTS_FEAT_SPEECH_H_V1;