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
diff --git a/openbsc/src/gprs/sgsn_auth.c b/openbsc/src/gprs/sgsn_auth.c
index 0407e9e..eb85d45 100644
--- a/openbsc/src/gprs/sgsn_auth.c
+++ b/openbsc/src/gprs/sgsn_auth.c
@@ -34,9 +34,9 @@
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 @@
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 @@
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,