#include "bgpd/bgp_flowspec.h"
#include "bgpd/bgp_packet.h"
+#include "bgpd/bgp_debug_clippy.c"
+
unsigned long conf_bgp_debug_as4;
unsigned long conf_bgp_debug_neighbor_events;
unsigned long conf_bgp_debug_events;
}
static bool bgp_debug_list_remove_entry(struct list *list, const char *host,
- struct prefix *p)
+ const struct prefix *p)
{
struct bgp_debug_filter *filter;
struct listnode *node, *nnode;
}
/* debug bgp bestpath */
-DEFUN (debug_bgp_bestpath_prefix,
+DEFPY (debug_bgp_bestpath_prefix,
debug_bgp_bestpath_prefix_cmd,
- "debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
+ "debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>$prefix",
DEBUG_STR
BGP_STR
"BGP bestpath\n"
"IPv4 prefix\n"
"IPv6 prefix\n")
{
- struct prefix argv_p;
- int idx_ipv4_ipv6_prefixlen = 3;
-
- (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, &argv_p);
- apply_mask(&argv_p);
-
if (!bgp_debug_bestpath_prefixes)
bgp_debug_bestpath_prefixes = list_new();
if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL,
- &argv_p)) {
+ prefix)) {
vty_out(vty,
"BGP bestpath debugging is already enabled for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ prefix_str);
return CMD_SUCCESS;
}
- bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes, NULL, &argv_p);
+ bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes, NULL, prefix);
if (vty->node == CONFIG_NODE) {
DEBUG_ON(bestpath, BESTPATH);
} else {
TERM_DEBUG_ON(bestpath, BESTPATH);
vty_out(vty, "BGP bestpath debugging is on for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ prefix_str);
}
return CMD_SUCCESS;
}
-DEFUN (no_debug_bgp_bestpath_prefix,
+DEFPY (no_debug_bgp_bestpath_prefix,
no_debug_bgp_bestpath_prefix_cmd,
- "no debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
+ "no debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>$prefix",
NO_STR
DEBUG_STR
BGP_STR
"IPv4 prefix\n"
"IPv6 prefix\n")
{
- int idx_ipv4_ipv6_prefixlen = 4;
- struct prefix *argv_p;
- int found_prefix = 0;
-
- argv_p = prefix_new();
- (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- apply_mask(argv_p);
+ bool found_prefix = false;
if (bgp_debug_bestpath_prefixes
&& !list_isempty(bgp_debug_bestpath_prefixes)) {
found_prefix = bgp_debug_list_remove_entry(
- bgp_debug_bestpath_prefixes, NULL, argv_p);
+ bgp_debug_bestpath_prefixes, NULL, prefix);
if (list_isempty(bgp_debug_bestpath_prefixes)) {
if (vty->node == CONFIG_NODE) {
if (found_prefix)
vty_out(vty, "BGP bestpath debugging is off for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ prefix_str);
else
vty_out(vty, "BGP bestpath debugging was not enabled for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ prefix_str);
return CMD_SUCCESS;
}
return CMD_SUCCESS;
}
-#include "bgpd/bgp_debug_clippy.c"
-
DEFPY (debug_bgp_update_prefix_afi_safi,
debug_bgp_update_prefix_afi_safi_cmd,
"debug bgp updates prefix l2vpn$afi evpn$safi type <<macip|2> mac <X:X:X:X:X:X|X:X:X:X:X:X/M> [ip <A.B.C.D|X:X::X:X>]|<multicast|3> ip <A.B.C.D|X:X::X:X>|<prefix|5> ip <A.B.C.D/M|X:X::X:X/M>>",
}
-DEFUN (debug_bgp_update_prefix,
+DEFPY (debug_bgp_update_prefix,
debug_bgp_update_prefix_cmd,
- "debug bgp updates prefix <A.B.C.D/M|X:X::X:X/M>",
+ "debug bgp updates prefix <A.B.C.D/M|X:X::X:X/M>$prefix",
DEBUG_STR
BGP_STR
"BGP updates\n"
"IPv4 prefix\n"
"IPv6 prefix\n")
{
- int idx_ipv4_ipv6_prefixlen = 4;
- struct prefix argv_p;
-
- (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, &argv_p);
- apply_mask(&argv_p);
-
if (!bgp_debug_update_prefixes)
bgp_debug_update_prefixes = list_new();
- if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL,
- &argv_p)) {
+ if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, prefix)) {
vty_out(vty,
"BGP updates debugging is already enabled for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ prefix_str);
return CMD_SUCCESS;
}
- bgp_debug_list_add_entry(bgp_debug_update_prefixes, NULL, &argv_p);
+ bgp_debug_list_add_entry(bgp_debug_update_prefixes, NULL, prefix);
if (vty->node == CONFIG_NODE) {
DEBUG_ON(update, UPDATE_PREFIX);
} else {
TERM_DEBUG_ON(update, UPDATE_PREFIX);
vty_out(vty, "BGP updates debugging is on for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ prefix_str);
}
return CMD_SUCCESS;
}
-DEFUN (no_debug_bgp_update_prefix,
+DEFPY (no_debug_bgp_update_prefix,
no_debug_bgp_update_prefix_cmd,
- "no debug bgp updates prefix <A.B.C.D/M|X:X::X:X/M>",
+ "no debug bgp updates prefix <A.B.C.D/M|X:X::X:X/M>$prefix",
NO_STR
DEBUG_STR
BGP_STR
"IPv4 prefix\n"
"IPv6 prefix\n")
{
- int idx_ipv4_ipv6_prefixlen = 5;
- struct prefix *argv_p;
- int found_prefix = 0;
-
- argv_p = prefix_new();
- (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- apply_mask(argv_p);
+ bool found_prefix = false;
if (bgp_debug_update_prefixes
&& !list_isempty(bgp_debug_update_prefixes)) {
found_prefix = bgp_debug_list_remove_entry(
- bgp_debug_update_prefixes, NULL, argv_p);
+ bgp_debug_update_prefixes, NULL, prefix);
if (list_isempty(bgp_debug_update_prefixes)) {
if (vty->node == CONFIG_NODE) {
if (found_prefix)
vty_out(vty, "BGP updates debugging is off for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ prefix_str);
else
vty_out(vty, "BGP updates debugging was not enabled for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ prefix_str);
return CMD_SUCCESS;
}
}
-DEFUN (debug_bgp_zebra_prefix,
+DEFPY (debug_bgp_zebra_prefix,
debug_bgp_zebra_prefix_cmd,
- "debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>",
+ "debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>$prefix",
DEBUG_STR
BGP_STR
"BGP Zebra messages\n"
"IPv4 prefix\n"
"IPv6 prefix\n")
{
- int idx_ipv4_ipv6_prefixlen = 4;
- struct prefix argv_p;
-
- (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, &argv_p);
- apply_mask(&argv_p);
-
if (!bgp_debug_zebra_prefixes)
bgp_debug_zebra_prefixes = list_new();
- if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes, NULL, &argv_p)) {
+ if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes, NULL, prefix)) {
vty_out(vty, "BGP zebra debugging is already enabled for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ prefix_str);
return CMD_SUCCESS;
}
- bgp_debug_list_add_entry(bgp_debug_zebra_prefixes, NULL, &argv_p);
+ bgp_debug_list_add_entry(bgp_debug_zebra_prefixes, NULL, prefix);
if (vty->node == CONFIG_NODE)
DEBUG_ON(zebra, ZEBRA);
else {
TERM_DEBUG_ON(zebra, ZEBRA);
- vty_out(vty, "BGP zebra debugging is on for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ vty_out(vty, "BGP zebra debugging is on for %s\n", prefix_str);
}
return CMD_SUCCESS;
return CMD_SUCCESS;
}
-DEFUN (no_debug_bgp_zebra_prefix,
+DEFPY (no_debug_bgp_zebra_prefix,
no_debug_bgp_zebra_prefix_cmd,
- "no debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>",
+ "no debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>$prefix",
NO_STR
DEBUG_STR
BGP_STR
"IPv4 prefix\n"
"IPv6 prefix\n")
{
- int idx_ipv4_ipv6_prefixlen = 5;
- struct prefix argv_p;
- int found_prefix = 0;
-
- (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, &argv_p);
- apply_mask(&argv_p);
+ bool found_prefix = false;
if (bgp_debug_zebra_prefixes
&& !list_isempty(bgp_debug_zebra_prefixes)) {
found_prefix = bgp_debug_list_remove_entry(
- bgp_debug_zebra_prefixes, NULL, &argv_p);
+ bgp_debug_zebra_prefixes, NULL, prefix);
if (list_isempty(bgp_debug_zebra_prefixes)) {
if (vty->node == CONFIG_NODE)
}
if (found_prefix)
- vty_out(vty, "BGP zebra debugging is off for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ vty_out(vty, "BGP zebra debugging is off for %s\n", prefix_str);
else
vty_out(vty, "BGP zebra debugging was not enabled for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ prefix_str);
return CMD_SUCCESS;
}