diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2021-09-28 14:53:23 +0200 |
---|---|---|
committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2023-01-13 19:32:12 +0100 |
commit | b27499d6ba93da119836aaede4cdccaf37981c9f (patch) | |
tree | 1d77b8fcb687820573a1eedc0096d53f8204136a /staticd | |
parent | topotests: test BFD static route integration (diff) | |
download | frr-b27499d6ba93da119836aaede4cdccaf37981c9f.tar.xz frr-b27499d6ba93da119836aaede4cdccaf37981c9f.zip |
staticd: add debug static bfd command
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>
Diffstat (limited to 'staticd')
-rw-r--r-- | staticd/static_bfd.c | 7 | ||||
-rw-r--r-- | staticd/static_debug.c | 15 | ||||
-rw-r--r-- | staticd/static_debug.h | 4 | ||||
-rw-r--r-- | staticd/static_vty.c | 9 |
4 files changed, 25 insertions, 10 deletions
diff --git a/staticd/static_bfd.c b/staticd/static_bfd.c index a955d155e..fc8b518e1 100644 --- a/staticd/static_bfd.c +++ b/staticd/static_bfd.c @@ -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; diff --git a/staticd/static_debug.c b/staticd/static_debug.c index 45f845b40..847e7d61a 100644 --- a/staticd/static_debug.c +++ b/staticd/static_debug.c @@ -24,6 +24,7 @@ #include "lib/command.h" #include "lib/debug.h" +#include "lib/bfd.h" #include "static_debug.h" @@ -35,15 +36,18 @@ /* 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); + } } /* diff --git a/staticd/static_debug.h b/staticd/static_debug.h index ee9f7b053..129c09668 100644 --- a/staticd/static_debug.h +++ b/staticd/static_debug.h @@ -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 } diff --git a/staticd/static_vty.c b/staticd/static_vty.c index d62ea092b..ff7962203 100644 --- a/staticd/static_vty.c +++ b/staticd/static_vty.c @@ -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; } |