gsm0808_enc/dec_channel_type: fix transparent flag

According to 3GPP TS 48.008 3.2.2.11, it is inverted.

0: Transparent service
1: Non-transparent service

Change-Id: I2e5786ad053ee871079b4a8d95caccd6b03b59b6
This commit is contained in:
Oliver Smith 2023-02-27 10:28:40 +01:00 committed by osmith
parent 6345333fb1
commit 57d4fae832
2 changed files with 7 additions and 7 deletions

View File

@ -510,7 +510,7 @@ uint8_t gsm0808_enc_channel_type(struct msgb *msg,
case GSM0808_CHAN_DATA:
byte = ct->data_rate;
if (ct->data_transparent)
if (!ct->data_transparent)
byte |= 0x40; /* Set T/NT */
if (ct->data_rate_allowed_is_set) {
@ -580,7 +580,7 @@ int gsm0808_dec_channel_type(struct gsm0808_channel_type *ct,
case GSM0808_CHAN_DATA:
byte = *elem;
elem++;
ct->data_transparent = byte & 0x40; /* T/NT */
ct->data_transparent = !(byte & 0x40); /* T/NT */
ct->data_rate = byte & 0x3f;
/* Optional extension for non-transparent service */

View File

@ -1098,7 +1098,7 @@ static void test_gsm0808_enc_dec_channel_type_data(void)
struct gsm0808_channel_type dec_ct = {};
struct msgb *msg;
uint8_t ct_enc_expected[] = { GSM0808_IE_CHANNEL_TYPE,
0x03, 0x02, 0x0b, 0x51,
0x03, 0x02, 0x0b, 0x11,
};
uint8_t rc_enc;
int rc_dec;
@ -1142,7 +1142,7 @@ static void test_gsm0808_enc_dec_channel_type_data_asym_pref(void)
struct gsm0808_channel_type dec_ct = {};
struct msgb *msg;
uint8_t ct_enc_expected[] = { GSM0808_IE_CHANNEL_TYPE,
0x05, 0x02, 0x0b, 0x91, 0x8b, 0x20,
0x05, 0x02, 0x0b, 0xd1, 0x8b, 0x20,
};
uint8_t rc_enc;
int rc_dec;
@ -1237,17 +1237,17 @@ static void test_gsm0808_dec_channel_type_err(void)
OSMO_ASSERT(rc == -ENOTSUP);
/* Data: ext in Octet 5 with transparent service */
const uint8_t hex2[] = { 0x02, 0x0b, 0xc0, 0x00 };
const uint8_t hex2[] = { 0x02, 0x0b, 0x80, 0x00 };
rc = gsm0808_dec_channel_type(&ct, hex2, sizeof(hex2));
OSMO_ASSERT(rc == -EINVAL);
/* Data: ext in Octet 5, but too short */
const uint8_t hex3[] = { 0x02, 0x0b, 0x80 };
const uint8_t hex3[] = { 0x02, 0x0b, 0xc0 };
rc = gsm0808_dec_channel_type(&ct, hex3, sizeof(hex3));
OSMO_ASSERT(rc == -EOVERFLOW);
/* Data: ext in Octet 5a, but too short */
const uint8_t hex4[] = { 0x02, 0x0b, 0x80, 0x80 };
const uint8_t hex4[] = { 0x02, 0x0b, 0xc0, 0x80 };
rc = gsm0808_dec_channel_type(&ct, hex4, sizeof(hex4));
OSMO_ASSERT(rc == -EOVERFLOW);