]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgp debug: restore printing of memstats on exit, now prints if any debug flag set
authorLou Berger <lberger@labn.net>
Sat, 24 Sep 2016 13:09:36 +0000 (09:09 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 30 Sep 2016 16:57:05 +0000 (12:57 -0400)
bgpd/bgp_debug.c
bgpd/bgp_debug.h
bgpd/bgp_main.c

index dc0f5398477333360d7c8196402f7e550e444e79..4d9ff60e92c72ee3bd9c751bd20f5650e30ea3e1 100644 (file)
@@ -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)
 {
index 835d5857352a430608910655706f4d78c62a61b4..00fb670a47314cb0f0d0458865e2e63d36cab36f 100644 (file)
@@ -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 */
index 68d6cb7f387b0adcc739130266d97928799b4364..404fe7d73a9e4cca0577623e02fb8b0e2d36cd89 100644 (file)
@@ -296,6 +296,8 @@ bgp_exit (int status)
   if (zlog_default)
     closezlog (zlog_default);
 
+  if (bgp_debug_count())
+    log_memstats_stderr ("bgpd");
   exit (status);
 }