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
This commit is contained in:
Daniel Willmann 2018-10-09 23:00:38 +02:00 committed by Pau Espin Pedrol
parent b84fc49b1f
commit 95739cf8cb
1 changed files with 8 additions and 2 deletions

View File

@ -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;
}