lynxis lazus has uploaded this change for review.

View Change

Drop IMSI based acl

Currently it is not supported. Drop the remaining code.
It may be re-introduced at a later point if needed.

Change-Id: I3288d3551c1a4daeb184f2e950777e5a81bfaddb
---
M include/osmocom/sgsn/auth.h
M src/sgsn/sgsn.c
M src/sgsn/sgsn_auth.c
M src/sgsn/sgsn_vty.c
M tests/osmo-sgsn_test-nodes.vty
5 files changed, 4 insertions(+), 101 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/98/43698/1
diff --git a/include/osmocom/sgsn/auth.h b/include/osmocom/sgsn/auth.h
index a46fb16..e4f87c4 100644
--- a/include/osmocom/sgsn/auth.h
+++ b/include/osmocom/sgsn/auth.h
@@ -26,14 +26,3 @@
void sgsn_auth_update(struct sgsn_mm_ctx *mm);
struct gsm_auth_tuple *sgsn_auth_get_tuple(struct sgsn_mm_ctx *mmctx,
unsigned key_seq);
-
-/*
- * Authorization/ACL handling
- */
-struct imsi_acl_entry {
- struct llist_head list;
- char imsi[OSMO_IMSI_BUF_SIZE];
-};
-struct imsi_acl_entry *sgsn_acl_lookup(const char *imsi, const 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);
diff --git a/src/sgsn/sgsn.c b/src/sgsn/sgsn.c
index d3431b9..c3c06e2 100644
--- a/src/sgsn/sgsn.c
+++ b/src/sgsn/sgsn.c
@@ -219,7 +219,6 @@
/* These are mostly setting up stuff not related to VTY cfg, so they can be set up here: */
sgsn_cdr_init(inst);
sgsn_ra_init(inst);
- sgsn_auth_init(inst);
return inst;
}

diff --git a/src/sgsn/sgsn_auth.c b/src/sgsn/sgsn_auth.c
index ab94857..99744a9 100644
--- a/src/sgsn/sgsn_auth.c
+++ b/src/sgsn/sgsn_auth.c
@@ -19,13 +19,9 @@
*
*/

-#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
#include <osmocom/core/utils.h>
#include <osmocom/sgsn/sgsn.h>
-#include <osmocom/sgsn/mmctx.h>
-#include <osmocom/sgsn/gprs_gmm.h>
-#include <osmocom/sgsn/gprs_subscriber.h>
-#include <osmocom/sgsn/debug.h>
+

const struct value_string auth_state_names[] = {
{ SGSN_AUTH_ACCEPTED, "accepted"},
@@ -37,50 +33,3 @@
};

const struct value_string *sgsn_auth_state_names = auth_state_names;
-
-void sgsn_auth_init(struct sgsn_instance *sgsn)
-{
- INIT_LLIST_HEAD(&sgsn->cfg.imsi_acl);
-}
-
-struct imsi_acl_entry *sgsn_acl_lookup(const char *imsi, const struct sgsn_config *cfg)
-{
- struct imsi_acl_entry *acl;
- llist_for_each_entry(acl, &cfg->imsi_acl, list) {
- if (!strcmp(imsi, acl->imsi))
- return acl;
- }
- return NULL;
-}
-
-int sgsn_acl_add(const char *imsi, struct sgsn_config *cfg)
-{
- struct imsi_acl_entry *acl;
-
- if (sgsn_acl_lookup(imsi, cfg))
- return -EEXIST;
-
- acl = talloc_zero(NULL, struct imsi_acl_entry);
- if (!acl)
- return -ENOMEM;
- osmo_strlcpy(acl->imsi, imsi, sizeof(acl->imsi));
-
- llist_add(&acl->list, &cfg->imsi_acl);
-
- return 0;
-}
-
-int sgsn_acl_del(const char *imsi, struct sgsn_config *cfg)
-{
- struct imsi_acl_entry *acl;
-
- acl = sgsn_acl_lookup(imsi, cfg);
- if (!acl)
- return -ENODEV;
-
- llist_del(&acl->list);
- talloc_free(acl);
-
- return 0;
-}
-
diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c
index e4a5575..de32572 100644
--- a/src/sgsn/sgsn_vty.c
+++ b/src/sgsn/sgsn_vty.c
@@ -249,7 +249,6 @@
static int config_write_sgsn(struct vty *vty)
{
struct sgsn_ggsn_ctx *gctx;
- struct imsi_acl_entry *acl;
struct apn_ctx *actx;
struct ares_addr_node *server;
struct sgsn_mme_ctx *mme;
@@ -329,9 +328,6 @@
osmo_hexdump_nospc(g_cfg->oap.secret_opc, sizeof(g_cfg->oap.secret_opc)),
VTY_NEWLINE);

