From 10719b74c362591cd01c3766f74ef03639203e1d Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 21 Feb 2018 00:39:36 +0100 Subject: 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 --- src/gprs/sgsn_auth.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/gprs/sgsn_auth.c') 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; } -- cgit v1.2.3