aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2018-10-09 23:00:38 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-12-11 16:12:46 +0100
commit95739cf8cbda28b51380c3120d1f30e02a2712fc (patch)
treef20b8d25d357865c939cb5a850948c189dc6ef3d /src
parentb84fc49b1f603cf4841b74b5c773d4f2d259cd0f (diff)
VTY: Allow logging filter imsi statements for IMSIs we haven't seen yet
Limiting the logging filter only to IMSIs that we have as local subscriber doesn't make sense for osmo-bsc since all subscribers are initially unknown. Create a bsc subscriber and enable logging there. This struct will then be used and liked to the gsm_subscr_conn when receiving the Location update. Related: OS#3641 Change-Id: Ia20bdc15565417020205d7b2b06b04a01c03106c
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bsc/osmo_bsc_vty.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index a32f58087..6e3d1c190 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -886,15 +886,21 @@ DEFUN(logging_fltr_imsi,
struct log_target *tgt = osmo_log_vty2tgt(vty);
const char *imsi = argv[0];
- bsc_subscr = bsc_subscr_find_by_imsi(bsc_gsmnet->bsc_subscribers, imsi);
+ if (!tgt)
+ return CMD_WARNING;
+
+ bsc_subscr = bsc_subscr_find_or_create_by_imsi(bsc_gsmnet->bsc_subscribers, imsi);
if (!bsc_subscr) {
- vty_out(vty, "%%no subscriber with IMSI(%s)%s",
+ vty_out(vty, "%%failed to enable logging for subscriber with IMSI(%s)%s",
imsi, VTY_NEWLINE);
return CMD_WARNING;
}
log_set_filter_bsc_subscr(tgt, bsc_subscr);
+ /* log_set_filter has grabbed its own reference */
+ bsc_subscr_put(bsc_subscr);
+
return CMD_SUCCESS;
}