- llist_for_each_entry(acl, &g_cfg->imsi_acl, list)
- vty_out(vty, " imsi-acl add %s%s", acl->imsi, VTY_NEWLINE);
-
if (llist_empty(&sgsn->apn_list))
vty_out(vty, " ! apn * ggsn 0%s", VTY_NEWLINE);
llist_for_each_entry(actx, &sgsn->apn_list, list) {
@@ -777,44 +773,15 @@
return CMD_SUCCESS;
}

-DEFUN(imsi_acl, cfg_imsi_acl_cmd,
+DEFUN_DEPRECATED(imsi_acl, cfg_imsi_acl_cmd,
"imsi-acl (add|del) IMSI",
"Access Control List of foreign IMSIs\n"
"Add IMSI to ACL\n"
"Remove IMSI from ACL\n"
"IMSI of subscriber\n")
{
- char imsi_sanitized[GSM23003_IMSI_MAX_DIGITS + 1];
- const char *op = argv[0];
- const char *imsi = imsi_sanitized;
- size_t len = strnlen(argv[1], GSM23003_IMSI_MAX_DIGITS + 1);
- int rc;
-
- memset(imsi_sanitized, '0', GSM23003_IMSI_MAX_DIGITS);
- imsi_sanitized[GSM23003_IMSI_MAX_DIGITS] = '\0';
-
- /* Sanitize IMSI */
- if (len > GSM23003_IMSI_MAX_DIGITS) {
- vty_out(vty, "%% IMSI (%s) too long (max %u digits) -- ignored!%s",
- argv[1], GSM23003_IMSI_MAX_DIGITS, VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- osmo_strlcpy(imsi_sanitized + GSM23003_IMSI_MAX_DIGITS - len, argv[1],
- sizeof(imsi_sanitized) - (GSM23003_IMSI_MAX_DIGITS - len));
-
- /* FIXME: do we still have ACLs? */
- if (!strcmp(op, "add"))
- rc = sgsn_acl_add(imsi, g_cfg);
- else
- rc = sgsn_acl_del(imsi, g_cfg);
-
- if (rc < 0) {
- vty_out(vty, "%% unable to %s ACL%s", op, VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- return CMD_SUCCESS;
+ vty_out(vty, "ACL based on IMSI has been deprecated.%s", VTY_NEWLINE);
+ return CMD_WARNING;
}

DEFUN_DEPRECATED(cfg_encrypt, cfg_encrypt_cmd,
diff --git a/tests/osmo-sgsn_test-nodes.vty b/tests/osmo-sgsn_test-nodes.vty
index 031ccfa..1bc28ba 100644
--- a/tests/osmo-sgsn_test-nodes.vty
+++ b/tests/osmo-sgsn_test-nodes.vty
@@ -33,7 +33,6 @@
ggsn <0-255> gtp-version (0|1)
ggsn <0-255> echo-interval <1-36000>
ggsn <0-255> no echo-interval
- imsi-acl (add|del) IMSI
auth-policy (accept-all|closed|acl-only|remote)
authentication (optional|required)
encryption gea <0-4> [<0-4>] [<0-4>] [<0-4>] [<0-4>]

To view, visit change 43698. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I3288d3551c1a4daeb184f2e950777e5a81bfaddb
Gerrit-Change-Number: 43698
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis@fe80.eu>