Add an option to set the global reject cause
This will need to be moved into bsc_hack.c together with the
policy to accept/reject a UPDATING LOCATION REQUEST.
diff --git a/include/openbsc/gsm_04_08.h b/include/openbsc/gsm_04_08.h
index 0ba6235..23a637a 100644
--- a/include/openbsc/gsm_04_08.h
+++ b/include/openbsc/gsm_04_08.h
@@ -380,7 +380,10 @@
struct msgb;
struct gsm_bts;
+/* config options controlling the behaviour of the lower leves */
void gsm0408_allow_everyone(int allow);
+void gsm0408_set_reject_cause(int cause);
+
int gsm0408_rcvmsg(struct msgb *msg);
void gsm0408_generate_lai(struct gsm48_loc_area_id *lai48, u_int16_t mcc,
u_int16_t mnc, u_int16_t lac);
diff --git a/src/bsc_hack.c b/src/bsc_hack.c
index fe3431e..39301e6 100644
--- a/src/bsc_hack.c
+++ b/src/bsc_hack.c
@@ -674,6 +674,7 @@
printf(" -c --country-code number (MCC) \n");
printf(" -l --database db-name The database to use\n");
printf(" -a --authorize-everyone Allow everyone into the network.\n");
+ printf(" -r --reject-cause number The reject cause for LOCATION UPDATING REJECT.\n");
printf(" -h --help this text\n");
}
@@ -689,10 +690,11 @@
{"country-code", 1, 0, 'c'},
{"database", 1, 0, 'l'},
{"authorize-everyone", 0, 0, 'a'},
+ {"reject-cause", 1, 0, 'r'},
{0, 0, 0, 0}
};
- c = getopt_long(argc, argv, "hc:n:d:sa",
+ c = getopt_long(argc, argv, "hc:n:d:sar:",
long_options, &option_index);
if (c == -1)
break;
@@ -720,6 +722,9 @@
case 'a':
gsm0408_allow_everyone(1);
break;
+ case 'r':
+ gsm0408_set_reject_cause(atoi(optarg));
+ break;
default:
/* ignore */
break;
diff --git a/src/gsm_04_08.c b/src/gsm_04_08.c
index 80aeaa4..65d2f64 100644
--- a/src/gsm_04_08.c
+++ b/src/gsm_04_08.c
@@ -59,6 +59,12 @@
authorize_everonye = everyone;
}
+static int reject_cause = 0;
+void gsm0408_set_reject_cause(int cause)
+{
+ reject_cause = cause;
+}
+
static int authorize_subscriber(struct gsm_subscriber *subscriber)
{
if (!subscriber)
@@ -360,8 +366,7 @@
{
struct gsm_lchan *lchan = data;
- /* 0x16 is congestion */
- gsm0408_loc_upd_rej(lchan, 0x04);
+ gsm0408_loc_upd_rej(lchan, reject_cause);
rsl_chan_release(lchan);
}