From 95739cf8cbda28b51380c3120d1f30e02a2712fc Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Tue, 9 Oct 2018 23:00:38 +0200 Subject: 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 --- src/osmo-bsc/osmo_bsc_vty.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/osmo-bsc') 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; } -- cgit v1.2.3