summaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm48.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-12-05 23:24:50 +0100
committerHarald Welte <laforge@gnumonks.org>2018-12-10 17:06:30 +0000
commit23187fa108f094b2ed9d497380b63235592477b2 (patch)
tree594a7c16a36760270a8a2ec73c000ff162291508 /src/gsm/gsm48.c
parent627e0113d142c91eaf9a750ab76b722bb776b1ce (diff)
gsm48_generate_mid(): mask out ODD flag from mi_type
For MI encoding, see 3GPP TS 24.008, 10.5.1.4 Mobile Identity. The 'odd' flag indicates whether the last BCD nibble is used. Of course that flag should be made sure to reflect the actual length. Change-Id: Id6e695ebf9f86b295eaa7e2c6228989256f37e68
Diffstat (limited to 'src/gsm/gsm48.c')
-rw-r--r--src/gsm/gsm48.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index 4558dfb6..0f0889b4 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -611,7 +611,7 @@ uint8_t gsm48_generate_mid(uint8_t *buf, const char *id, uint8_t mi_type)
uint8_t length = strnlen(id, 255), i, off = 0, odd = (length & 1) == 1;
buf[0] = GSM48_IE_MOBILE_ID;
- buf[2] = osmo_char2bcd(id[0]) << 4 | mi_type | (odd << 3);
+ buf[2] = osmo_char2bcd(id[0]) << 4 | (mi_type & GSM_MI_TYPE_MASK) | (odd << 3);
/* if the length is even we will fill half of the last octet */
buf[1] = (length + (odd ? 1 : 2)) >> 1;