summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-11-13 10:48:39 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-11-14 10:26:06 +0100
commita0b6efb3685ea90190cfbd9423a74c181ea4f12f (patch)
tree17d62d87e6fbf5229093a791b58f0e4042ff6ca9
parentf951a01bb227e524eb369051c95fbebace7570d0 (diff)
sgsn: Remove explicit sgsn_instance parameters
Currently the function in sgsn_auth.c either have an sgsn_config or an sgsn_instance parameter. Since then global sgsn variable is already being used in that file and since other parts of the SGSN related code also rely on a global sgsn singleton, these parameters pretend to provide a flexibility that is not really supported. Therefore this patch removes these parameters except for the ACL related functions, which do not call code that uses the sgsn variable. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/include/openbsc/gprs_sgsn.h9
-rw-r--r--openbsc/src/gprs/gprs_gmm.c2
-rw-r--r--openbsc/src/gprs/gprs_sgsn.c2
-rw-r--r--openbsc/src/gprs/sgsn_auth.c15
-rw-r--r--openbsc/src/gprs/sgsn_main.c2
-rw-r--r--openbsc/tests/sgsn/sgsn_test.c2
6 files changed, 15 insertions, 17 deletions
diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h
index ac78a1626..7ee68cc79 100644
--- a/openbsc/include/openbsc/gprs_sgsn.h
+++ b/openbsc/include/openbsc/gprs_sgsn.h
@@ -271,15 +271,14 @@ struct sgsn_config;
struct sgsn_instance;
extern const struct value_string *sgsn_auth_state_names;
-void sgsn_auth_init(struct sgsn_instance *sgi);
+void sgsn_auth_init(void);
struct imsi_acl_entry *sgsn_acl_lookup(const char *imsi, struct sgsn_config *cfg);
int sgsn_acl_add(const char *imsi, struct sgsn_config *cfg);
int sgsn_acl_del(const char *imsi, struct sgsn_config *cfg);
/* Request authorization */
-int sgsn_auth_request(struct sgsn_mm_ctx *mm, struct sgsn_config *cfg);
-enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mm,
- struct sgsn_config *cfg);
-void sgsn_auth_update(struct sgsn_mm_ctx *mm, struct sgsn_instance *sgi);
+int sgsn_auth_request(struct sgsn_mm_ctx *mm);
+enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mm);
+void sgsn_auth_update(struct sgsn_mm_ctx *mm);
/* Called on subscriber data updates */
void sgsn_update_subscriber_data(struct sgsn_mm_ctx *mmctx);
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 48fb29d1b..74f50fb0a 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -647,7 +647,7 @@ static int gsm48_gmm_authorize(struct sgsn_mm_ctx *ctx)
* sgsn_auth_update which in turn calls
* gsm0408_gprs_access_granted or gsm0408_gprs_access_denied */
- sgsn_auth_request(ctx, &sgsn->cfg);
+ sgsn_auth_request(ctx);
/* Note that gsm48_gmm_authorize can be called recursively via
* sgsn_auth_request iff ctx->auth_info changes to AUTH_ACCEPTED
*/
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index 9fc4b86f3..62cdf0aaf 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -455,5 +455,5 @@ void sgsn_update_subscriber_data(struct sgsn_mm_ctx *mmctx)
{
OSMO_ASSERT(mmctx);
- sgsn_auth_update(mmctx, sgsn);
+ sgsn_auth_update(mmctx);
}
diff --git a/openbsc/src/gprs/sgsn_auth.c b/openbsc/src/gprs/sgsn_auth.c
index 0407e9e69..eb85d45fb 100644
--- a/openbsc/src/gprs/sgsn_auth.c
+++ b/openbsc/src/gprs/sgsn_auth.c
@@ -34,9 +34,9 @@ const struct value_string auth_state_names[] = {
const struct value_string *sgsn_auth_state_names = auth_state_names;
-void sgsn_auth_init(struct sgsn_instance *sgi)
+void sgsn_auth_init(void)
{
- INIT_LLIST_HEAD(&sgi->cfg.imsi_acl);
+ INIT_LLIST_HEAD(&sgsn->cfg.imsi_acl);
}
/* temporary IMSI ACL hack */
@@ -81,8 +81,7 @@ int sgsn_acl_del(const char *imsi, struct sgsn_config *cfg)
return 0;
}
-enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mmctx,
- struct sgsn_config *cfg)
+enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mmctx)
{
char mccmnc[16];
int check_net = 0;
@@ -125,22 +124,22 @@ enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mmctx,
return SGSN_AUTH_REJECTED;
}
-int sgsn_auth_request(struct sgsn_mm_ctx *mmctx, struct sgsn_config *cfg)
+int sgsn_auth_request(struct sgsn_mm_ctx *mmctx)
{
/* TODO: Add remote subscriber update requests here */
- sgsn_auth_update(mmctx, sgsn);
+ sgsn_auth_update(mmctx);
return 0;
}
-void sgsn_auth_update(struct sgsn_mm_ctx *mmctx, struct sgsn_instance *sgi)
+void sgsn_auth_update(struct sgsn_mm_ctx *mmctx)
{
enum sgsn_auth_state auth_state;
LOGMMCTXP(LOGL_DEBUG, mmctx, "Updating authorization\n");
- auth_state = sgsn_auth_state(mmctx, &sgi->cfg);
+ auth_state = sgsn_auth_state(mmctx);
if (auth_state == SGSN_AUTH_UNKNOWN) {
/* Reject requests since remote updates are NYI */
LOGMMCTXP(LOGL_ERROR, mmctx,
diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c
index c7c852d5e..0310cb2b2 100644
--- a/openbsc/src/gprs/sgsn_main.c
+++ b/openbsc/src/gprs/sgsn_main.c
@@ -345,7 +345,7 @@ int main(int argc, char **argv)
bssgp_vty_init();
gprs_llc_vty_init();
gprs_sndcp_vty_init();
- sgsn_auth_init(&sgsn_inst);
+ sgsn_auth_init();
/* FIXME: register signal handler for SS_L_NS */
rc = sgsn_parse_config(sgsn_inst.config_file, &sgsn_inst.cfg);
diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c
index 2c38a1275..d6091fdab 100644
--- a/openbsc/tests/sgsn/sgsn_test.c
+++ b/openbsc/tests/sgsn/sgsn_test.c
@@ -798,7 +798,7 @@ int main(int argc, char **argv)
tall_bsc_ctx = talloc_named_const(NULL, 0, "osmo_sgsn");
tall_msgb_ctx = talloc_named_const(tall_bsc_ctx, 0, "msgb");
- sgsn_auth_init(sgsn);
+ sgsn_auth_init();
test_llme();
test_gmm_detach();