From 1bf4976ad5e414aa55e4cfafc6939dd7c4cea84a Mon Sep 17 00:00:00 2001 From: Keith Date: Fri, 13 Jan 2023 21:03:30 +0100 Subject: Add the VLR to the subscribers last-seen vty command It's useful to see WHERE the subcriber was last seen in a distributed GSM configuration Change-Id: I658e42c965a95b23675d4333d262522206fd24c4 --- src/db_hlr.c | 5 ++++- src/hlr_vty_subscr.c | 9 ++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/db_hlr.c b/src/db_hlr.c index 7c22e2e..073bb72 100644 --- a/src/db_hlr.c +++ b/src/db_hlr.c @@ -753,9 +753,12 @@ int db_subscrs_get(struct db_context *dbc, const char *filter_type, const char * copy_sqlite3_text_to_buf(subscr.imei, stmt, 3); subscr.nam_cs = sqlite3_column_int(stmt, 9); subscr.nam_ps = sqlite3_column_int(stmt, 10); - if (show_ls) + if (show_ls) { parse_last_lu_seen(&subscr.last_lu_seen, (const char *)sqlite3_column_text(stmt, 14), subscr.imsi, "CS"); + copy_sqlite3_text_to_buf(subscr.vlr_number, stmt, 4); + } + get_cb(&subscr, data); rc = sqlite3_step(stmt); (*count)++; diff --git a/src/hlr_vty_subscr.c b/src/hlr_vty_subscr.c index 59a27c1..602a9e4 100644 --- a/src/hlr_vty_subscr.c +++ b/src/hlr_vty_subscr.c @@ -182,8 +182,11 @@ static void subscr_dump_summary_vty(struct hlr_subscriber *subscr, void *data) vty_out(vty," ------------- "); } vty_out(vty, " %-2s%-2s ", subscr->nam_cs ? "CS" : "", subscr->nam_ps ? "PS" : ""); - if (subscr->last_lu_seen) + if (subscr->last_lu_seen) { + /* VLR Number is max length 32, possibly truncate here */ + vty_out(vty, " %.22s ", subscr->vlr_number); dump_last_lu_seen(vty, "CS", subscr->last_lu_seen, true); + } vty_out_newline(vty); } @@ -218,8 +221,8 @@ static void dump_summary_table_vty(struct vty *vty, bool header, bool show_ls) { const char *texts = "ID MSISDN IMSI IMEI NAM"; const char *lines = "----- ------------ ---------------- ---------------- -----"; - const char *ls_text = " LAST SEEN"; - const char *ls_line = " ------------"; + const char *ls_text = " VLR_NUMBER LAST SEEN "; + const char *ls_line = " --------------------- ---------------------"; if (header) { if (!show_ls) vty_out(vty, "%s%s%s%s", texts, VTY_NEWLINE, lines, VTY_NEWLINE); -- cgit v1.2.3