From 81e912fa781f23f633f683ea5e99589fa8e8ad5e Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 22 Feb 2018 06:10:45 +0100 Subject: 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 --- src/osmo-bsc/osmo_bsc_api.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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 #include #include +#include #include #include @@ -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 */ -- cgit v1.2.3