<p>keith has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-hlr/+/24217">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">vty: enable show subscribers filtered by IMEI<br><br>In 89fda3024a0c9a422cc5e5033b016ce0ab6c1ff3 I added a<br>vty command to show a summary of filtered subscribers by imsi<br>or msisdn. In practice there is a also need to be able to<br>filter on IMEI.<br><br>The idea here is not to replace every operation that could be<br>done directly on the sql database in the vty, but this one<br>is useful.<br><br>Change-Id: Ic4a11d3ebcf8909c68e9f4617e94dc822491e008<br>---<br>M include/osmocom/hlr/db.h<br>M src/db.c<br>M src/db_hlr.c<br>M src/hlr_vty_subscr.c<br>4 files changed, 7 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/17/24217/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/hlr/db.h b/include/osmocom/hlr/db.h</span><br><span>index f70df83..a771409 100644</span><br><span>--- a/include/osmocom/hlr/db.h</span><br><span>+++ b/include/osmocom/hlr/db.h</span><br><span>@@ -12,6 +12,7 @@</span><br><span>  DB_STMT_SEL_ALL_ORDER_LAST_SEEN,</span><br><span>     DB_STMT_SEL_FILTER_MSISDN,</span><br><span>   DB_STMT_SEL_FILTER_IMSI,</span><br><span style="color: hsl(120, 100%, 40%);">+      DB_STMT_SEL_FILTER_IMEI,</span><br><span>     DB_STMT_SEL_FILTER_CS,</span><br><span>       DB_STMT_SEL_FILTER_PS,</span><br><span>       DB_STMT_SEL_BY_IMSI,</span><br><span>diff --git a/src/db.c b/src/db.c</span><br><span>index 09a17b6..3a7cf49 100644</span><br><span>--- a/src/db.c</span><br><span>+++ b/src/db.c</span><br><span>@@ -56,6 +56,7 @@</span><br><span>                "WHERE last_lu_seen IS NOT NULL ORDER BY last_lu_seen;",</span><br><span>   [DB_STMT_SEL_FILTER_MSISDN] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE msisdn LIKE $search ORDER BY msisdn",</span><br><span>        [DB_STMT_SEL_FILTER_IMSI] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE imsi LIKE $search ORDER BY imsi",</span><br><span style="color: hsl(120, 100%, 40%);">+       [DB_STMT_SEL_FILTER_IMEI] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE imei LIKE $search ORDER BY imei",</span><br><span>      [DB_STMT_SEL_FILTER_CS] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE nam_cs = $search ORDER BY last_lu_seen",</span><br><span>         [DB_STMT_SEL_FILTER_PS] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE nam_ps = $search ORDER BY last_lu_seen",</span><br><span>         [DB_STMT_SEL_BY_IMSI] = "SELECT " SEL_COLUMNS " FROM subscriber WHERE imsi = ?",</span><br><span>diff --git a/src/db_hlr.c b/src/db_hlr.c</span><br><span>index a4c467e..e88b5fc 100644</span><br><span>--- a/src/db_hlr.c</span><br><span>+++ b/src/db_hlr.c</span><br><span>@@ -648,6 +648,8 @@</span><br><span> </span><br><span>  if (!filter_type) {</span><br><span>          stmt = dbc->stmt[DB_STMT_SEL_ALL];</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (strcmp(filter_type, "imei") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+              stmt = dbc->stmt[DB_STMT_SEL_FILTER_IMEI];</span><br><span>        } else if (strcmp(filter_type, "imsi") == 0) {</span><br><span>             stmt = dbc->stmt[DB_STMT_SEL_FILTER_IMSI];</span><br><span>        } else if (strcmp(filter_type, "msisdn") == 0) {</span><br><span>diff --git a/src/hlr_vty_subscr.c b/src/hlr_vty_subscr.c</span><br><span>index ad16045..82e0043 100644</span><br><span>--- a/src/hlr_vty_subscr.c</span><br><span>+++ b/src/hlr_vty_subscr.c</span><br><span>@@ -256,7 +256,7 @@</span><br><span> #define SUBSCRS_SHOW_HELP "Show all subscribers (with filter possibility)\n"</span><br><span> </span><br><span> #define SUBSCR_ID "(imsi|msisdn|id|imei) IDENT"</span><br><span style="color: hsl(0, 100%, 40%);">-#define SUBSCR_FILTER "(imsi|msisdn) FILTER"</span><br><span style="color: hsl(120, 100%, 40%);">+#define SUBSCR_FILTER "(imei|imsi|msisdn) FILTER"</span><br><span> </span><br><span> #define SUBSCR_ID_HELP \</span><br><span>  "Identify subscriber by IMSI\n" \</span><br><span>@@ -307,7 +307,8 @@</span><br><span>       show_subscriber_filtered_cmd,</span><br><span>       "show subscribers " SUBSCR_FILTER,</span><br><span>       SHOW_STR SUBSCRS_SHOW_HELP</span><br><span style="color: hsl(0, 100%, 40%);">-      "Filter Subscribers by IMSI\n" "Filter Subscribers by MSISDN\n" "String to match in msisdn or imsi\n")</span><br><span style="color: hsl(120, 100%, 40%);">+      "Filter Subscribers by IMEI\n" "Filter Subscribers by IMSI\n" "Filter Subscribers by MSISDN\n"</span><br><span style="color: hsl(120, 100%, 40%);">+      "String to match in imei, imsi or msisdn\n")</span><br><span> {</span><br><span>  const char *filter_type = argv[0];</span><br><span>   const char *filter = argv[1];</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-hlr/+/24217">change 24217</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-hlr/+/24217"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-hlr </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ic4a11d3ebcf8909c68e9f4617e94dc822491e008 </div>
<div style="display:none"> Gerrit-Change-Number: 24217 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: keith <keith@rhizomatica.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>