aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-02-22 06:10:45 +0100
committerHarald Welte <laforge@gnumonks.org>2018-06-08 16:16:42 +0000
commit81e912fa781f23f633f683ea5e99589fa8e8ad5e (patch)
treeacba66123ee19505028603e13c63ff263a205ea1
parent8d6f444191f070a25d1482fbce8c80cd196a94f7 (diff)
try to pick up subsrc IMSI on l3-compl
This is a tiny step towards being aware of a connection's subscriber identity. Iff the Layer 3 Complete message contains an IMSI, associate a bsc_subscr with the conn, so that subsequent logging and possibly meas_feed contains the IMSI. For any L3 Complete using TMSI, this has no effect whatsoever. Related: OS#2969 Change-Id: I3b696a0c0932e3abcb682ba231db65755d8c27a6
-rw-r--r--src/osmo-bsc/osmo_bsc_api.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/osmo-bsc/osmo_bsc_api.c b/src/osmo-bsc/osmo_bsc_api.c
index f3c36c3c8..a86b4f99e 100644
--- a/src/osmo-bsc/osmo_bsc_api.c
+++ b/src/osmo-bsc/osmo_bsc_api.c
@@ -20,6 +20,7 @@
#include <osmocom/bsc/bsc_subscr_conn_fsm.h>
#include <osmocom/bsc/osmo_bsc.h>
#include <osmocom/bsc/bsc_msc_data.h>
+#include <osmocom/bsc/bsc_subscriber.h>
#include <osmocom/bsc/debug.h>
#include <osmocom/bsc/gsm_04_80.h>
@@ -258,8 +259,22 @@ static int complete_layer3(struct gsm_subscriber_connection *conn,
return BSC_API_CONN_POL_REJECT;
}
- if (imsi)
+ /* TODO: also extract TMSI. We get an IMSI only when an initial L3 Complete comes in that
+ * contains an IMSI. We filter by IMSI. A TMSI identity is never returned here, see e.g.
+ * _cr_check_loc_upd() and other similar functions called from bsc_msg_filter_initial(). */
+ if (imsi) {
conn->filter_state.imsi = talloc_steal(conn, imsi);
+ if (conn->bsub) {
+ /* Already a subscriber on L3 Complete? Should never happen... */
+ if (conn->bsub->imsi[0]
+ && strcmp(conn->bsub->imsi, imsi))
+ LOGP(DMSC, LOGL_ERROR, "Subscriber's IMSI changes from %s to %s\n",
+ conn->bsub->imsi, imsi);
+ bsc_subscr_set_imsi(conn->bsub, imsi);
+ } else
+ conn->bsub = bsc_subscr_find_or_create_by_imsi(msc->network->bsc_subscribers,
+ imsi);
+ }
conn->filter_state.con_type = con_type;
/* check return value, if failed check msg for and send USSD */