summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-07-21 15:58:44 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2019-07-21 16:05:28 +0700
commite6f5a88463ebab9abbe43433a032c63d26558736 (patch)
treee2a8d8169eab295632b438873006e81e54239701 /src
parentcfd28d5e29c29019e91c734d770c0c0c0f83574f (diff)
mobile/gsm480_ss.c: gsm480_tx_release_compl(): fix cause IE encoding
According to GSM TS 04.08, section 10.5.4.11, location and coding standard are encoded before the cause value, not vice-versa! Also, coding standards other than "1 1 - Standard defined for the GSM PLMNs" shall not be used if the cause can be represented with the GSM standardized coding. Change-Id: Ic6abcfb9a9589f5b0c9c40def863f15ae04d0bdd
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/src/mobile/gsm480_ss.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/host/layer23/src/mobile/gsm480_ss.c b/src/host/layer23/src/mobile/gsm480_ss.c
index b114aa63..52e43b9b 100644
--- a/src/host/layer23/src/mobile/gsm480_ss.c
+++ b/src/host/layer23/src/mobile/gsm480_ss.c
@@ -397,12 +397,17 @@ static int gsm480_tx_release_compl(struct gsm_trans *trans, uint8_t cause)
gh->proto_discr = GSM48_PDISC_NC_SS | (trans->transaction_id << 4);
gh->msg_type = GSM0480_MTYPE_RELEASE_COMPLETE;
+ /* GSM 04.08, section 10.5.4.11 */
if (cause) {
uint8_t *tlv = msgb_put(msg, 4);
tlv[0] = GSM48_IE_CAUSE;
tlv[1] = 2;
- tlv[2] = 0x80 | cause;
- tlv[3] = 0x80 | GSM48_CAUSE_LOC_USER;
+
+ /* Coding standard defined for the GSM PLMNs,
+ * location - USER, cause as given by caller,
+ * no extension, no diagnostics. */
+ tlv[2] = (1 << 7) | (0x03 << 5) | (GSM48_CAUSE_LOC_USER & 0x0f);
+ tlv[3] = (1 << 7) | cause;
}
return gsm480_to_mm(msg, trans, GSM48_MMSS_DATA_REQ);
}