From 15920de8ce9b9199f4ef4ad568b204af0f34b2f0 Mon Sep 17 00:00:00 2001 From: "Harald Welte (local)" Date: Fri, 14 Aug 2009 20:27:16 +0200 Subject: add 'show subscriber cache' vty command to debug subscriber refcount leaks --- openbsc/include/openbsc/gsm_subscriber.h | 1 + openbsc/src/vty_interface.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) 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); -- cgit v1.2.3