fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/27755 )

Change subject: rsl: parse_multirate_config(): check if AMR codec is used
......................................................................

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
---
M src/common/rsl.c
1 file changed, 15 insertions(+), 1 deletion(-)

Approvals:
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/rsl.c b/src/common/rsl.c
index 2da954d..961e065 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -1623,8 +1623,22 @@
 {
        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),

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/27755
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I6ddc0b46a268ed56ac727cda57d0d68b2746fd59
Gerrit-Change-Number: 27755
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to