aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gprs_gmm.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-05-18 10:00:03 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-05-24 12:32:23 +0800
commit8ee13e293739870364e83ea54d61818fb5e44381 (patch)
treece3115b6ade0d7ced838163efa5b9e9f2627378b /openbsc/src/gprs/gprs_gmm.c
parent10c0f56a0e109054a480d4affcde73dc6affbb56 (diff)
sgsn: Extract the hlr Number into the mm context
Include the hlr-Number of the subscriber in the CDR. This is useful for debugging and understanding which equipment was used during the test. In contrast to the MSISDN the '+' is emitted as the number must be in international format already.
Diffstat (limited to 'openbsc/src/gprs/gprs_gmm.c')
-rw-r--r--openbsc/src/gprs/gprs_gmm.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 8ada3d41b..b17873e89 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -578,6 +578,43 @@ static void extract_subscr_msisdn(struct sgsn_mm_ctx *ctx)
}
}
+static void extract_subscr_hlr(struct sgsn_mm_ctx *ctx)
+{
+ struct gsm_mncc_number called;
+ uint8_t hlr_number[sizeof(ctx->subscr->sgsn_data->hlr) + 1];
+
+ if (!ctx->subscr)
+ return;
+
+ if (ctx->subscr->sgsn_data->hlr_len < 1)
+ return;
+
+ /* prepare the data for the decoder */
+ memset(&called, 0, sizeof(called));
+ hlr_number[0] = ctx->subscr->sgsn_data->hlr_len;
+ memcpy(&hlr_number[1], ctx->subscr->sgsn_data->hlr,
+ ctx->subscr->sgsn_data->hlr_len);
+
+ /* decode the string now */
+ gsm48_decode_called(&called, hlr_number);
+
+ if (called.plan != 1) {
+ LOGMMCTXP(LOGL_ERROR, ctx,
+ "Numbering plan(%d) not allowed\n",
+ called.plan);
+ return;
+ }
+
+ if (called.type != 1) {
+ LOGMMCTXP(LOGL_ERROR, ctx,
+ "Numbering type(%d) not allowed\n",
+ called.type);
+ return;
+ }
+
+ strncpy(&ctx->hlr[0], called.number, sizeof(ctx->hlr) - 1);
+}
+
/* Check if we can already authorize a subscriber */
static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx)
{
@@ -643,6 +680,7 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx)
case GSM48_MT_GMM_ATTACH_REQ:
extract_subscr_msisdn(ctx);
+ extract_subscr_hlr(ctx);
#ifdef PTMSI_ALLOC
/* Start T3350 and re-transmit up to 5 times until ATTACH COMPLETE */
mmctx_timer_start(ctx, 3350, GSM0408_T3350_SECS);