unsigned long conf_bgp_debug_evpn_mh;
unsigned long conf_bgp_debug_bfd;
unsigned long conf_bgp_debug_cond_adv;
+unsigned long conf_bgp_debug_aggregate;
unsigned long term_bgp_debug_as4;
unsigned long term_bgp_debug_neighbor_events;
unsigned long term_bgp_debug_evpn_mh;
unsigned long term_bgp_debug_bfd;
unsigned long term_bgp_debug_cond_adv;
+unsigned long term_bgp_debug_aggregate;
struct list *bgp_debug_neighbor_events_peers = NULL;
struct list *bgp_debug_keepalive_peers = NULL;
struct list *bgp_debug_update_prefixes = NULL;
struct list *bgp_debug_bestpath_prefixes = NULL;
struct list *bgp_debug_zebra_prefixes = NULL;
+struct list *bgp_debug_aggregate_prefixes;
/* messages for BGP-4 status */
const struct message bgp_status_msg[] = {{Idle, "Idle"},
return CMD_SUCCESS;
}
+/* debug bgp aggregate */
+DEFPY (debug_bgp_aggregate,
+ debug_bgp_aggregate_cmd,
+ "debug bgp aggregate",
+ DEBUG_STR
+ BGP_STR
+ "BGP aggregate\n")
+{
+ if (vty->node == CONFIG_NODE)
+ DEBUG_ON(aggregate, AGGREGATE);
+ else {
+ TERM_DEBUG_ON(aggregate, AGGREGATE);
+ vty_out(vty, "BGP aggregate debugging is on\n");
+ }
+ return CMD_SUCCESS;
+}
+
+DEFPY (no_debug_bgp_aggregate,
+ no_debug_bgp_aggregate_cmd,
+ "no debug bgp aggregate",
+ NO_STR
+ DEBUG_STR
+ BGP_STR
+ "BGP aggregate\n")
+{
+ bgp_debug_list_free(bgp_debug_aggregate_prefixes);
+
+ if (vty->node == CONFIG_NODE)
+ DEBUG_OFF(aggregate, AGGREGATE);
+ else {
+ TERM_DEBUG_OFF(aggregate, AGGREGATE);
+ vty_out(vty, "BGP aggregate debugging is off\n");
+ }
+ return CMD_SUCCESS;
+}
+
+DEFPY (debug_bgp_aggregate_prefix,
+ debug_bgp_aggregate_prefix_cmd,
+ "debug bgp aggregate prefix <A.B.C.D/M|X:X::X:X/M>$prefix",
+ DEBUG_STR
+ BGP_STR
+ "BGP aggregate\n"
+ "Specify a prefix to debug\n"
+ "IPv4 prefix\n"
+ "IPv6 prefix\n")
+{
+ if (!bgp_debug_aggregate_prefixes)
+ bgp_debug_aggregate_prefixes = list_new();
+
+ if (bgp_debug_list_has_entry(bgp_debug_aggregate_prefixes, NULL, prefix, NULL)) {
+ vty_out(vty, "BGP aggregate debugging is already enabled for %s\n", prefix_str);
+ return CMD_SUCCESS;
+ }
+
+ bgp_debug_list_add_entry(bgp_debug_aggregate_prefixes, NULL, prefix, NULL);
+
+ if (vty->node == CONFIG_NODE)
+ DEBUG_ON(aggregate, AGGREGATE);
+ else {
+ TERM_DEBUG_ON(aggregate, AGGREGATE);
+ vty_out(vty, "BGP aggregate debugging is on for %s\n", prefix_str);
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (no_debug_bgp_aggregate_prefix,
+ no_debug_bgp_aggregate_prefix_cmd,
+ "no debug bgp aggregate prefix <A.B.C.D/M|X:X::X:X/M>$prefix",
+ NO_STR
+ DEBUG_STR
+ BGP_STR
+ "BGP aggregate\n"
+ "Specify a prefix to debug\n"
+ "IPv4 prefix\n"
+ "IPv6 prefix\n")
+{
+ bool found_prefix = false;
+
+ if (bgp_debug_aggregate_prefixes && !list_isempty(bgp_debug_aggregate_prefixes)) {
+ found_prefix = bgp_debug_list_remove_entry(bgp_debug_aggregate_prefixes, NULL,
+ (struct prefix *)prefix);
+
+ if (list_isempty(bgp_debug_aggregate_prefixes)) {
+ if (vty->node == CONFIG_NODE)
+ DEBUG_OFF(aggregate, AGGREGATE);
+ else {
+ TERM_DEBUG_OFF(aggregate, AGGREGATE);
+ vty_out(vty, "BGP aggregate debugging is off\n");
+ }
+ }
+ }
+
+ if (found_prefix)
+ vty_out(vty, "BGP aggregate debugging is off for %s\n", prefix_str);
+ else
+ vty_out(vty, "BGP aggregate debugging was not enabled for %s\n", prefix_str);
+
+ return CMD_SUCCESS;
+}
+
/* debug bgp update-groups */
DEFUN (debug_bgp_update_groups,
debug_bgp_update_groups_cmd,
bgp_debug_list_print(vty, " BGP zebra debugging is on",
bgp_debug_zebra_prefixes);
+ if (BGP_DEBUG(aggregate, AGGREGATE))
+ bgp_debug_list_print(vty, " BGP aggregate debugging is on",
+ bgp_debug_aggregate_prefixes);
+
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
vty_out(vty, " BGP graceful-restart debugging is on\n");
write++;
}
+ if (CONF_BGP_DEBUG(aggregate, AGGREGATE)) {
+ if (!bgp_debug_aggregate_prefixes || list_isempty(bgp_debug_aggregate_prefixes)) {
+ vty_out(vty, "debug bgp aggregate\n");
+ write++;
+ } else {
+ write += bgp_debug_list_conf_print(vty, "debug bgp aggregate prefix",
+ bgp_debug_aggregate_prefixes);
+ }
+ }
+
if (hook_call(bgp_hook_config_write_debug, vty, true))
write++;
install_element(ENABLE_NODE, &no_debug_bgp_zebra_prefix_cmd);
install_element(CONFIG_NODE, &no_debug_bgp_zebra_prefix_cmd);
+ /* debug bgp aggregate prefix A.B.C.D/M */
+ install_element(ENABLE_NODE, &debug_bgp_aggregate_cmd);
+ install_element(CONFIG_NODE, &debug_bgp_aggregate_cmd);
+ install_element(ENABLE_NODE, &no_debug_bgp_aggregate_cmd);
+ install_element(CONFIG_NODE, &no_debug_bgp_aggregate_cmd);
+ install_element(ENABLE_NODE, &debug_bgp_aggregate_prefix_cmd);
+ install_element(CONFIG_NODE, &debug_bgp_aggregate_prefix_cmd);
+ install_element(ENABLE_NODE, &no_debug_bgp_aggregate_prefix_cmd);
+ install_element(CONFIG_NODE, &no_debug_bgp_aggregate_prefix_cmd);
+
install_element(ENABLE_NODE, &no_debug_bgp_as4_cmd);
install_element(CONFIG_NODE, &no_debug_bgp_as4_cmd);
install_element(ENABLE_NODE, &no_debug_bgp_as4_segment_cmd);
return false;
}
+bool bgp_debug_aggregate(const struct prefix *p)
+{
+ if (BGP_DEBUG(aggregate, AGGREGATE)) {
+ if (bgp_debug_per_prefix(p, term_bgp_debug_aggregate, BGP_DEBUG_AGGREGATE,
+ bgp_debug_aggregate_prefixes))
+ return true;
+ }
+
+ return false;
+}
+
const char *bgp_debug_rdpfxpath2str(afi_t afi, safi_t safi,
const struct prefix_rd *prd,
union prefixconstptr pu,
extern unsigned long conf_bgp_debug_evpn_mh;
extern unsigned long conf_bgp_debug_bfd;
extern unsigned long conf_bgp_debug_cond_adv;
+extern unsigned long conf_bgp_debug_aggregate;
extern unsigned long term_bgp_debug_as4;
extern unsigned long term_bgp_debug_neighbor_events;
extern unsigned long term_bgp_debug_evpn_mh;
extern unsigned long term_bgp_debug_bfd;
extern unsigned long term_bgp_debug_cond_adv;
+extern unsigned long term_bgp_debug_aggregate;
extern struct list *bgp_debug_neighbor_events_peers;
extern struct list *bgp_debug_keepalive_peers;
extern struct list *bgp_debug_update_prefixes;
extern struct list *bgp_debug_bestpath_prefixes;
extern struct list *bgp_debug_zebra_prefixes;
+extern struct list *bgp_debug_aggregate_prefixes;
struct bgp_debug_filter {
char *host;
#define BGP_DEBUG_BFD_LIB 0x01
#define BGP_DEBUG_COND_ADV 0x01
+#define BGP_DEBUG_AGGREGATE 0x01
#define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
#define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
struct update_group *updgrp, unsigned int inbound);
extern bool bgp_debug_bestpath(struct bgp_dest *dest);
extern bool bgp_debug_zebra(const struct prefix *p);
+extern bool bgp_debug_aggregate(const struct prefix *p);
extern const char *bgp_debug_rdpfxpath2str(
afi_t afi, safi_t safi, const struct prefix_rd *prd,
struct bgp_table *table;
struct bgp_path_info *pi, *orig, *new;
struct attr *attr;
+ bool debug = bgp_debug_aggregate(p);
+
+ if (debug)
+ zlog_debug("%s: aggregate %pFX, count %lu", __func__, p, aggregate->count);
table = bgp->rib[afi][safi];
ecommunity_free(&ecommunity);
if (lcommunity)
lcommunity_free(&lcommunity);
-
+ if (debug)
+ zlog_debug(" aggregate %pFX: duplicate", p);
return;
}
if (pi) {
bgp_path_info_delete(dest, pi);
bgp_process(bgp, dest, pi, afi, safi);
+ if (debug)
+ zlog_debug(" aggregate %pFX: existing, removed", p);
}
attr = bgp_attr_aggregate_intern(
lcommunity_free(&lcommunity);
bgp_dest_unlock_node(dest);
bgp_aggregate_delete(bgp, p, afi, safi, aggregate);
- if (BGP_DEBUG(update_groups, UPDATE_GROUPS))
- zlog_debug("%s: %pFX null attribute", __func__,
- p);
+ if (debug)
+ zlog_debug("%s: %pFX null attribute", __func__, p);
return;
}
bgp_path_info_add(dest, new);
bgp_process(bgp, dest, new, afi, safi);
+ if (debug)
+ zlog_debug(" aggregate %pFX: installed", p);
} else {
uninstall_aggregate_route:
for (pi = orig; pi; pi = pi->next)
if (pi) {
bgp_path_info_delete(dest, pi);
bgp_process(bgp, dest, pi, afi, safi);
+ if (debug)
+ zlog_debug(" aggregate %pFX: uninstall", p);
}
}