]> git.proxmox.com Git - mirror_frr.git/commitdiff
staticd: add debug static bfd command
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 28 Sep 2021 12:53:23 +0000 (14:53 +0200)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Fri, 13 Jan 2023 18:32:12 +0000 (15:32 -0300)
This command helps in troubleshooting static bfd feature.
Add traces upon bfd events.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
staticd/static_bfd.c
staticd/static_debug.c
staticd/static_debug.h
staticd/static_vty.c

index a955d155e9e987c31b524eec9b469d287a0a3fb5..fc8b518e11df941e37b66b93b70f1ab09e37865a 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "staticd/static_routes.h"
 #include "staticd/static_zebra.h"
+#include "staticd/static_debug.h"
 
 #include "lib/openbsd-queue.h"
 
@@ -45,13 +46,15 @@ static void static_next_hop_bfd_change(struct static_nexthop *sn,
                break;
        case BSS_DOWN:
                /* Peer went down, remove this next hop. */
-               zlog_info("%s: next hop is down, remove it from RIB", __func__);
+               DEBUGD(&static_dbg_bfd,
+                      "%s: next hop is down, remove it from RIB", __func__);
                sn->path_down = true;
                static_zebra_route_add(sn->pn, true);
                break;
        case BSS_UP:
                /* Peer is back up, add this next hop. */
-               zlog_info("%s: next hop is up, add it to RIB", __func__);
+               DEBUGD(&static_dbg_bfd, "%s: next hop is up, add it to RIB",
+                      __func__);
                sn->path_down = false;
                static_zebra_route_add(sn->pn, true);
                break;
index 45f845b40b2022305743291ae6dbcae46b04ed61..847e7d61a4a9319e2e6c4b90e72bee287f3f0d46 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "lib/command.h"
 #include "lib/debug.h"
+#include "lib/bfd.h"
 
 #include "static_debug.h"
 
 /* clang-format off */
 struct debug static_dbg_events = {0, "Staticd events"};
 struct debug static_dbg_route = {0, "Staticd route"};
+struct debug static_dbg_bfd = {0, "Staticd bfd"};
 
 struct debug *static_debug_arr[] =  {
        &static_dbg_events,
-       &static_dbg_route
+       &static_dbg_route,
+       &static_dbg_bfd
 };
 
 const char *static_debugs_conflines[] = {
        "debug static events",
-       "debug static route"
+       "debug static route",
+       "debug static bfd"
 };
 /* clang-format on */
 
@@ -105,7 +109,8 @@ int static_debug_status_write(struct vty *vty)
  *    Debug general internal events
  *
  */
-void static_debug_set(int vtynode, bool onoff, bool events, bool route)
+void static_debug_set(int vtynode, bool onoff, bool events, bool route,
+                     bool bfd)
 {
        uint32_t mode = DEBUG_NODE2MODE(vtynode);
 
@@ -113,6 +118,10 @@ void static_debug_set(int vtynode, bool onoff, bool events, bool route)
                DEBUG_MODE_SET(&static_dbg_events, mode, onoff);
        if (route)
                DEBUG_MODE_SET(&static_dbg_route, mode, onoff);
+       if (bfd) {
+               DEBUG_MODE_SET(&static_dbg_bfd, mode, onoff);
+               bfd_protocol_integration_set_debug(onoff);
+       }
 }
 
 /*
index ee9f7b053737ab82e165bbf5453f2fdd906848c2..129c09668819f0c9b1437cd7ecb8aa48abae0ac0 100644 (file)
@@ -34,6 +34,7 @@ extern "C" {
 /* staticd debugging records */
 extern struct debug static_dbg_events;
 extern struct debug static_dbg_route;
+extern struct debug static_dbg_bfd;
 
 /*
  * Initialize staticd debugging.
@@ -71,7 +72,8 @@ int static_debug_status_write(struct vty *vty);
  *    Debug general internal events
  *
  */
-void static_debug_set(int vtynode, bool onoff, bool events, bool route);
+void static_debug_set(int vtynode, bool onoff, bool events, bool route,
+                     bool bfd);
 
 #ifdef __cplusplus
 }
index d62ea092b3ecc475f3cac20bb1584b0aca70cced..ff79622038d26c64cbf3bf2471444947c1d98407 100644 (file)
@@ -1457,16 +1457,17 @@ int static_path_list_cli_cmp(const struct lyd_node *dnode1,
 }
 
 DEFPY_YANG(debug_staticd, debug_staticd_cmd,
-          "[no] debug static [{events$events|route$route}]",
+          "[no] debug static [{events$events|route$route|bfd$bfd}]",
           NO_STR DEBUG_STR STATICD_STR
           "Debug events\n"
-          "Debug route\n")
+          "Debug route\n"
+          "Debug bfd\n")
 {
        /* If no specific category, change all */
        if (strmatch(argv[argc - 1]->text, "static"))
-               static_debug_set(vty->node, !no, true, true);
+               static_debug_set(vty->node, !no, true, true, true);
        else
-               static_debug_set(vty->node, !no, !!events, !!route);
+               static_debug_set(vty->node, !no, !!events, !!route, !!bfd);
 
        return CMD_SUCCESS;
 }