aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte (local) <laflocal@hanuman.gnumonks.org>2009-08-14 20:27:16 +0200
committerHarald Welte (local) <laflocal@hanuman.gnumonks.org>2009-08-14 20:27:16 +0200
commit15920de8ce9b9199f4ef4ad568b204af0f34b2f0 (patch)
treee672046f61feb8804c1fdbf74fc385f205bd9e98
parent05e676356fee431b80901b6de6ac4000a903808c (diff)
add 'show subscriber cache' vty command to debug subscriber refcount leaks
-rw-r--r--openbsc/include/openbsc/gsm_subscriber.h1
-rw-r--r--openbsc/src/vty_interface.c17
2 files changed, 18 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h
index 5a86ec8c1..f01a47ff0 100644
--- a/openbsc/include/openbsc/gsm_subscriber.h
+++ b/openbsc/include/openbsc/gsm_subscriber.h
@@ -85,5 +85,6 @@ void subscr_get_channel(struct gsm_subscriber *subscr,
/* internal */
struct gsm_subscriber *subscr_alloc(void);
+extern struct llist_head active_subscribers;
#endif /* _GSM_SUBSCR_H */
diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c
index 0dcf0577e..8fc26e2dd 100644
--- a/openbsc/src/vty_interface.c
+++ b/openbsc/src/vty_interface.c
@@ -431,6 +431,7 @@ static void subscr_dump_vty(struct vty *vty, struct gsm_subscriber *subscr)
vty_out(vty, " IMSI: %s%s", subscr->imsi, VTY_NEWLINE);
if (subscr->tmsi)
vty_out(vty, " TMSI: %s%s", subscr->tmsi, VTY_NEWLINE);
+ vty_out(vty, " Use count: %u%s", subscr->use_count, VTY_NEWLINE);
}
static void lchan_dump_vty(struct vty *vty, struct gsm_lchan *lchan)
@@ -1170,6 +1171,21 @@ DEFUN(show_subscr,
return CMD_SUCCESS;
}
+DEFUN(show_subscr_cache,
+ show_subscr_cache_cmd,
+ "show subscriber cache",
+ SHOW_STR "Display contents of subscriber cache\n")
+{
+ struct gsm_subscriber *subscr;
+
+ llist_for_each_entry(subscr, &active_subscribers, entry) {
+ vty_out(vty, " Subscriber:%s", VTY_NEWLINE);
+ subscr_dump_vty(vty, subscr);
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN(sms_send_pend,
sms_send_pend_cmd,
"sms send pending MIN_ID",
@@ -1361,6 +1377,7 @@ int bsc_vty_init(struct gsm_network *net)
install_element(VIEW_NODE, &show_paging_cmd);
install_element(VIEW_NODE, &show_subscr_cmd);
+ install_element(VIEW_NODE, &show_subscr_cache_cmd);
install_element(VIEW_NODE, &sms_send_pend_cmd);
install_element(VIEW_NODE, &sms_send_ext_cmd);