summaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/sgsn_vty.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-01-19 11:10:04 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-01-20 16:13:48 +0100
commitd6267d12d8bd945f219b3d2f7bf04060fe2d83bd (patch)
tree99156a4e36f626b965c72d59476bae95dfc70a63 /openbsc/src/gprs/sgsn_vty.c
parent2585620857a3a6c17b17a65a3d9a863824b8e401 (diff)
sgsn: Add SGSN_ERROR_CAUSE_NONE and use it instead of 0
Currently an error_cause of 0 is being used to indicate normal operation. Albeit this is not a defined GMM cause, the value is not explicitly reserved. This commit adds the macro SGSN_ERROR_CAUSE_NONE and uses it for initialisation (instead of relying on talloc_zero) and comparisons. The value is set to -1 to be on the safe side. The VTY code is updated to set the error_cause when using the 'update-subscriber imsi IMSI update-location-result CAUSE' command. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/gprs/sgsn_vty.c')
-rw-r--r--openbsc/src/gprs/sgsn_vty.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c
index ef4c8d82e..84fd5ef52 100644
--- a/openbsc/src/gprs/sgsn_vty.c
+++ b/openbsc/src/gprs/sgsn_vty.c
@@ -644,15 +644,29 @@ DEFUN(update_subscr_update_location_result, update_subscr_update_location_result
struct gsm_subscriber *subscr;
+ const struct value_string cause_mapping[] = {
+ { GMM_CAUSE_NET_FAIL, "system-failure" },
+ { GMM_CAUSE_INV_MAND_INFO, "data-missing" },
+ { GMM_CAUSE_PROTO_ERR_UNSPEC, "unexpected-data-value" },
+ { GMM_CAUSE_IMSI_UNKNOWN, "unknown-subscriber" },
+ { GMM_CAUSE_GPRS_NOTALLOWED, "roaming-not-allowed" },
+ { 0, NULL }
+ };
+
subscr = gprs_subscr_get_by_imsi(imsi);
if (!subscr) {
vty_out(vty, "%% unable to get subscriber record for %s\n", imsi);
return CMD_WARNING;
}
- if (strcmp(ret_code_str, "ok") == 0)
+
+ if (strcmp(ret_code_str, "ok") == 0) {
+ subscr->sgsn_data->error_cause = SGSN_ERROR_CAUSE_NONE;
subscr->authorized = 1;
- else
+ } else {
+ subscr->sgsn_data->error_cause =
+ get_string_value(cause_mapping, ret_code_str);
subscr->authorized = 0;
+ }
gprs_subscr_update(subscr);