aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs/sgsn_auth.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-02-21 00:39:36 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-03-15 19:18:14 +0100
commit10719b74c362591cd01c3766f74ef03639203e1d (patch)
tree4e0fed5a071f24099c9b565e11fe02f4af3f8774 /src/gprs/sgsn_auth.c
parent5926e840ccdea595fb63e0a51e3069882e4ce73c (diff)
implement support for 3-digit MNC with leading zeros
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout the code base to be able to handle an MNC < 100 that has three digits (leading zeros). Note that in gbproxy_test.ok, 0-0 changes to 000-000 instead of 000-00, because the parsed ra buffer is 000000 which results in 000-000, while 00f000 would result in 000-00. IOW this is expected. Change-Id: I7437dfaa586689e2bef0d4be6537e5577a8f6c26
Diffstat (limited to 'src/gprs/sgsn_auth.c')
-rw-r--r--src/gprs/sgsn_auth.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gprs/sgsn_auth.c b/src/gprs/sgsn_auth.c
index 92712ef98..6fb32b711 100644
--- a/src/gprs/sgsn_auth.c
+++ b/src/gprs/sgsn_auth.c
@@ -133,9 +133,10 @@ enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mmctx)
if (check_net) {
/* We simply assume that the IMSI exists, as long as it is part
* of 'our' network */
- snprintf(mccmnc, sizeof(mccmnc), "%03d%02d",
- mmctx->ra.mcc, mmctx->ra.mnc);
- if (strncmp(mccmnc, mmctx->imsi, 5) == 0)
+ snprintf(mccmnc, sizeof(mccmnc), "%s%s",
+ osmo_mcc_name(mmctx->ra.mcc),
+ osmo_mnc_name(mmctx->ra.mnc, mmctx->ra.mnc_3_digits));
+ if (strncmp(mccmnc, mmctx->imsi, mmctx->ra.mnc_3_digits ? 6 : 5) == 0)
return SGSN_AUTH_ACCEPTED;
}