diff options
author | Lou Berger <lberger@labn.net> | 2016-09-24 15:09:36 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-09-30 18:57:05 +0200 |
commit | 90dcf2d7772977e842ab3927d2508e3401fbce45 (patch) | |
tree | 626f4896060f3d1841dd5af5d57e60d7153e214b /bgpd | |
parent | bgpd: remove old/duplicate, and now out of order prefixlen test (diff) | |
download | frr-90dcf2d7772977e842ab3927d2508e3401fbce45.tar.xz frr-90dcf2d7772977e842ab3927d2508e3401fbce45.zip |
bgp debug: restore printing of memstats on exit, now prints if any debug flag set
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_debug.c | 44 | ||||
-rw-r--r-- | bgpd/bgp_debug.h | 1 | ||||
-rw-r--r-- | bgpd/bgp_main.c | 2 |
3 files changed, 47 insertions, 0 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index dc0f53984..4d9ff60e9 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -1686,6 +1686,50 @@ DEFUN (show_debugging_bgp, return CMD_SUCCESS; } +/* return count of number of debug flags set */ +int +bgp_debug_count(void) +{ + int ret = 0; + if (BGP_DEBUG (as4, AS4)) + ret++; + + if (BGP_DEBUG (as4, AS4_SEGMENT)) + ret++; + + if (BGP_DEBUG (bestpath, BESTPATH)) + ret++; + + if (BGP_DEBUG (keepalive, KEEPALIVE)) + ret++; + + if (BGP_DEBUG (neighbor_events, NEIGHBOR_EVENTS)) + ret++; + + if (BGP_DEBUG (nht, NHT)) + ret++; + + if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) + ret++; + + if (BGP_DEBUG (update, UPDATE_PREFIX)) + ret++; + + if (BGP_DEBUG (update, UPDATE_IN)) + ret++; + + if (BGP_DEBUG (update, UPDATE_OUT)) + ret++; + + if (BGP_DEBUG (zebra, ZEBRA)) + ret++; + + if (BGP_DEBUG (allow_martians, ALLOW_MARTIANS)) + ret++; + + return ret; +} + static int bgp_config_write_debug (struct vty *vty) { diff --git a/bgpd/bgp_debug.h b/bgpd/bgp_debug.h index 835d58573..00fb670a4 100644 --- a/bgpd/bgp_debug.h +++ b/bgpd/bgp_debug.h @@ -150,4 +150,5 @@ extern int bgp_debug_update(struct peer *peer, struct prefix *p, extern int bgp_debug_bestpath(struct prefix *p); extern int bgp_debug_zebra(struct prefix *p); +extern int bgp_debug_count(void); #endif /* _QUAGGA_BGP_DEBUG_H */ diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 68d6cb7f3..404fe7d73 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -296,6 +296,8 @@ bgp_exit (int status) if (zlog_default) closezlog (zlog_default); + if (bgp_debug_count()) + log_memstats_stderr ("bgpd"); exit (status); } |