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

2018-12-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged. ( 
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(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



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: merged
Gerrit-Change-Id: Ia20bdc15565417020205d7b2b06b04a01c03106c
Gerrit-Change-Number: 12250
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: daniel 


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

2018-12-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/12250 )

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


Patch Set 1: Code-Review+2


--
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: comment
Gerrit-Change-Id: Ia20bdc15565417020205d7b2b06b04a01c03106c
Gerrit-Change-Number: 12250
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: daniel 
Gerrit-Comment-Date: Tue, 11 Dec 2018 21:10:35 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


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

2018-12-11 Thread Pau Espin Pedrol
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 
Gerrit-Reviewer: daniel