aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Whyte <keith@rhizomatica.org>2024-04-02 01:07:06 +0100
committerKeith Whyte <keith@rhizomatica.org>2024-04-02 04:58:29 +0100
commit6784ed14b78d7dbbd738a8e80a7f7271999c44c5 (patch)
tree531b0870408d3ab9ce07f96f1761edf6756abc4c
parent1bf4976ad5e414aa55e4cfafc6939dd7c4cea84a (diff)
Split REJect cause by CN DOMAINrhizomatica/production
Allow using a distinct Reject Cause for CS and PS Domain. This breaks any existing config that defines custom reject-cause TODO: Add Alias or Hidden function or whatever to handle old config.
-rw-r--r--include/osmocom/hlr/hlr.h12
-rw-r--r--src/hlr.c12
-rw-r--r--src/hlr_vty.c46
-rw-r--r--src/lu_fsm.c3
-rw-r--r--src/proxy.c6
5 files changed, 59 insertions, 20 deletions
diff --git a/include/osmocom/hlr/hlr.h b/include/osmocom/hlr/hlr.h
index 4ec5064..98a675f 100644
--- a/include/osmocom/hlr/hlr.h
+++ b/include/osmocom/hlr/hlr.h
@@ -56,8 +56,16 @@ struct hlr {
struct llist_head euse_list;
struct hlr_euse *euse_default;
- enum gsm48_gmm_cause reject_cause;
- enum gsm48_gmm_cause no_proxy_reject_cause;
+
+ struct {
+ enum gsm48_gmm_cause cs;
+ enum gsm48_gmm_cause ps;
+ } reject_cause;
+ struct {
+ enum gsm48_gmm_cause cs;
+ enum gsm48_gmm_cause ps;
+ } no_proxy_reject_cause;
+
/* PS: APN default configuration used by Subscription Data on ISR */
struct {
struct {
diff --git a/src/hlr.c b/src/hlr.c
index 1b0b3cb..2aceba1 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -321,7 +321,11 @@ static int rx_send_auth_info(struct osmo_gsup_req *req)
" Returning slightly inaccurate cause 'IMSI Unknown' via GSUP");
return rc;
case -ENOENT:
- osmo_gsup_req_respond_err(req, g_hlr->reject_cause, "IMSI unknown");
+ osmo_gsup_req_respond_err(req,
+ (req->gsup.cn_domain == OSMO_GSUP_CN_DOMAIN_CS) ?
+ g_hlr->no_proxy_reject_cause.cs :
+ g_hlr->no_proxy_reject_cause.ps,
+ "IMSI unknown");
return rc;
default:
osmo_gsup_req_respond_err(req, GMM_CAUSE_NET_FAIL, "failure to look up IMSI in db");
@@ -762,8 +766,10 @@ int main(int argc, char **argv)
g_hlr->db_file_path = talloc_strdup(g_hlr, HLR_DEFAULT_DB_FILE_PATH);
g_hlr->mslookup.server.mdns.domain_suffix = talloc_strdup(g_hlr, OSMO_MDNS_DOMAIN_SUFFIX_DEFAULT);
g_hlr->mslookup.client.mdns.domain_suffix = talloc_strdup(g_hlr, OSMO_MDNS_DOMAIN_SUFFIX_DEFAULT);
- g_hlr->reject_cause = GMM_CAUSE_IMSI_UNKNOWN;
- g_hlr->no_proxy_reject_cause = GMM_CAUSE_IMSI_UNKNOWN;
+ g_hlr->reject_cause.cs = GMM_CAUSE_IMSI_UNKNOWN;
+ g_hlr->no_proxy_reject_cause.cs = GMM_CAUSE_IMSI_UNKNOWN;
+ g_hlr->reject_cause.ps = GMM_CAUSE_IMSI_UNKNOWN;
+ g_hlr->no_proxy_reject_cause.ps = 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 af57159..868866d 100644
--- a/src/hlr_vty.c
+++ b/src/hlr_vty.c
@@ -286,14 +286,22 @@ static int config_write_hlr(struct vty *vty)
{
vty_out(vty, "hlr%s", VTY_NEWLINE);
- if (g_hlr->reject_cause != GMM_CAUSE_IMSI_UNKNOWN)
- vty_out(vty, " reject-cause not-found %s%s",
+ if (g_hlr->reject_cause.cs != GMM_CAUSE_IMSI_UNKNOWN)
+ vty_out(vty, " reject-cause not-found cs %s%s",
get_value_string_or_null(gsm48_gmm_cause_vty_names,
- (uint32_t) g_hlr->reject_cause), VTY_NEWLINE);
- if (g_hlr->no_proxy_reject_cause != GMM_CAUSE_IMSI_UNKNOWN)
- vty_out(vty, " reject-cause no-proxy %s%s",
+ (uint32_t) g_hlr->reject_cause.cs), VTY_NEWLINE);
+ if (g_hlr->reject_cause.ps != GMM_CAUSE_IMSI_UNKNOWN)
+ vty_out(vty, " reject-cause not-found ps %s%s",
get_value_string_or_null(gsm48_gmm_cause_vty_names,
- (uint32_t) g_hlr->no_proxy_reject_cause), VTY_NEWLINE);
+ (uint32_t) g_hlr->reject_cause.ps), VTY_NEWLINE);
+ if (g_hlr->no_proxy_reject_cause.cs != GMM_CAUSE_IMSI_UNKNOWN)
+ vty_out(vty, " reject-cause no-proxy cs %s%s",
+ get_value_string_or_null(gsm48_gmm_cause_vty_names,
+ (uint32_t) g_hlr->no_proxy_reject_cause.cs), VTY_NEWLINE);
+ if (g_hlr->no_proxy_reject_cause.ps != GMM_CAUSE_IMSI_UNKNOWN)
+ vty_out(vty, " reject-cause no-proxy ps %s%s",
+ get_value_string_or_null(gsm48_gmm_cause_vty_names,
+ (uint32_t) g_hlr->no_proxy_reject_cause.ps), 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))
@@ -614,17 +622,27 @@ DEFUN(cfg_ncss_guard_timeout, cfg_ncss_guard_timeout_cmd,
DEFUN(cfg_reject_cause, cfg_reject_cause_cmd,
"reject-cause TYPE CAUSE", "") /* Dynamically Generated */
{
- int cause_code = get_string_value(gsm48_gmm_cause_vty_names, argv[1]);
+ int cause_code = get_string_value(gsm48_gmm_cause_vty_names, argv[2]);
OSMO_ASSERT(cause_code >= 0);
- if (strcmp(argv[0], "not-found") == 0)
- g_hlr->reject_cause = (enum gsm48_gmm_cause) cause_code;
- if (strcmp(argv[0], "no-proxy") == 0)
- g_hlr->no_proxy_reject_cause = (enum gsm48_gmm_cause) cause_code;
+ if (strcmp(argv[0], "not-found") == 0) {
+ if (strcmp(argv[1], "cs") == 0)
+ g_hlr->reject_cause.cs = (enum gsm48_gmm_cause) cause_code;
+ else
+ g_hlr->reject_cause.ps = (enum gsm48_gmm_cause) cause_code;
+ }
+ if (strcmp(argv[0], "no-proxy") == 0) {
+ if (strcmp(argv[1], "cs") == 0)
+ g_hlr->no_proxy_reject_cause.cs = (enum gsm48_gmm_cause) cause_code;
+ else
+ g_hlr->no_proxy_reject_cause.ps = (enum gsm48_gmm_cause) cause_code;
+ }
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"
@@ -722,7 +740,7 @@ void hlr_vty_init(void *hlr_ctx)
cfg_reject_cause_cmd.string =
vty_cmd_string_from_valstr(hlr_ctx,
gsm48_gmm_cause_vty_names,
- "reject-cause (not-found|no-proxy) (", "|", ")",
+ "reject-cause (not-found|no-proxy) (cs|ps) (", "|", ")",
VTY_DO_LOWER);
cfg_reject_cause_cmd.doc =
@@ -730,7 +748,9 @@ void hlr_vty_init(void *hlr_ctx)
gsm48_gmm_cause_vty_descs,
"GSUP/GMM cause to be sent\n"
"in the case the IMSI could not be found in the database\n"
- "in the case no remote HLR reponded to mslookup GSUP request\n",
+ "in the case no remote HLR reponded to mslookup GSUP request\n"
+ "for CS domain\n"
+ "for PS domain\n",
"\n", "", 0);
logging_vty_add_cmds();
diff --git a/src/lu_fsm.c b/src/lu_fsm.c
index 8599f59..d4cb5be 100644
--- a/src/lu_fsm.c
+++ b/src/lu_fsm.c
@@ -136,7 +136,8 @@ static void lu_start(struct osmo_gsup_req *update_location_req)
}
if (db_subscr_get_by_imsi(g_hlr->dbc, update_location_req->gsup.imsi, &lu->subscr) < 0) {
- lu_failure(lu, g_hlr->reject_cause, "Subscriber does not exist");
+ lu_failure(lu, (lu->is_ps) ? g_hlr->reject_cause.ps : g_hlr->reject_cause.cs,
+ "Subscriber does not exist");
return;
}
diff --git a/src/proxy.c b/src/proxy.c
index 7c7f551..b6bbf7e 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -92,7 +92,11 @@ static void proxy_pending_req_remote_hlr_connect_result(struct osmo_gsup_req *re
osmo_gsup_req_respond(req, &gsup_reply, false, true);
return;
}
- osmo_gsup_req_respond_err(req, g_hlr->no_proxy_reject_cause,
+
+ osmo_gsup_req_respond_err(req,
+ (req->gsup.cn_domain == OSMO_GSUP_CN_DOMAIN_CS) ?
+ g_hlr->no_proxy_reject_cause.cs :
+ g_hlr->no_proxy_reject_cause.ps,
"Proxy: Failed to connect to home HLR");
return;
}