Change in osmo-sgsn[master]: gbproxy: Add VTY commands to query the TLLI/IMSI cache

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/.

daniel gerrit-no-reply at lists.osmocom.org
Mon Jan 18 18:02:30 UTC 2021


daniel has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/22290 )

Change subject: gbproxy: Add VTY commands to query the TLLI/IMSI cache
......................................................................

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
---
M src/gbproxy/gb_proxy_vty.c
1 file changed, 51 insertions(+), 0 deletions(-)

Approvals:
  lynxis lazus: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gbproxy/gb_proxy_vty.c b/src/gbproxy/gb_proxy_vty.c
index 7e9e18d..7ae65d2 100644
--- a/src/gbproxy/gb_proxy_vty.c
+++ b/src/gbproxy/gb_proxy_vty.c
@@ -553,6 +553,55 @@
 	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 @@
 	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);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/22290
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I03f1050573de9b241eb4fa82460c434155c15c6a
Gerrit-Change-Number: 22290
Gerrit-PatchSet: 2
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210118/9f8e1981/attachment.htm>


More information about the gerrit-log mailing list