summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-09-19 09:11:18 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2024-01-11 14:38:23 +0100
commitfc7b90595926d589f339dd67acb665007ba2f2cd (patch)
treef12204b1b7c0ddac1ca11f47d5f38c7deb28a1ed
parent6edd9e4bea233a45720ec9a1327990665dadaba9 (diff)
bgpd: add hooks for displaying module debug messages
when a plugin is attached, some debugs may be attached to that plugin. For that, add one hook that is interacting with vty: a boolean indicates what the usage is for: either for impacting the 'show running-config', or for impacting the 'show debugging' command. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
-rw-r--r--bgpd/bgp_debug.c9
-rw-r--r--bgpd/bgp_debug.h6
2 files changed, 15 insertions, 0 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index bd5d94908e..3ecdc0d3cf 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -16,6 +16,7 @@
#include "memory.h"
#include "queue.h"
#include "filter.h"
+#include "hook.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_aspath.h"
@@ -37,6 +38,9 @@
#include "bgpd/bgp_debug_clippy.c"
+DEFINE_HOOK(bgp_hook_config_write_debug, (struct vty *vty, bool running),
+ (vty, running));
+
unsigned long conf_bgp_debug_as4;
unsigned long conf_bgp_debug_neighbor_events;
unsigned long conf_bgp_debug_events;
@@ -2272,6 +2276,8 @@ DEFUN_NOSH (show_debugging_bgp,
cmd_show_lib_debugs(vty);
+ hook_call(bgp_hook_config_write_debug, vty, false);
+
return CMD_SUCCESS;
}
@@ -2411,6 +2417,9 @@ static int bgp_config_write_debug(struct vty *vty)
write++;
}
+ if (hook_call(bgp_hook_config_write_debug, vty, true))
+ write++;
+
return write;
}
diff --git a/bgpd/bgp_debug.h b/bgpd/bgp_debug.h
index bb4ddea81e..5b09501852 100644
--- a/bgpd/bgp_debug.h
+++ b/bgpd/bgp_debug.h
@@ -6,9 +6,15 @@
#ifndef _QUAGGA_BGP_DEBUG_H
#define _QUAGGA_BGP_DEBUG_H
+#include "hook.h"
+#include "vty.h"
+
#include "bgp_attr.h"
#include "bgp_updgrp.h"
+DECLARE_HOOK(bgp_hook_config_write_debug, (struct vty *vty, bool running),
+ (vty, running));
+
/* sort of packet direction */
#define DUMP_ON 1
#define DUMP_SEND 2