summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-09-29 04:50:06 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-09-29 04:51:11 +0200
commit9aac6b7e73b3da72325a1d04ffab4be019ab4dc4 (patch)
tree9797f19077c12435c6b2a2124a0f449778fbe0e2
parentc6c4f29d9adb7bc29f106a52134a7614f390d7e0 (diff)
sgsn: Make the reject cause configurable for GMM attach and RA updatezecke/hacks/multiple-mnc-mcc
Make the value configurable so we can experiment with broken equipment attempting to do a routing area update with us.
-rw-r--r--openbsc/include/openbsc/sgsn.h3
-rw-r--r--openbsc/src/gprs/gprs_gmm.c8
-rw-r--r--openbsc/src/gprs/sgsn_main.c2
-rw-r--r--openbsc/src/gprs/sgsn_vty.c13
4 files changed, 22 insertions, 4 deletions
diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h
index f7af750..57aeb49 100644
--- a/openbsc/include/openbsc/sgsn.h
+++ b/openbsc/include/openbsc/sgsn.h
@@ -18,6 +18,9 @@ struct sgsn_config {
int acl_enabled;
struct llist_head imsi_acl;
+
+ /* for GMM Routing Area Update handling */
+ int reject_cause;
};
struct sgsn_instance {
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 5513a49..9614152 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -739,7 +739,7 @@ static int gsm48_rx_gmm_att_req(struct sgsn_mm_ctx *ctx, struct msgb *msg,
default:
LOGP(DMM, LOGL_NOTICE, "Rejecting ATTACH REQUEST with "
"MI type %u\n", mi_type);
- return gsm48_tx_gmm_att_rej_oldmsg(msg, GMM_CAUSE_MS_ID_NOT_DERIVED);
+ return gsm48_tx_gmm_att_rej_oldmsg(msg, sgsn->cfg.reject_cause);
}
/* Update MM Context with currient RA and Cell ID */
ctx->ra = ra_id;
@@ -961,7 +961,7 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
/* The MS has to perform GPRS attach */
DEBUGPC(DMM, " REJECT\n");
/* Device is still IMSI atached for CS but initiate GPRS ATTACH */
- return gsm48_tx_gmm_ra_upd_rej(msg, GMM_CAUSE_MS_ID_NOT_DERIVED);
+ return gsm48_tx_gmm_ra_upd_rej(msg, sgsn->cfg.reject_cause);
}
/* Store new BVCI/NSEI in MM context (FIXME: delay until we ack?) */
@@ -1032,7 +1032,7 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
gh->msg_type != GSM48_MT_GMM_RA_UPD_REQ) {
LOGP(DMM, LOGL_NOTICE, "Cannot handle GMM for unknown MM CTX\n");
gprs_llgmm_reset(llme);
- return gsm48_tx_gmm_status_oldmsg(msg, GMM_CAUSE_MS_ID_NOT_DERIVED);
+ return gsm48_tx_gmm_status_oldmsg(msg, sgsn->cfg.reject_cause);
}
switch (gh->msg_type) {
@@ -1135,7 +1135,7 @@ static void mmctx_timer_cb(void *_mm)
case 3370: /* waiting for IDENTITY RESPONSE */
if (mm->num_T_exp >= 5) {
LOGP(DMM, LOGL_NOTICE, "T3370 expired >= 5 times\n");
- gsm48_tx_gmm_att_rej(mm, GMM_CAUSE_MS_ID_NOT_DERIVED);
+ gsm48_tx_gmm_att_rej(mm, sgsn->cfg.reject_cause);
mm->mm_state = GMM_DEREGISTERED;
break;
}
diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c
index 9d42648..87adf07 100644
--- a/openbsc/src/gprs/sgsn_main.c
+++ b/openbsc/src/gprs/sgsn_main.c
@@ -50,6 +50,7 @@
#include <openbsc/sgsn.h>
#include <openbsc/gprs_llc.h>
#include <openbsc/gprs_gmm.h>
+#include <openbsc/gsm_04_08_gprs.h>
#include <gtp.h>
@@ -76,6 +77,7 @@ static struct sgsn_instance sgsn_inst = {
.cfg = {
.gtp_statedir = "./",
.acl_enabled = 1,
+ .reject_cause = GMM_CAUSE_MS_ID_NOT_DERIVED,
},
};
struct sgsn_instance *sgsn = &sgsn_inst;
diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c
index a4ba280..1fcaad1 100644
--- a/openbsc/src/gprs/sgsn_vty.c
+++ b/openbsc/src/gprs/sgsn_vty.c
@@ -135,6 +135,8 @@ static int config_write_sgsn(struct vty *vty)
g_cfg->acl_enabled ? "closed" : "accept-all", VTY_NEWLINE);
llist_for_each_entry(acl, &g_cfg->imsi_acl, list)
vty_out(vty, " imsi-acl add %s%s", acl->imsi, VTY_NEWLINE);
+ vty_out(vty, " reject-cause %d%s",
+ g_cfg->reject_cause, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -408,6 +410,16 @@ DEFUN(cfg_auth_policy, cfg_auth_policy_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_mm_reject_cause, cfg_mm_reject_cause_cmd,
+ "reject-cause <0-65535>",
+ "Reject cause for routing area updates with unknown IMSI\n"
+ "Cause Value\n")
+{
+ g_cfg->reject_cause = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+
int sgsn_vty_init(void)
{
install_element_ve(&show_sgsn_cmd);
@@ -427,6 +439,7 @@ int sgsn_vty_init(void)
install_element(SGSN_NODE, &cfg_ggsn_gtp_version_cmd);
install_element(SGSN_NODE, &cfg_imsi_acl_cmd);
install_element(SGSN_NODE, &cfg_auth_policy_cmd);
+ install_element(SGSN_NODE, &cfg_mm_reject_cause_cmd);
return 0;
}