diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-04-12 02:09:07 +0300 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-04-12 02:28:35 +0300 |
commit | ab4ab481781caab3a5485d2bad0efc0574c408e9 (patch) | |
tree | c6666f1d7300214b337f4a4431b74a93cbad3b06 | |
parent | e3ff3bc4e090917f02288fba9a6ef112227f7fc9 (diff) |
rsl: parse_multirate_config(): check if AMR codec is used
3GPP TS 48.058 defines the MultiRate configuration IE as optional,
and states that it's "included if the Channel Mode indicates that a
multi-rate codec is used". If I understand this correctly, it may
be omitted even if a multi-rate codec is requested. Otherwise it
would have been defined as a conditional IE.
For now let's print a warnig if this IE was expected, but missing.
We may need to apply some hard-coded defaults in this case.
If this IE is present, but the Channel Mode indicates a codec other
than AMR, let's send NACK with cause=RSL_ERR_OPT_IE_ERROR, assuming
that the CHAN ACT/MODIFY message is malformed.
Change-Id: I6ddc0b46a268ed56ac727cda57d0d68b2746fd59
Related: SYS#5917, OS#4984
-rw-r--r-- | src/common/rsl.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c index 2da954d3..961e0657 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -1623,8 +1623,22 @@ static int parse_multirate_config(struct gsm_lchan *lchan, { int rc; - if (!TLVP_PRESENT(tp, RSL_IE_MR_CONFIG)) + if (!TLVP_PRESENT(tp, RSL_IE_MR_CONFIG)) { + /* Included if the Channel Mode indicates that a multi-rate codec is used */ + if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) { + LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Missing MultiRate conf IE " + "(TCH mode is %s)\n", gsm48_chan_mode_name(lchan->tch_mode)); + /* TODO: init lchan->tch.amr_mr with some default values */ + } return 0; + } + + /* Included if the Channel Mode indicates that a multi-rate codec is used */ + if (lchan->tch_mode != GSM48_CMODE_SPEECH_AMR) { + LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Unexpected MultiRate conf IE " + "(TCH mode is %s)\n", gsm48_chan_mode_name(lchan->tch_mode)); + return -RSL_ERR_OPT_IE_ERROR; + } rc = amr_parse_mr_conf(&lchan->tch.amr_mr, TLVP_VAL(tp, RSL_IE_MR_CONFIG), |