diff options
author | Daniel Willmann <dwillmann@sysmocom.de> | 2021-01-18 16:57:01 +0100 |
---|---|---|
committer | Daniel Willmann <dwillmann@sysmocom.de> | 2021-01-18 18:47:41 +0100 |
commit | d245c0e54239cbd136d28a3e021e8ca9cd9f8135 (patch) | |
tree | 683b814f65e2c28cee0b078cb51a473f4fba78c4 /src | |
parent | 4380f94cf2154d4d7670154e25508f1bfd1df70e (diff) |
gbproxy: Add VTY commands to query the TLLI/IMSI cache
OsmoGbProxy# show gbproxy tlli-cache
TLLI cache timeout 10s
TLLI c2200024 -> NSE(02001/BSS) valid 10s
TLLI cache contains 1 entries
OsmoGbProxy# show gbproxy imsi-cache
IMSI cache timeout 10s
IMSI 262420000001000 -> NSE(00102/SGSN): valid 5s
IMSI 262420000000000 -> NSE(00101/SGSN): valid 3s
IMSI cache contains 2 entries
Change-Id: I03f1050573de9b241eb4fa82460c434155c15c6a
Related: OS#4951, OS#4472
Diffstat (limited to 'src')
-rw-r--r-- | src/gbproxy/gb_proxy_vty.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/gbproxy/gb_proxy_vty.c b/src/gbproxy/gb_proxy_vty.c index 7e9e18d3d..7ae65d20e 100644 --- a/src/gbproxy/gb_proxy_vty.c +++ b/src/gbproxy/gb_proxy_vty.c @@ -553,6 +553,55 @@ DEFUN(show_gbproxy_links, show_gbproxy_links_cmd, "show gbproxy links", return CMD_SUCCESS; } +DEFUN(show_gbproxy_tlli_cache, show_gbproxy_tlli_cache_cmd, + "show gbproxy tlli-cache", + SHOW_STR GBPROXY_STR "Show TLLI cache entries\n") +{ + struct gbproxy_tlli_cache_entry *entry; + struct timespec now; + time_t expiry; + int i, count = 0; + + osmo_clock_gettime(CLOCK_MONOTONIC, &now); + expiry = now.tv_sec - g_cfg->tlli_cache.timeout; + + vty_out(vty, "TLLI cache timeout %us%s", g_cfg->tlli_cache.timeout, VTY_NEWLINE); + hash_for_each(g_cfg->tlli_cache.entries, i, entry, list) { + time_t valid = entry->tstamp - expiry; + struct gbproxy_nse *nse = entry->nse; + + vty_out(vty, " TLLI %08x -> NSE(%05u/%s) valid %lds%s", entry->tlli, nse->nsei, + nse->sgsn_facing ? "SGSN" : "BSS", valid, VTY_NEWLINE); + count++; + } + vty_out(vty, "TLLI cache contains %u entries%s", count, VTY_NEWLINE); + return CMD_SUCCESS; +} + +DEFUN(show_gbproxy_imsi_cache, show_gbproxy_imsi_cache_cmd, + "show gbproxy imsi-cache", + SHOW_STR GBPROXY_STR "Show IMSI cache entries\n") +{ + struct gbproxy_imsi_cache_entry *entry; + struct timespec now; + time_t expiry; + int i, count = 0; + + osmo_clock_gettime(CLOCK_MONOTONIC, &now); + expiry = now.tv_sec - g_cfg->imsi_cache.timeout; + + vty_out(vty, "IMSI cache timeout %us%s", g_cfg->imsi_cache.timeout, VTY_NEWLINE); + hash_for_each(g_cfg->imsi_cache.entries, i, entry, list) { + time_t valid = entry->tstamp - expiry; + struct gbproxy_nse *nse = entry->nse; + vty_out(vty, " IMSI %s -> NSE(%05u/%s): valid %lds%s", entry->imsi, nse->nsei, + nse->sgsn_facing ? "SGSN" : "BSS", valid, VTY_NEWLINE); + count++; + } + vty_out(vty, "IMSI cache contains %u entries%s", count, VTY_NEWLINE); + return CMD_SUCCESS; +} + DEFUN(delete_gb_bvci, delete_gb_bvci_cmd, "delete-gbproxy-peer <0-65534> bvci <2-65534>", "Delete a GBProxy bvc by NSEI and optionally BVCI\n" @@ -684,6 +733,8 @@ int gbproxy_vty_init(void) install_element_ve(&show_gbproxy_bvc_cmd); install_element_ve(&show_gbproxy_cell_cmd); install_element_ve(&show_gbproxy_links_cmd); + install_element_ve(&show_gbproxy_tlli_cache_cmd); + install_element_ve(&show_gbproxy_imsi_cache_cmd); install_element_ve(&show_nri_all_cmd); install_element_ve(&show_nri_nsei_cmd); install_element_ve(&logging_fltr_bvc_cmd); |