Change in osmo-bsc[master]: VTY: Allow logging filter imsi statements for IMSIs we haven't seen yet

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Dec 11 17:16:04 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/12250


Change subject: VTY: Allow logging filter imsi statements for IMSIs we haven't seen yet
......................................................................

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
---
M src/osmo-bsc/osmo_bsc_vty.c
1 file changed, 8 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/50/12250/1

diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index a32f580..6e3d1c1 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -886,15 +886,21 @@
 	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;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/12250
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia20bdc15565417020205d7b2b06b04a01c03106c
Gerrit-Change-Number: 12250
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181211/c7b2fedd/attachment.htm>


More information about the gerrit-log mailing list