falconia has uploaded this change for review.

View Change

rtp2trau FR & EFR: disallow BFI in DL

osmo_rtp2trau() accepts TW-TS-001 extended RTP payload format for
FR and EFR, converting to either TRAU-DL or TRAU-UL. This extended
format is required for TRAU-UL/TFO frame output, but it is also
accepted for conversion to TRAU-DL in order to support the current
form of OsmoMGW-E1 that has no TFO transform between RTP input and
TDM-timed calls to osmo_rtp2trau().

TW-TS-001 can represent not only good frames, but also bad ones -
however, bad frames on Abis are valid only in UL, not in DL. Prior
to the present patch, if a BFI-marked frame were fed to osmo_rtp2trau()
for conversion to TRAU-DL, the Bad Frame Indicator was dropped and
the garbage payload bits were emitted as if they were a good frame -
bad choice. Reject BFI frames in TRAU-DL mode, return -EINVAL.

Change-Id: Ic63943d4bde9902b27e4d8fe9a5fb6ccecbf36c6
---
M src/trau/trau_rtp_conv.c
1 file changed, 9 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/25/39625/1
diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c
index 8d2631b..1114aaf 100644
--- a/src/trau/trau_rtp_conv.c
+++ b/src/trau/trau_rtp_conv.c
@@ -586,6 +586,10 @@
if ((data[0] & 0xF0) != 0xD0)
return -EINVAL;

+ /* bad frames are only allowed in UL */
+ if (bfi && tf->dir != OSMO_TRAU_DIR_UL)
+ return -EINVAL;
+
tf->type = OSMO_TRAU16_FT_FR;

/* FR Data Bits according to TS 48.060 Section 5.5.1.1.2 */
@@ -894,6 +898,10 @@
if ((data[0] & 0xF0) != 0xC0)
return -EINVAL;

+ /* bad frames are only allowed in UL */
+ if (bfi && tf->dir != OSMO_TRAU_DIR_UL)
+ return -EINVAL;
+
tf->type = OSMO_TRAU16_FT_EFR;

/* FR Data Bits according to TS 48.060 Section 5.5.1.1.2 */
@@ -1566,6 +1574,7 @@
* - RTP payload formats of RFC 5993, TW-TS-001 and TW-TS-002 are accepted
* by the function - however, all metadata flags carried by the header octet
* of these extended formats are ignored/dropped in the DL direction.
+ * BFI frames are not allowed in DL.
*
* - The most native RTP input formats for conversion to TRAU-DL are those
* defined in ETSI TS 101 318 for FR, HR and EFR; the ones for FR and EFR

To view, visit change 39625. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: Ic63943d4bde9902b27e4d8fe9a5fb6ccecbf36c6
Gerrit-Change-Number: 39625
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon@freecalypso.org>