summaryrefslogtreecommitdiff
path: root/bgpd/bgp_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_debug.c')
-rw-r--r--bgpd/bgp_debug.c229
1 files changed, 153 insertions, 76 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index 46d3afbf79..232f53c778 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -38,6 +38,9 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_debug.h"
#include "bgpd/bgp_community.h"
#include "bgpd/bgp_updgrp.h"
+#include "bgpd/bgp_mplsvpn.h"
+
+#define BGP_ADDPATH_STR 20
unsigned long conf_bgp_debug_as4;
unsigned long conf_bgp_debug_neighbor_events;
@@ -182,12 +185,14 @@ const char *bgp_origin_long_str[] = {"IGP","EGP","incomplete"};
static struct peer *
bgp_find_peer (struct vty *vty, const char *peer_str)
{
+ struct bgp *bgp = VTY_GET_CONTEXT(bgp);
int ret;
union sockunion su;
- struct bgp *bgp;
struct peer *peer;
- bgp = vty->index;
+ if (!bgp) {
+ return NULL;
+ }
ret = str2sockunion (peer_str, &su);
/* 'swpX' string */
@@ -390,7 +395,6 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size)
snprintf (buf + strlen (buf), size - strlen (buf), ", origin %s",
bgp_origin_str[attr->origin]);
-#ifdef HAVE_IPV6
if (attr->extra)
{
char addrbuf[BUFSIZ];
@@ -407,7 +411,6 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size)
inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local,
addrbuf, BUFSIZ));
}
-#endif /* HAVE_IPV6 */
if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF)))
snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %u",
@@ -488,6 +491,21 @@ bgp_notify_subcode_str (char code, char subcode)
return "";
}
+/* extract notify admin reason if correctly present */
+const char *
+bgp_notify_admin_message(char *buf, size_t bufsz, u_char *data, size_t datalen)
+{
+ if (!data || datalen < 1)
+ return NULL;
+
+ u_char len = data[0];
+ if (len > 128
+ || len > datalen - 1)
+ return NULL;
+
+ return zlog_sanitize(buf, bufsz, data + 1, len);
+}
+
/* dump notify packet */
void
bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify,
@@ -495,17 +513,37 @@ bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify,
{
const char *subcode_str;
const char *code_str;
+ const char *msg_str = NULL;
+ char msg_buf[1024];
if (BGP_DEBUG (neighbor_events, NEIGHBOR_EVENTS) || bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES))
{
code_str = bgp_notify_code_str(bgp_notify->code);
subcode_str = bgp_notify_subcode_str(bgp_notify->code, bgp_notify->subcode);
- zlog_info ("%%NOTIFICATION: %s neighbor %s %d/%d (%s%s) %d bytes %s",
- strcmp (direct, "received") == 0 ? "received from" : "sent to",
- peer->host, bgp_notify->code, bgp_notify->subcode,
- code_str, subcode_str, bgp_notify->length,
- bgp_notify->data ? bgp_notify->data : "");
+ if (bgp_notify->code == BGP_NOTIFY_CEASE
+ && (bgp_notify->subcode == BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
+ || bgp_notify->subcode == BGP_NOTIFY_CEASE_ADMIN_RESET))
+ {
+ msg_str = bgp_notify_admin_message(msg_buf, sizeof(msg_buf),
+ bgp_notify->raw_data, bgp_notify->length);
+ }
+
+ if (msg_str)
+ {
+ zlog_info ("%%NOTIFICATION: %s neighbor %s %d/%d (%s%s) \"%s\"",
+ strcmp (direct, "received") == 0 ? "received from" : "sent to",
+ peer->host, bgp_notify->code, bgp_notify->subcode,
+ code_str, subcode_str, msg_str);
+ }
+ else
+ {
+ msg_str = bgp_notify->data ? bgp_notify->data : "";
+ zlog_info ("%%NOTIFICATION: %s neighbor %s %d/%d (%s%s) %d bytes %s",
+ strcmp (direct, "received") == 0 ? "received from" : "sent to",
+ peer->host, bgp_notify->code, bgp_notify->subcode,
+ code_str, subcode_str, bgp_notify->length, msg_str);
+ }
}
}
@@ -621,7 +659,7 @@ DEFUN (debug_bgp_neighbor_events,
DEFUN (debug_bgp_neighbor_events_peer,
debug_bgp_neighbor_events_peer_cmd,
- "debug bgp neighbor-events (A.B.C.D|X:X::X:X|WORD)",
+ "debug bgp neighbor-events <A.B.C.D|X:X::X:X|WORD>",
DEBUG_STR
BGP_STR
"BGP Neighbor Events\n"
@@ -629,7 +667,8 @@ DEFUN (debug_bgp_neighbor_events_peer,
"BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n")
{
- const char *host = argv[0];
+ int idx_peer = 3;
+ const char *host = argv[idx_peer]->arg;
if (!bgp_debug_neighbor_events_peers)
bgp_debug_neighbor_events_peers = list_new ();
@@ -674,7 +713,7 @@ DEFUN (no_debug_bgp_neighbor_events,
DEFUN (no_debug_bgp_neighbor_events_peer,
no_debug_bgp_neighbor_events_peer_cmd,
- "no debug bgp neighbor-events (A.B.C.D|X:X::X:X|WORD)",
+ "no debug bgp neighbor-events <A.B.C.D|X:X::X:X|WORD>",
NO_STR
DEBUG_STR
BGP_STR
@@ -683,8 +722,9 @@ DEFUN (no_debug_bgp_neighbor_events_peer,
"BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n")
{
+ int idx_peer = 4;
int found_peer = 0;
- const char *host = argv[0];
+ const char *host = argv[idx_peer]->arg;
if (bgp_debug_neighbor_events_peers && !list_isempty(bgp_debug_neighbor_events_peers))
{
@@ -765,7 +805,7 @@ DEFUN (debug_bgp_keepalive,
DEFUN (debug_bgp_keepalive_peer,
debug_bgp_keepalive_peer_cmd,
- "debug bgp keepalives (A.B.C.D|X:X::X:X|WORD)",
+ "debug bgp keepalives <A.B.C.D|X:X::X:X|WORD>",
DEBUG_STR
BGP_STR
"BGP Neighbor Events\n"
@@ -773,7 +813,8 @@ DEFUN (debug_bgp_keepalive_peer,
"BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n")
{
- const char *host = argv[0];
+ int idx_peer = 3;
+ const char *host = argv[idx_peer]->arg;
if (!bgp_debug_keepalive_peers)
bgp_debug_keepalive_peers = list_new ();
@@ -818,7 +859,7 @@ DEFUN (no_debug_bgp_keepalive,
DEFUN (no_debug_bgp_keepalive_peer,
no_debug_bgp_keepalive_peer_cmd,
- "no debug bgp keepalives (A.B.C.D|X:X::X:X|WORD)",
+ "no debug bgp keepalives <A.B.C.D|X:X::X:X|WORD>",
NO_STR
DEBUG_STR
BGP_STR
@@ -827,8 +868,9 @@ DEFUN (no_debug_bgp_keepalive_peer,
"BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n")
{
+ int idx_peer = 4;
int found_peer = 0;
- const char *host = argv[0];
+ const char *host = argv[idx_peer]->arg;
if (bgp_debug_keepalive_peers && !list_isempty(bgp_debug_keepalive_peers))
{
@@ -854,19 +896,20 @@ DEFUN (no_debug_bgp_keepalive_peer,
/* debug bgp bestpath */
DEFUN (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>",
DEBUG_STR
BGP_STR
"BGP bestpath\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "IPv6 prefix <network>/<length>\n")
+ "IPv4 prefix\n"
+ "IPv6 prefix\n")
{
+ int idx_ipv4_ipv6_prefixlen = 3;
struct prefix *argv_p;
int ret;
argv_p = prefix_new();
- ret = str2prefix (argv[0], argv_p);
+ ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
if (!ret)
{
prefix_free(argv_p);
@@ -880,7 +923,7 @@ DEFUN (debug_bgp_bestpath_prefix,
if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL, argv_p))
{
- vty_out (vty, "BGP bestptah debugging is already enabled for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP bestptah debugging is already enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -893,7 +936,7 @@ DEFUN (debug_bgp_bestpath_prefix,
else
{
TERM_DEBUG_ON (bestpath, BESTPATH);
- vty_out (vty, "BGP bestpath debugging is on for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP bestpath debugging is on for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
}
return CMD_SUCCESS;
@@ -901,21 +944,22 @@ DEFUN (debug_bgp_bestpath_prefix,
DEFUN (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>",
NO_STR
DEBUG_STR
BGP_STR
"BGP bestpath\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "IPv6 prefix <network>/<length>\n")
+ "IPv4 prefix\n"
+ "IPv6 prefix\n")
{
+ int idx_ipv4_ipv6_prefixlen = 4;
struct prefix *argv_p;
int found_prefix = 0;
int ret;
argv_p = prefix_new();
- ret = str2prefix (argv[0], argv_p);
+ ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
if (!ret)
{
prefix_free(argv_p);
@@ -942,9 +986,9 @@ DEFUN (no_debug_bgp_bestpath_prefix,
}
if (found_prefix)
- vty_out (vty, "BGP bestpath debugging is off for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP bestpath debugging is off for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
else
- vty_out (vty, "BGP bestpath debugging was not enabled for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP bestpath debugging was not enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -997,29 +1041,30 @@ DEFUN (debug_bgp_update,
DEFUN (debug_bgp_update_direct,
debug_bgp_update_direct_cmd,
- "debug bgp updates (in|out)",
+ "debug bgp updates <in|out>",
DEBUG_STR
BGP_STR
"BGP updates\n"
"Inbound updates\n"
"Outbound updates\n")
{
+ int idx_in_out = 3;
- if (strncmp ("i", argv[0], 1) == 0)
+ if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0)
bgp_debug_list_free(bgp_debug_update_in_peers);
else
bgp_debug_list_free(bgp_debug_update_out_peers);
if (vty->node == CONFIG_NODE)
{
- if (strncmp ("i", argv[0], 1) == 0)
+ if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0)
DEBUG_ON (update, UPDATE_IN);
else
DEBUG_ON (update, UPDATE_OUT);
}
else
{
- if (strncmp ("i", argv[0], 1) == 0)
+ if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0)
{
TERM_DEBUG_ON (update, UPDATE_IN);
vty_out (vty, "BGP updates debugging is on (inbound)%s", VTY_NEWLINE);
@@ -1035,7 +1080,7 @@ DEFUN (debug_bgp_update_direct,
DEFUN (debug_bgp_update_direct_peer,
debug_bgp_update_direct_peer_cmd,
- "debug bgp updates (in|out) (A.B.C.D|X:X::X:X|WORD)",
+ "debug bgp updates <in|out> <A.B.C.D|X:X::X:X|WORD>",
DEBUG_STR
BGP_STR
"BGP updates\n"
@@ -1045,7 +1090,9 @@ DEFUN (debug_bgp_update_direct_peer,
"BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n")
{
- const char *host = argv[1];
+ int idx_in_out = 3;
+ int idx_peer = 4;
+ const char *host = argv[idx_peer]->arg;
int inbound;
if (!bgp_debug_update_in_peers)
@@ -1054,7 +1101,7 @@ DEFUN (debug_bgp_update_direct_peer,
if (!bgp_debug_update_out_peers)
bgp_debug_update_out_peers = list_new ();
- if (strncmp ("i", argv[0], 1) == 0)
+ if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0)
inbound = 1;
else
inbound = 0;
@@ -1116,12 +1163,12 @@ DEFUN (debug_bgp_update_direct_peer,
if (inbound)
{
TERM_DEBUG_ON (update, UPDATE_IN);
- vty_out (vty, "BGP updates debugging is on (inbound) for %s%s", argv[1], VTY_NEWLINE);
+ vty_out (vty, "BGP updates debugging is on (inbound) for %s%s", argv[idx_peer]->arg, VTY_NEWLINE);
}
else
{
TERM_DEBUG_ON (update, UPDATE_OUT);
- vty_out (vty, "BGP updates debugging is on (outbound) for %s%s", argv[1], VTY_NEWLINE);
+ vty_out (vty, "BGP updates debugging is on (outbound) for %s%s", argv[idx_peer]->arg, VTY_NEWLINE);
}
}
return CMD_SUCCESS;
@@ -1129,7 +1176,7 @@ DEFUN (debug_bgp_update_direct_peer,
DEFUN (no_debug_bgp_update_direct,
no_debug_bgp_update_direct_cmd,
- "no debug bgp updates (in|out)",
+ "no debug bgp updates <in|out>",
NO_STR
DEBUG_STR
BGP_STR
@@ -1137,7 +1184,8 @@ DEFUN (no_debug_bgp_update_direct,
"Inbound updates\n"
"Outbound updates\n")
{
- if (strncmp ("i", argv[0], 1) == 0)
+ int idx_in_out = 4;
+ if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0)
{
bgp_debug_list_free(bgp_debug_update_in_peers);
@@ -1171,7 +1219,7 @@ DEFUN (no_debug_bgp_update_direct,
DEFUN (no_debug_bgp_update_direct_peer,
no_debug_bgp_update_direct_peer_cmd,
- "no debug bgp updates (in|out) (A.B.C.D|X:X::X:X|WORD)",
+ "no debug bgp updates <in|out> <A.B.C.D|X:X::X:X|WORD>",
NO_STR
DEBUG_STR
BGP_STR
@@ -1182,11 +1230,13 @@ DEFUN (no_debug_bgp_update_direct_peer,
"BGP IPv6 neighbor to debug\n"
"BGP neighbor on interface to debug\n")
{
+ int idx_in_out = 4;
+ int idx_peer = 5;
int inbound;
int found_peer = 0;
- const char *host = argv[1];
+ const char *host = argv[idx_peer]->arg;
- if (strncmp ("i", argv[0], 1) == 0)
+ if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0)
inbound = 1;
else
inbound = 0;
@@ -1261,20 +1311,21 @@ DEFUN (no_debug_bgp_update_direct_peer,
DEFUN (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>",
DEBUG_STR
BGP_STR
"BGP updates\n"
"Specify a prefix to debug\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "IPv6 prefix <network>/<length>\n")
+ "IPv4 prefix\n"
+ "IPv6 prefix\n")
{
+ int idx_ipv4_ipv6_prefixlen = 4;
struct prefix *argv_p;
int ret;
argv_p = prefix_new();
- ret = str2prefix (argv[0], argv_p);
+ ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
if (!ret)
{
prefix_free(argv_p);
@@ -1288,7 +1339,7 @@ DEFUN (debug_bgp_update_prefix,
if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, argv_p))
{
- vty_out (vty, "BGP updates debugging is already enabled for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP updates debugging is already enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -1301,7 +1352,7 @@ DEFUN (debug_bgp_update_prefix,
else
{
TERM_DEBUG_ON (update, UPDATE_PREFIX);
- vty_out (vty, "BGP updates debugging is on for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP updates debugging is on for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
}
return CMD_SUCCESS;
@@ -1309,22 +1360,23 @@ DEFUN (debug_bgp_update_prefix,
DEFUN (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>",
NO_STR
DEBUG_STR
BGP_STR
"BGP updates\n"
"Specify a prefix to debug\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "IPv6 prefix <network>/<length>\n")
+ "IPv4 prefix\n"
+ "IPv6 prefix\n")
{
+ int idx_ipv4_ipv6_prefixlen = 5;
struct prefix *argv_p;
int found_prefix = 0;
int ret;
argv_p = prefix_new();
- ret = str2prefix (argv[0], argv_p);
+ ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
if (!ret)
{
prefix_free(argv_p);
@@ -1351,9 +1403,9 @@ DEFUN (no_debug_bgp_update_prefix,
}
if (found_prefix)
- vty_out (vty, "BGP updates debugging is off for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP updates debugging is off for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
else
- vty_out (vty, "BGP updates debugging was not enabled for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP updates debugging was not enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -1366,11 +1418,12 @@ DEFUN (no_debug_bgp_update,
BGP_STR
"BGP updates\n")
{
+ VTY_DECLVAR_CONTEXT(bgp, bgp);
bgp_debug_list_free(bgp_debug_update_in_peers);
bgp_debug_list_free(bgp_debug_update_out_peers);
bgp_debug_list_free(bgp_debug_update_prefixes);
- bgp_debug_clear_updgrp_update_dbg(vty->index);
+ bgp_debug_clear_updgrp_update_dbg(bgp);
if (vty->node == CONFIG_NODE)
{
@@ -1408,20 +1461,21 @@ DEFUN (debug_bgp_zebra,
DEFUN (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>",
DEBUG_STR
BGP_STR
"BGP Zebra messages\n"
"Specify a prefix to debug\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "IPv6 prefix <network>/<length>\n")
+ "IPv4 prefix\n"
+ "IPv6 prefix\n")
{
+ int idx_ipv4_ipv6_prefixlen = 4;
struct prefix *argv_p;
int ret;
argv_p = prefix_new();
- ret = str2prefix (argv[0], argv_p);
+ ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
if (!ret)
{
prefix_free(argv_p);
@@ -1434,7 +1488,7 @@ DEFUN (debug_bgp_zebra_prefix,
if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes, NULL, argv_p))
{
- vty_out (vty, "BGP zebra debugging is already enabled for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP zebra debugging is already enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -1445,7 +1499,7 @@ DEFUN (debug_bgp_zebra_prefix,
else
{
TERM_DEBUG_ON (zebra, ZEBRA);
- vty_out (vty, "BGP zebra debugging is on for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP zebra debugging is on for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
}
return CMD_SUCCESS;
@@ -1473,22 +1527,23 @@ DEFUN (no_debug_bgp_zebra,
DEFUN (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>",
NO_STR
DEBUG_STR
BGP_STR
"BGP Zebra messages\n"
"Specify a prefix to debug\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
- "IPv6 prefix <network>/<length>\n")
+ "IPv4 prefix\n"
+ "IPv6 prefix\n")
{
+ int idx_ipv4_ipv6_prefixlen = 5;
struct prefix *argv_p;
int found_prefix = 0;
int ret;
argv_p = prefix_new();
- ret = str2prefix (argv[0], argv_p);
+ ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
if (!ret)
{
prefix_free(argv_p);
@@ -1513,9 +1568,9 @@ DEFUN (no_debug_bgp_zebra_prefix,
}
if (found_prefix)
- vty_out (vty, "BGP zebra debugging is off for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP zebra debugging is off for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
else
- vty_out (vty, "BGP zebra debugging was not enabled for %s%s", argv[0], VTY_NEWLINE);
+ vty_out (vty, "BGP zebra debugging was not enabled for %s%s", argv[idx_ipv4_ipv6_prefixlen]->arg, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -1555,12 +1610,6 @@ DEFUN (no_debug_bgp_allow_martians,
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_allow_martians,
- undebug_bgp_allow_martians_cmd,
- "undebug bgp allow-martians",
- UNDEBUG_STR
- BGP_STR
- "BGP allow martian next hops\n")
/* debug bgp update-groups */
DEFUN (debug_bgp_update_groups,
@@ -1605,6 +1654,7 @@ DEFUN (no_debug_bgp,
DEBUG_STR
BGP_STR)
{
+ VTY_DECLVAR_CONTEXT(bgp, bgp);
bgp_debug_list_free(bgp_debug_neighbor_events_peers);
bgp_debug_list_free(bgp_debug_keepalive_peers);
bgp_debug_list_free(bgp_debug_update_in_peers);
@@ -1613,7 +1663,7 @@ DEFUN (no_debug_bgp,
bgp_debug_list_free(bgp_debug_bestpath_prefixes);
bgp_debug_list_free(bgp_debug_zebra_prefixes);
- bgp_debug_clear_updgrp_update_dbg(vty->index);
+ bgp_debug_clear_updgrp_update_dbg(bgp);
TERM_DEBUG_OFF (keepalive, KEEPALIVE);
TERM_DEBUG_OFF (update, UPDATE_IN);
@@ -1905,7 +1955,6 @@ bgp_debug_init (void)
install_element (ENABLE_NODE, &no_debug_bgp_zebra_cmd);
install_element (CONFIG_NODE, &no_debug_bgp_zebra_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_allow_martians_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_allow_martians_cmd);
install_element (CONFIG_NODE, &no_debug_bgp_allow_martians_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_update_groups_cmd);
install_element (CONFIG_NODE, &no_debug_bgp_update_groups_cmd);
@@ -2075,3 +2124,31 @@ bgp_debug_zebra (struct prefix *p)
return 0;
}
+
+const char *
+bgp_debug_rdpfxpath2str (struct prefix_rd *prd, union prefixconstptr pu,
+ int addpath_valid, u_int32_t addpath_id,
+ char *str, int size)
+{
+ char rd_buf[RD_ADDRSTRLEN];
+ char pfx_buf[PREFIX_STRLEN];
+ char pathid_buf[BGP_ADDPATH_STR];
+
+ if (size < BGP_PRD_PATH_STRLEN)
+ return NULL;
+
+ /* Note: Path-id is created by default, but only included in update sometimes. */
+ pathid_buf[0] = '\0';
+ if (addpath_valid)
+ sprintf(pathid_buf, " with addpath ID %d", addpath_id);
+
+ if (prd)
+ snprintf (str, size, "RD %s %s%s",
+ prefix_rd2str(prd, rd_buf, sizeof (rd_buf)),
+ prefix2str (pu, pfx_buf, sizeof (pfx_buf)), pathid_buf);
+ else
+ snprintf (str, size, "%s%s",
+ prefix2str (pu, pfx_buf, sizeof (pfx_buf)), pathid_buf);
+
+ return str;
+}