summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Eversberg2010-07-12 09:12:46 +0200
committerHarald Welte2010-07-12 09:12:46 +0200
commited00fe4449ac2309ad80c32f0ba7aa80b2b8895a (patch)
treeea24a8e5b4690c693edaefd6035175ff7022b9b6 /src
parentAdded new IE definitions to gsm_04_08.h of libosmocore. (diff)
downloadlibosmocore-ed00fe4449ac2309ad80c32f0ba7aa80b2b8895a.tar.gz
libosmocore-ed00fe4449ac2309ad80c32f0ba7aa80b2b8895a.tar.xz
libosmocore-ed00fe4449ac2309ad80c32f0ba7aa80b2b8895a.zip
Add 3-digit MNC support to gsm48_generate_lai()
Diffstat (limited to 'src')
-rw-r--r--src/gsm48.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gsm48.c b/src/gsm48.c
index 756a182..daec4f3 100644
--- a/src/gsm48.c
+++ b/src/gsm48.c
@@ -272,13 +272,13 @@ void gsm48_generate_lai(struct gsm48_loc_area_id *lai48, uint16_t mcc,
to_bcd(bcd, mnc);
/* FIXME: do we need three-digit MNC? See Table 10.5.3 */
-#if 0
- lai48->digits[1] |= bcd[2] << 4;
- lai48->digits[2] = bcd[0] | (bcd[1] << 4);
-#else
- lai48->digits[1] |= 0xf << 4;
- lai48->digits[2] = bcd[1] | (bcd[2] << 4);
-#endif
+ if (mnc > 99) {
+ lai48->digits[1] |= bcd[2] << 4;
+ lai48->digits[2] = bcd[0] | (bcd[1] << 4);
+ } else {
+ lai48->digits[1] |= 0xf << 4;
+ lai48->digits[2] = bcd[1] | (bcd[2] << 4);
+ }
lai48->lac = htons(lac);
}