aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-12-19 18:08:48 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-01-18 13:23:13 +0100
commit771573c535ae97ce7c7ed7694670e3b98eeae48a (patch)
treeb352cd778657c7e498f6675be0deea246cc0da1b /openbsc
parenta071c1ccc07074272f6cb7626b781f45f85564c6 (diff)
sgsn: Add global require_update_location flag
This flag is used to determine, whether the Update Location procedure shall be invoked. This is currently only set, when the 'remote' authorization policy is set. When the flag is set, sgsn_auth_update will not never be called directly by sgsn_auth_request, if an Attach Request procedure is pending, even if the remote connection fails for some reason. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/sgsn.h1
-rw-r--r--openbsc/src/gprs/sgsn_auth.c11
-rw-r--r--openbsc/src/gprs/sgsn_vty.c1
-rw-r--r--openbsc/tests/sgsn/sgsn_test.c2
4 files changed, 11 insertions, 4 deletions
diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h
index 798bfde48..78064dddc 100644
--- a/openbsc/include/openbsc/sgsn.h
+++ b/openbsc/include/openbsc/sgsn.h
@@ -32,6 +32,7 @@ struct sgsn_config {
int gsup_server_port;
int require_authentication;
+ int require_update_location;
};
struct sgsn_instance {
diff --git a/openbsc/src/gprs/sgsn_auth.c b/openbsc/src/gprs/sgsn_auth.c
index 83372e857..9cc67db1c 100644
--- a/openbsc/src/gprs/sgsn_auth.c
+++ b/openbsc/src/gprs/sgsn_auth.c
@@ -161,9 +161,9 @@ int sgsn_auth_request(struct sgsn_mm_ctx *mmctx)
return 0;
}
- need_update_location =
- mmctx->subscr == NULL ||
- mmctx->pending_req == GSM48_MT_GMM_ATTACH_REQ;
+ need_update_location = sgsn->cfg.require_update_location &&
+ (mmctx->subscr == NULL ||
+ mmctx->pending_req == GSM48_MT_GMM_ATTACH_REQ);
/* This has the side effect of registering the subscr with the mmctx */
subscr = gprs_subscr_get_or_create_by_mmctx(mmctx);
@@ -191,8 +191,11 @@ int sgsn_auth_request(struct sgsn_mm_ctx *mmctx)
} else if (need_update_location) {
LOGMMCTXP(LOGL_INFO, mmctx,
"Missing information, requesting subscriber data\n");
- if (gprs_subscr_request_update_location(mmctx) >= 0)
+ rc = gprs_subscr_request_update_location(mmctx);
+ if (rc >= 0)
return 0;
+
+ return rc;
}
sgsn_auth_update(mmctx);
diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c
index 3ca1570b9..d847d9173 100644
--- a/openbsc/src/gprs/sgsn_vty.c
+++ b/openbsc/src/gprs/sgsn_vty.c
@@ -377,6 +377,7 @@ DEFUN(cfg_auth_policy, cfg_auth_policy_cmd,
OSMO_ASSERT(val >= SGSN_AUTH_POLICY_OPEN && val <= SGSN_AUTH_POLICY_REMOTE);
g_cfg->auth_policy = val;
g_cfg->require_authentication = (val == SGSN_AUTH_POLICY_REMOTE);
+ g_cfg->require_update_location = (val == SGSN_AUTH_POLICY_REMOTE);
return CMD_SUCCESS;
}
diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c
index 7c48eef0a..58d3a4f86 100644
--- a/openbsc/tests/sgsn/sgsn_test.c
+++ b/openbsc/tests/sgsn/sgsn_test.c
@@ -877,6 +877,7 @@ static void test_gmm_attach_subscr_fake_auth(void)
subscr = gprs_subscr_get_or_create("123456789012345");
subscr->authorized = 1;
sgsn->cfg.require_authentication = 1;
+ sgsn->cfg.require_update_location = 1;
subscr_put(subscr);
printf("Auth policy 'remote', auth faked: ");
@@ -919,6 +920,7 @@ static void test_gmm_attach_subscr_real_auth(void)
subscr = gprs_subscr_get_or_create("123456789012345");
subscr->authorized = 1;
sgsn->cfg.require_authentication = 1;
+ sgsn->cfg.require_update_location = 1;
subscr_put(subscr);
printf("Auth policy 'remote', triplet based auth: ");