]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: bfd debug fixup
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 22 Apr 2016 11:41:08 +0000 (07:41 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 22 Apr 2016 16:32:47 +0000 (12:32 -0400)
BFD debugs were being output without any
debug protection.  Modify the code
to not output unless debugging is
turned on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
lib/bfd.c

index ddf03d4f1c44546987a9bca6209091ae54d21e91..d48dc651c6f82e21e57a27c08bfeaaf51211d864 100644 (file)
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -33,6 +33,8 @@
 #include "vty.h"
 #include "bfd.h"
 
+int bfd_debug = 0;
+
 /*
  * bfd_info_create - Allocate the BFD information
  */
@@ -130,8 +132,9 @@ bfd_peer_sendmsg (struct zclient *zclient, struct bfd_info *bfd_info,
   /* Check socket. */
   if (!zclient || zclient->sock < 0)
     {
-      zlog_debug("%s: Can't send BFD peer register, Zebra client not "
-                  "established", __FUNCTION__);
+      if (bfd_debug)
+       zlog_debug("%s: Can't send BFD peer register, Zebra client not "
+                  "established", __FUNCTION__);
       return;
     }
 
@@ -214,7 +217,8 @@ bfd_peer_sendmsg (struct zclient *zclient, struct bfd_info *bfd_info,
 
   if (ret < 0)
     {
-      zlog_warn("bfd_peer_sendmsg: zclient_send_message() failed");
+      if (bfd_debug)
+       zlog_debug("bfd_peer_sendmsg: zclient_send_message() failed");
       return;
     }
 
@@ -269,8 +273,9 @@ bfd_get_peer_info (struct stream *s, struct prefix *dp, struct prefix *sp,
       ifp = if_lookup_by_index_vrf (ifindex, vrf_id);
       if (ifp == NULL)
         {
-          zlog_warn ("zebra_interface_bfd_read: "
-                     "Can't find interface by ifindex: %d ", ifindex);
+         if (bfd_debug)
+           zlog_debug ("zebra_interface_bfd_read: "
+                       "Can't find interface by ifindex: %d ", ifindex);
           return NULL;
         }
     }
@@ -453,8 +458,9 @@ bfd_client_sendmsg (struct zclient *zclient, int command)
   /* Check socket. */
   if (!zclient || zclient->sock < 0)
     {
-      zlog_debug("%s: Can't send BFD client register, Zebra client not "
-                  "established", __FUNCTION__);
+      if (bfd_debug)
+       zlog_debug ("%s: Can't send BFD client register, Zebra client not "
+                  "established", __FUNCTION__);
       return;
     }
 
@@ -470,8 +476,9 @@ bfd_client_sendmsg (struct zclient *zclient, int command)
 
   if (ret < 0)
     {
-      zlog_warn("bfd_client_sendmsg %d: zclient_send_message() failed",
-                  getpid());
+      if (bfd_debug)
+       zlog_debug ("bfd_client_sendmsg %d: zclient_send_message() failed",
+                  getpid());
       return;
     }