This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
lynxis lazus gerrit-no-reply at lists.osmocom.orglynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hlr/+/16808 )
Change subject: Add vty `imsi unknown cause` to set the reject cause
......................................................................
Add vty `imsi unknown cause` to set the reject cause
Allow to set the reject cause when an IMSI is unknown to the HLR.
Most common on reject causes are GMM_CAUSE_IMSI_UNKNOWN (2) or
CAUSE_ROAMING_NOTALLOWED (11).
Change-Id: Icea39020c23fbbea9e92847df76af8986fdbf48a
---
M doc/examples/osmo-hlr.cfg
M include/osmocom/hlr/hlr.h
M src/hlr.c
M src/hlr_vty.c
4 files changed, 33 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/08/16808/1
diff --git a/doc/examples/osmo-hlr.cfg b/doc/examples/osmo-hlr.cfg
index a685858..cf78e74 100644
--- a/doc/examples/osmo-hlr.cfg
+++ b/doc/examples/osmo-hlr.cfg
@@ -24,3 +24,4 @@
bind ip 127.0.0.1
ussd route prefix *#100# internal own-msisdn
ussd route prefix *#101# internal own-imsi
+ imsi unknown cause 2
diff --git a/include/osmocom/hlr/hlr.h b/include/osmocom/hlr/hlr.h
index 0564518..ae3ce39 100644
--- a/include/osmocom/hlr/hlr.h
+++ b/include/osmocom/hlr/hlr.h
@@ -23,6 +23,7 @@
#pragma once
#include <stdbool.h>
+#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
#include <osmocom/core/linuxlist.h>
#define HLR_DEFAULT_DB_FILE_PATH "hlr.db"
@@ -46,6 +47,7 @@
struct llist_head euse_list;
struct hlr_euse *euse_default;
+ enum gsm48_gmm_cause imsi_unknown_cause;
/* NCSS (call independent) session guard timeout value */
int ncss_guard_timeout;
diff --git a/src/hlr.c b/src/hlr.c
index 656f0a4..966267b 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -268,7 +268,7 @@
break;
case -ENOENT:
LOGP(DAUC, LOGL_NOTICE, "%s: IMSI not known\n", gsup->imsi);
- gsup_out.cause = GMM_CAUSE_IMSI_UNKNOWN;
+ gsup_out.cause = g_hlr->imsi_unknown_cause;
break;
default:
LOGP(DAUC, LOGL_ERROR, "%s: failure to look up IMSI in db\n", gsup->imsi);
@@ -849,6 +849,7 @@
INIT_LLIST_HEAD(&g_hlr->ss_sessions);
INIT_LLIST_HEAD(&g_hlr->ussd_routes);
g_hlr->db_file_path = talloc_strdup(g_hlr, HLR_DEFAULT_DB_FILE_PATH);
+ g_hlr->imsi_unknown_cause = GMM_CAUSE_IMSI_UNKNOWN;
/* Init default (call independent) SS session guard timeout value */
g_hlr->ncss_guard_timeout = NCSS_GUARD_TIMEOUT_DEFAULT;
diff --git a/src/hlr_vty.c b/src/hlr_vty.c
index 6701cd9..9b1dac3 100644
--- a/src/hlr_vty.c
+++ b/src/hlr_vty.c
@@ -25,7 +25,10 @@
*
*/
+#include <errno.h>
+
#include <osmocom/core/talloc.h>
+#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
#include <osmocom/vty/vty.h>
#include <osmocom/vty/stats.h>
#include <osmocom/vty/command.h>
@@ -73,6 +76,7 @@
static int config_write_hlr(struct vty *vty)
{
vty_out(vty, "hlr%s", VTY_NEWLINE);
+ vty_out(vty, " imsi unknown cause %d%s", g_hlr->imsi_unknown_cause, VTY_NEWLINE);
if (g_hlr->store_imei)
vty_out(vty, " store-imei%s", VTY_NEWLINE);
if (g_hlr->db_file_path && strcmp(g_hlr->db_file_path, HLR_DEFAULT_DB_FILE_PATH))
@@ -337,6 +341,29 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_imsi_not_found_cause, cfg_imsi_not_found_cause_cmd,
+ "imsi unknown cause CAUSE",
+ "Define the GSUP cause to be send in case the IMSI could not found in the database."
+ "Default is 2 (GMM_CAUSE_IMSI_UNKNOWN). A good alternative is 13 (GMM_CAUSE_ROAMING_NOTALLOWED)."
+ )
+{
+ long int cause = 0;
+ char *endptr = NULL;
+
+ errno = 0;
+ cause = strtol(argv[0], &endptr, 0);
+ if (errno)
+ return -errno;
+ else if (*endptr)
+ return -EINVAL;
+
+ if (get_value_string_or_null(gsm48_gmm_cause_names, (uint32_t) cause) == NULL)
+ return -EINVAL;
+
+ g_hlr->imsi_unknown_cause = (enum gsm48_gmm_cause) cause;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_store_imei, cfg_store_imei_cmd,
"store-imei",
"Save the IMEI in the database when receiving Check IMEI requests. Note that an MSC does not necessarily send"
@@ -460,6 +487,7 @@
install_element(HLR_NODE, &cfg_no_store_imei_cmd);
install_element(HLR_NODE, &cfg_subscr_create_on_demand_cmd);
install_element(HLR_NODE, &cfg_no_subscr_create_on_demand_cmd);
+ install_element(HLR_NODE, &cfg_imsi_not_found_cause_cmd);
hlr_vty_subscriber_init();
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/16808
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: Icea39020c23fbbea9e92847df76af8986fdbf48a
Gerrit-Change-Number: 16808
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200112/13f97f49/attachment.htm>