summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-05-10 01:39:15 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-05-10 01:39:15 +0200
commitd66507d5739be5705e40b97e7d88eb1b6349efb0 (patch)
tree554202f81c4db128413c41485f66605ded3f02ec
parentd5da4b550d97a979b82925a089c569995cf5e0ad (diff)
nitb: Generate ctrl trap for quick LU rejects..
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c20
-rw-r--r--openbsc/tests/db/Makefile.am2
2 files changed, 21 insertions, 1 deletions
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 6490b8bbf..d907f7d04 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -61,6 +61,7 @@
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/ctrl/control_cmd.h>
#include <osmocom/gsm/tlv.h>
#include <assert.h>
@@ -107,6 +108,23 @@ static int apply_codec_restrictions(struct gsm_bts *bts,
static uint32_t new_callref = 0x80000001;
+static void reject_trap(struct ctrl_handle *ctrl, const char *imsi)
+{
+ struct ctrl_cmd *cmd;
+
+ cmd = ctrl_cmd_create(NULL, CTRL_TYPE_TRAP);
+ if (!cmd) {
+ LOGP(DCTRL, LOGL_ERROR, "Failed to create TRAP command.\n");
+ return;
+ }
+
+ cmd->id = "0";
+ cmd->variable = talloc_asprintf(cmd, "subscriber-reject-v1");
+ cmd->reply = talloc_strdup(cmd, imsi);
+ ctrl_cmd_send_to_all(ctrl, cmd);
+ talloc_free(cmd);
+}
+
void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg)
{
net->mncc_recv(net, msg);
@@ -534,6 +552,7 @@ static int mm_rx_id_resp(struct gsm_subscriber_connection *conn, struct msgb *ms
net->subscr_group, mi_string);
}
if (!conn->subscr && conn->loc_operation) {
+ reject_trap(net->ctrl, mi_string);
gsm0408_loc_upd_rej(conn, bts->network->reject_cause);
release_loc_updating_req(conn, 1);
return 0;
@@ -645,6 +664,7 @@ static int mm_rx_loc_upd_req(struct gsm_subscriber_connection *conn, struct msgb
bts->network->subscr_group, mi_string);
}
if (!subscr) {
+ reject_trap(bts->network->ctrl, mi_string);
gsm0408_loc_upd_rej(conn, bts->network->reject_cause);
release_loc_updating_req(conn, 0);
return 0;
diff --git a/openbsc/tests/db/Makefile.am b/openbsc/tests/db/Makefile.am
index be3af5f1d..9fb931b9b 100644
--- a/openbsc/tests/db/Makefile.am
+++ b/openbsc/tests/db/Makefile.am
@@ -12,6 +12,6 @@ db_test_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libtrau/libtrau.a \
$(top_builddir)/src/libcommon/libcommon.a \
- $(LIBOSMOCORE_LIBS) $(LIBOSMOABIS_LIBS) \
+ $(LIBOSMOCORE_LIBS) $(LIBOSMOCTRL_LIBS) $(LIBOSMOABIS_LIBS) \
$(LIBOSMOGSM_LIBS) $(LIBSMPP34_LIBS) $(LIBOSMOVTY_LIBS) $(LIBCRYPTO_LIBS) -ldbi