falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/37181?usp=email )
Change subject: trau2rtp_hr16: check CRC bits in the TRAU frame ......................................................................
trau2rtp_hr16: check CRC bits in the TRAU frame
If CRC bits in the received TRAU frame are bad, the implication is that this frame must have got corrupted in E1 transport. In this case all other bits cannot be trusted, and we should deliver BFI-no-data to RTP.
Change-Id: I4f97b67884ff7540be631298e5252d28f765fce9 --- M src/trau/trau_rtp_conv.c 1 file changed, 21 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/81/37181/1
diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c index 8681ead..a1fea32 100644 --- a/src/trau/trau_rtp_conv.c +++ b/src/trau/trau_rtp_conv.c @@ -186,6 +186,7 @@ static int trau2rtp_hr16(uint8_t *out, size_t out_len, const struct osmo_trau_frame *tf, bool emit_twts002) { enum osmo_gsm631_sid_class sidc; + int rc;
if (tf->type != OSMO_TRAU16_FT_HR) return -EINVAL; @@ -195,6 +196,12 @@
/* HR Data Bits according to TS 48.061 Section 5.1.4.1.1 */
+ /* bad CRC means bad frame, no matter what else is going on */ + rc = osmo_crc8gen_check_bits(&gsm0860_efr_crc3, tf->d_bits, 44, + tf->crc_bits); + if (rc) + goto bad_frame; + sidc = (tf->c_bits[12] << 1) | tf->c_bits[13]; /* both C13 and C14 being set is invalid combination */ if (sidc > OSMO_GSM631_SID_CLASS_VALID)