aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-12-24 15:39:08 +0100
committerHarald Welte <laforge@gnumonks.org>2010-12-24 15:42:26 +0100
commiteafe22ca7290280fca0f8d31d70239fd0b0dbb9d (patch)
tree0fc0757956c1f7dc0963c90e6f367d70914709f6 /openbsc/src/gprs
parent2cafc4b30910f244e610e4cf75f72ba360df6ace (diff)
SGSN / GMM: Only allow non-roaming IMSIs
As we do not yet use the HLR from the SGSN, we allow all MS to attach to our GPRS network. However, if this is running in a public environment, it could cause service interruption to users of commercial GPRS networks. Thus, we now check if the first 5 digits of the IMSI match the MCC/MNC of the cell that they want to register to. Thus, any subscribers with SIM cards from real operators will no longer be accepted.
Diffstat (limited to 'openbsc/src/gprs')
-rw-r--r--openbsc/src/gprs/gprs_gmm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 82a4ca85b..158f577a7 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -671,7 +671,16 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
#if 0
return gsm48_tx_gmm_att_rej(msg, GMM_CAUSE_IMSI_UNKNOWN);
#else
- /* As a temorary hack, we simply assume that the IMSI exists */
+ /* As a temorary hack, we simply assume that the IMSI exists,
+ * as long as it is part of 'our' network */
+ char mccmnc[16];
+ snprintf(mccmnc, sizeof(mccmnc), "%03d%02d", ra_id.mcc, ra_id.mnc);
+ if (strncmp(mccmnc, mi_string, 5)) {
+ LOGP(DMM, LOGL_INFO, "Rejecting ATTACH REQUESET IMSI=%s\n",
+ mi_string);
+ return gsm48_tx_gmm_att_rej_oldmsg(msg,
+ GMM_CAUSE_GPRS_NOTALLOWED);
+ }
ctx = sgsn_mm_ctx_alloc(0, &ra_id);
if (!ctx)
return gsm48_tx_gmm_att_rej_oldmsg(msg, GMM_CAUSE_NET_FAIL);