mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 15:10:38 +00:00
bgpd: link rpki debug with bgp debugging hook
rpki debugging is linked with standard bgp debugging facilities. - debug rpki is dumped in running-config if the command is executed from configure terminal. - show debugging indicated whether rpki debug is enabled or not. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
aa31aef359
commit
fed3793b6a
@ -48,6 +48,7 @@
|
||||
#include "bgpd/bgp_attr.h"
|
||||
#include "bgpd/bgp_aspath.h"
|
||||
#include "bgpd/bgp_route.h"
|
||||
#include "bgpd/bgp_debug.h"
|
||||
#include "lib/network.h"
|
||||
#include "lib/thread.h"
|
||||
#ifndef VTYSH_EXTRACT_PL
|
||||
@ -73,7 +74,7 @@ DEFINE_MTYPE_STATIC(BGPD, BGP_RPKI_CACHE_GROUP, "BGP RPKI Cache server group")
|
||||
#define RETRY_INTERVAL_DEFAULT 600
|
||||
|
||||
#define RPKI_DEBUG(...) \
|
||||
if (rpki_debug) { \
|
||||
if (rpki_debug_conf || rpki_debug_term) { \
|
||||
zlog_debug("RPKI: " __VA_ARGS__); \
|
||||
}
|
||||
|
||||
@ -98,6 +99,7 @@ struct rpki_for_each_record_arg {
|
||||
as_t as;
|
||||
};
|
||||
|
||||
static int bgp_rpki_write_debug(struct vty *vty, bool running);
|
||||
static int start(void);
|
||||
static void stop(void);
|
||||
static int reset(bool force);
|
||||
@ -136,7 +138,7 @@ static struct list *cache_list;
|
||||
static int rtr_is_running;
|
||||
static int rtr_is_stopping;
|
||||
static _Atomic int rtr_update_overflow;
|
||||
static int rpki_debug;
|
||||
static int rpki_debug_conf, rpki_debug_term;
|
||||
static unsigned int polling_period;
|
||||
static unsigned int expire_interval;
|
||||
static unsigned int retry_interval;
|
||||
@ -535,7 +537,8 @@ err:
|
||||
|
||||
static int bgp_rpki_init(struct thread_master *master)
|
||||
{
|
||||
rpki_debug = 0;
|
||||
rpki_debug_conf = 0;
|
||||
rpki_debug_term = 0;
|
||||
rtr_is_running = 0;
|
||||
rtr_is_stopping = 0;
|
||||
|
||||
@ -567,6 +570,7 @@ static int bgp_rpki_module_init(void)
|
||||
|
||||
hook_register(frr_late_init, bgp_rpki_init);
|
||||
hook_register(frr_early_fini, &bgp_rpki_fini);
|
||||
hook_register(bgp_hook_config_write_debug, &bgp_rpki_write_debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -904,7 +908,6 @@ static void free_cache(struct cache *cache)
|
||||
XFREE(MTYPE_BGP_RPKI_CACHE, cache);
|
||||
}
|
||||
|
||||
|
||||
/* return true if config changed from default */
|
||||
static bool config_changed(void)
|
||||
{
|
||||
@ -917,15 +920,25 @@ static bool config_changed(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
static int bgp_rpki_write_debug(struct vty *vty, bool running)
|
||||
{
|
||||
if (rpki_debug_conf && running) {
|
||||
vty_out(vty, "debug rpki\n");
|
||||
return 1;
|
||||
}
|
||||
if ((rpki_debug_conf || rpki_debug_term) && !running) {
|
||||
vty_out(vty, " BGP RPKI debugging is on\n");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int config_write(struct vty *vty)
|
||||
{
|
||||
struct listnode *cache_node;
|
||||
struct cache *cache;
|
||||
|
||||
if (listcount(cache_list) && config_changed()) {
|
||||
if (rpki_debug)
|
||||
vty_out(vty, "debug rpki\n");
|
||||
|
||||
vty_out(vty, "!\n");
|
||||
vty_out(vty, "rpki\n");
|
||||
if (polling_period != POLLING_PERIOD_DEFAULT)
|
||||
@ -1479,7 +1492,10 @@ DEFUN (debug_rpki,
|
||||
DEBUG_STR
|
||||
"Enable debugging for rpki\n")
|
||||
{
|
||||
rpki_debug = 1;
|
||||
if (vty->node == CONFIG_NODE)
|
||||
rpki_debug_conf = 1;
|
||||
else
|
||||
rpki_debug_term = 1;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1490,7 +1506,10 @@ DEFUN (no_debug_rpki,
|
||||
DEBUG_STR
|
||||
"Disable debugging for rpki\n")
|
||||
{
|
||||
rpki_debug = 0;
|
||||
if (vty->node == CONFIG_NODE)
|
||||
rpki_debug_conf = 0;
|
||||
else
|
||||
rpki_debug_term = 0;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user