diff options
Diffstat (limited to 'bgpd/bgp_debug.c')
| -rw-r--r-- | bgpd/bgp_debug.c | 250 |
1 files changed, 135 insertions, 115 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 5538402070..f9e67d96ca 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -39,6 +39,9 @@ #include "bgpd/bgp_community.h" #include "bgpd/bgp_updgrp.h" #include "bgpd/bgp_mplsvpn.h" +#include "bgpd/bgp_ecommunity.h" +#include "bgpd/bgp_label.h" +#include "bgpd/bgp_evpn.h" unsigned long conf_bgp_debug_as4; unsigned long conf_bgp_debug_neighbor_events; @@ -254,7 +257,7 @@ bgp_debug_list_print (struct vty *vty, const char *desc, struct list *list) } } - vty_out (vty, VTYNL); + vty_out (vty, "\n"); } /* Print the command to enable the debug for each peer/prefix this debug is @@ -274,14 +277,14 @@ bgp_debug_list_conf_print (struct vty *vty, const char *desc, struct list *list) { if (filter->host) { - vty_outln (vty, "%s %s", desc, filter->host); + vty_out (vty, "%s %s\n", desc, filter->host); write++; } if (filter->p) { - vty_outln (vty, "%s %s/%d", desc, + vty_out (vty, "%s %s/%d\n", desc, inet_ntop (filter->p->family, &filter->p->u.prefix, buf, INET6_ADDRSTRLEN), filter->p->prefixlen); write++; @@ -291,7 +294,7 @@ bgp_debug_list_conf_print (struct vty *vty, const char *desc, struct list *list) if (!write) { - vty_outln (vty, "%s", desc); + vty_out (vty, "%s\n", desc); write++; } @@ -384,6 +387,8 @@ bgp_debug_peer_updout_enabled(char *host) int bgp_dump_attr (struct attr *attr, char *buf, size_t size) { + char addrbuf[BUFSIZ]; + if (! attr) return 0; @@ -394,66 +399,68 @@ bgp_dump_attr (struct attr *attr, char *buf, size_t size) snprintf (buf + strlen (buf), size - strlen (buf), ", origin %s", bgp_origin_str[attr->origin]); - if (attr->extra) - { - char addrbuf[BUFSIZ]; + /* Add MP case. */ + if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL + || attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) + snprintf (buf + strlen (buf), size - strlen (buf), ", mp_nexthop %s", + inet_ntop (AF_INET6, &attr->mp_nexthop_global, + addrbuf, BUFSIZ)); - /* Add MP case. */ - if (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL - || attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) - snprintf (buf + strlen (buf), size - strlen (buf), ", mp_nexthop %s", - inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global, - addrbuf, BUFSIZ)); + if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) + snprintf (buf + strlen (buf), size - strlen (buf), "(%s)", + inet_ntop (AF_INET6, &attr->mp_nexthop_local, + addrbuf, BUFSIZ)); - if (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) - snprintf (buf + strlen (buf), size - strlen (buf), "(%s)", - inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local, - addrbuf, BUFSIZ)); - } + if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV4) + snprintf (buf, size, "nexthop %s", inet_ntoa (attr->nexthop)); if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))) snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %u", attr->local_pref); - if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))) snprintf (buf + strlen (buf), size - strlen (buf), ", metric %u", attr->med); - if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES))) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES))) snprintf (buf + strlen (buf), size - strlen (buf), ", community %s", community_str (attr->community)); + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES))) + snprintf (buf + strlen (buf), size - strlen (buf), ", extcommunity %s", + ecommunity_str (attr->ecommunity)); + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE))) snprintf (buf + strlen (buf), size - strlen (buf), ", atomic-aggregate"); if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR))) snprintf (buf + strlen (buf), size - strlen (buf), ", aggregated by %u %s", - attr->extra->aggregator_as, - inet_ntoa (attr->extra->aggregator_addr)); + attr->aggregator_as, + inet_ntoa (attr->aggregator_addr)); if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID))) snprintf (buf + strlen (buf), size - strlen (buf), ", originator %s", - inet_ntoa (attr->extra->originator_id)); + inet_ntoa (attr->originator_id)); if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_CLUSTER_LIST))) { int i; snprintf (buf + strlen (buf), size - strlen (buf), ", clusterlist"); - for (i = 0; i < attr->extra->cluster->length / 4; i++) + for (i = 0; i < attr->cluster->length / 4; i++) snprintf (buf + strlen (buf), size - strlen (buf), " %s", - inet_ntoa (attr->extra->cluster->list[i])); + inet_ntoa (attr->cluster->list[i])); } - if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AS_PATH))) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AS_PATH))) snprintf (buf + strlen (buf), size - strlen (buf), ", path %s", aspath_print (attr->aspath)); if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_PREFIX_SID))) { - if (attr->extra->label_index != BGP_INVALID_LABEL_INDEX) + if (attr->label_index != BGP_INVALID_LABEL_INDEX) snprintf (buf + strlen (buf), size - strlen (buf), ", label-index %u", - attr->extra->label_index); + attr->label_index); } if (strlen (buf) > 1) @@ -583,7 +590,7 @@ DEFUN (debug_bgp_as4, else { TERM_DEBUG_ON (as4, AS4); - vty_outln (vty, "BGP as4 debugging is on"); + vty_out (vty, "BGP as4 debugging is on\n"); } return CMD_SUCCESS; } @@ -601,7 +608,7 @@ DEFUN (no_debug_bgp_as4, else { TERM_DEBUG_OFF (as4, AS4); - vty_outln (vty, "BGP as4 debugging is off"); + vty_out (vty, "BGP as4 debugging is off\n"); } return CMD_SUCCESS; } @@ -619,7 +626,7 @@ DEFUN (debug_bgp_as4_segment, else { TERM_DEBUG_ON (as4, AS4_SEGMENT); - vty_outln (vty, "BGP as4 segment debugging is on"); + vty_out (vty, "BGP as4 segment debugging is on\n"); } return CMD_SUCCESS; } @@ -638,7 +645,7 @@ DEFUN (no_debug_bgp_as4_segment, else { TERM_DEBUG_OFF (as4, AS4_SEGMENT); - vty_outln (vty, "BGP as4 segment debugging is off"); + vty_out (vty, "BGP as4 segment debugging is off\n"); } return CMD_SUCCESS; } @@ -658,7 +665,7 @@ DEFUN (debug_bgp_neighbor_events, else { TERM_DEBUG_ON (neighbor_events, NEIGHBOR_EVENTS); - vty_outln (vty, "BGP neighbor-events debugging is on"); + vty_out (vty, "BGP neighbor-events debugging is on\n"); } return CMD_SUCCESS; } @@ -681,7 +688,7 @@ DEFUN (debug_bgp_neighbor_events_peer, if (bgp_debug_list_has_entry(bgp_debug_neighbor_events_peers, host, NULL)) { - vty_outln (vty, "BGP neighbor-events debugging is already enabled for %s", + vty_out (vty, "BGP neighbor-events debugging is already enabled for %s\n", host); return CMD_SUCCESS; } @@ -693,7 +700,7 @@ DEFUN (debug_bgp_neighbor_events_peer, else { TERM_DEBUG_ON (neighbor_events, NEIGHBOR_EVENTS); - vty_outln (vty, "BGP neighbor-events debugging is on for %s", host); + vty_out (vty, "BGP neighbor-events debugging is on for %s\n", host); } return CMD_SUCCESS; } @@ -713,7 +720,7 @@ DEFUN (no_debug_bgp_neighbor_events, else { TERM_DEBUG_OFF (neighbor_events, NEIGHBOR_EVENTS); - vty_outln (vty, "BGP neighbor-events debugging is off"); + vty_out (vty, "BGP neighbor-events debugging is off\n"); } return CMD_SUCCESS; } @@ -747,9 +754,9 @@ DEFUN (no_debug_bgp_neighbor_events_peer, } if (found_peer) - vty_outln (vty, "BGP neighbor-events debugging is off for %s", host); + vty_out (vty, "BGP neighbor-events debugging is off for %s\n", host); else - vty_outln (vty, "BGP neighbor-events debugging was not enabled for %s", + vty_out (vty, "BGP neighbor-events debugging was not enabled for %s\n", host); return CMD_SUCCESS; @@ -768,7 +775,7 @@ DEFUN (debug_bgp_nht, else { TERM_DEBUG_ON (nht, NHT); - vty_outln (vty, "BGP nexthop tracking debugging is on"); + vty_out (vty, "BGP nexthop tracking debugging is on\n"); } return CMD_SUCCESS; } @@ -786,7 +793,7 @@ DEFUN (no_debug_bgp_nht, else { TERM_DEBUG_OFF (nht, NHT); - vty_outln (vty, "BGP nexthop tracking debugging is off"); + vty_out (vty, "BGP nexthop tracking debugging is off\n"); } return CMD_SUCCESS; } @@ -806,7 +813,7 @@ DEFUN (debug_bgp_keepalive, else { TERM_DEBUG_ON (keepalive, KEEPALIVE); - vty_outln (vty, "BGP keepalives debugging is on"); + vty_out (vty, "BGP keepalives debugging is on\n"); } return CMD_SUCCESS; } @@ -829,7 +836,7 @@ DEFUN (debug_bgp_keepalive_peer, if (bgp_debug_list_has_entry(bgp_debug_keepalive_peers, host, NULL)) { - vty_outln (vty, "BGP keepalive debugging is already enabled for %s", + vty_out (vty, "BGP keepalive debugging is already enabled for %s\n", host); return CMD_SUCCESS; } @@ -841,7 +848,7 @@ DEFUN (debug_bgp_keepalive_peer, else { TERM_DEBUG_ON (keepalive, KEEPALIVE); - vty_outln (vty, "BGP keepalives debugging is on for %s", host); + vty_out (vty, "BGP keepalives debugging is on for %s\n", host); } return CMD_SUCCESS; } @@ -861,7 +868,7 @@ DEFUN (no_debug_bgp_keepalive, else { TERM_DEBUG_OFF (keepalive, KEEPALIVE); - vty_outln (vty, "BGP keepalives debugging is off"); + vty_out (vty, "BGP keepalives debugging is off\n"); } return CMD_SUCCESS; } @@ -895,9 +902,9 @@ DEFUN (no_debug_bgp_keepalive_peer, } if (found_peer) - vty_outln (vty, "BGP keepalives debugging is off for %s", host); + vty_out (vty, "BGP keepalives debugging is off for %s\n", host); else - vty_outln (vty, "BGP keepalives debugging was not enabled for %s", host); + vty_out (vty, "BGP keepalives debugging was not enabled for %s\n", host); return CMD_SUCCESS; } @@ -922,7 +929,7 @@ DEFPY (debug_bgp_bestpath_prefix, if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL, bestpath)) { - vty_outln (vty, "BGP bestpath debugging is already enabled for %s", bestpath_str); + vty_out (vty, "BGP bestpath debugging is already enabled for %s\n", bestpath_str); return CMD_SUCCESS; } @@ -935,7 +942,7 @@ DEFPY (debug_bgp_bestpath_prefix, else { TERM_DEBUG_ON (bestpath, BESTPATH); - vty_outln (vty, "BGP bestpath debugging is on for %s", bestpath_str); + vty_out (vty, "BGP bestpath debugging is on for %s\n", bestpath_str); } return CMD_SUCCESS; @@ -962,8 +969,8 @@ DEFUN (no_debug_bgp_bestpath_prefix, if (!ret) { prefix_free(argv_p); - vty_outln (vty, "%% Malformed Prefix"); - return CMD_WARNING; + vty_out (vty, "%% Malformed Prefix\n"); + return CMD_WARNING_CONFIG_FAILED; } if (bgp_debug_bestpath_prefixes && !list_isempty(bgp_debug_bestpath_prefixes)) @@ -979,16 +986,16 @@ DEFUN (no_debug_bgp_bestpath_prefix, else { TERM_DEBUG_OFF (bestpath, BESTPATH); - vty_outln (vty, "BGP bestpath debugging (per prefix) is off"); + vty_out (vty, "BGP bestpath debugging (per prefix) is off\n"); } } } if (found_prefix) - vty_outln (vty, "BGP bestpath debugging is off for %s", + vty_out (vty, "BGP bestpath debugging is off for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); else - vty_outln (vty, "BGP bestpath debugging was not enabled for %s", + vty_out (vty, "BGP bestpath debugging was not enabled for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); return CMD_SUCCESS; @@ -1009,7 +1016,7 @@ DEFUN (no_debug_bgp_bestpath, else { TERM_DEBUG_OFF (bestpath, BESTPATH); - vty_outln (vty, "BGP bestpath debugging is off"); + vty_out (vty, "BGP bestpath debugging is off\n"); } return CMD_SUCCESS; } @@ -1035,7 +1042,7 @@ DEFUN (debug_bgp_update, { TERM_DEBUG_ON (update, UPDATE_IN); TERM_DEBUG_ON (update, UPDATE_OUT); - vty_outln (vty, "BGP updates debugging is on"); + vty_out (vty, "BGP updates debugging is on\n"); } return CMD_SUCCESS; } @@ -1068,12 +1075,12 @@ DEFUN (debug_bgp_update_direct, if (strncmp ("i", argv[idx_in_out]->arg, 1) == 0) { TERM_DEBUG_ON (update, UPDATE_IN); - vty_outln (vty, "BGP updates debugging is on (inbound)"); + vty_out (vty, "BGP updates debugging is on (inbound)\n"); } else { TERM_DEBUG_ON (update, UPDATE_OUT); - vty_outln (vty, "BGP updates debugging is on (outbound)"); + vty_out (vty, "BGP updates debugging is on (outbound)\n"); } } return CMD_SUCCESS; @@ -1111,7 +1118,7 @@ DEFUN (debug_bgp_update_direct_peer, { if (bgp_debug_list_has_entry(bgp_debug_update_in_peers, host, NULL)) { - vty_outln (vty, "BGP inbound update debugging is already enabled for %s", + vty_out (vty, "BGP inbound update debugging is already enabled for %s\n", host); return CMD_SUCCESS; } @@ -1121,7 +1128,7 @@ DEFUN (debug_bgp_update_direct_peer, { if (bgp_debug_list_has_entry(bgp_debug_update_out_peers, host, NULL)) { - vty_outln (vty, "BGP outbound update debugging is already enabled for %s", + vty_out (vty, "BGP outbound update debugging is already enabled for %s\n", host); return CMD_SUCCESS; } @@ -1166,13 +1173,13 @@ DEFUN (debug_bgp_update_direct_peer, if (inbound) { TERM_DEBUG_ON (update, UPDATE_IN); - vty_outln (vty, "BGP updates debugging is on (inbound) for %s", + vty_out (vty, "BGP updates debugging is on (inbound) for %s\n", argv[idx_peer]->arg); } else { TERM_DEBUG_ON (update, UPDATE_OUT); - vty_outln (vty, "BGP updates debugging is on (outbound) for %s", + vty_out (vty, "BGP updates debugging is on (outbound) for %s\n", argv[idx_peer]->arg); } } @@ -1201,7 +1208,7 @@ DEFUN (no_debug_bgp_update_direct, else { TERM_DEBUG_OFF (update, UPDATE_IN); - vty_outln (vty, "BGP updates debugging is off (inbound)"); + vty_out (vty, "BGP updates debugging is off (inbound)\n"); } } else @@ -1215,7 +1222,7 @@ DEFUN (no_debug_bgp_update_direct, else { TERM_DEBUG_OFF (update, UPDATE_OUT); - vty_outln (vty, "BGP updates debugging is off (outbound)"); + vty_out (vty, "BGP updates debugging is off (outbound)\n"); } } @@ -1258,7 +1265,7 @@ DEFUN (no_debug_bgp_update_direct_peer, else { TERM_DEBUG_OFF (update, UPDATE_IN); - vty_outln (vty, "BGP updates debugging (inbound) is off"); + vty_out (vty, "BGP updates debugging (inbound) is off\n"); } } } @@ -1275,7 +1282,7 @@ DEFUN (no_debug_bgp_update_direct_peer, else { TERM_DEBUG_OFF (update, UPDATE_OUT); - vty_outln (vty, "BGP updates debugging (outbound) is off"); + vty_out (vty, "BGP updates debugging (outbound) is off\n"); } } @@ -1302,16 +1309,16 @@ DEFUN (no_debug_bgp_update_direct_peer, if (found_peer) if (inbound) - vty_outln (vty, "BGP updates debugging (inbound) is off for %s", host); + vty_out (vty, "BGP updates debugging (inbound) is off for %s\n", host); else - vty_outln (vty, "BGP updates debugging (outbound) is off for %s", + vty_out (vty, "BGP updates debugging (outbound) is off for %s\n", host); else if (inbound) - vty_outln (vty, "BGP updates debugging (inbound) was not enabled for %s", + vty_out (vty, "BGP updates debugging (inbound) was not enabled for %s\n", host); else - vty_outln (vty, "BGP updates debugging (outbound) was not enabled for %s", + vty_out (vty, "BGP updates debugging (outbound) was not enabled for %s\n", host); return CMD_SUCCESS; @@ -1337,8 +1344,8 @@ DEFUN (debug_bgp_update_prefix, if (!ret) { prefix_free(argv_p); - vty_outln (vty, "%% Malformed Prefix"); - return CMD_WARNING; + vty_out (vty, "%% Malformed Prefix\n"); + return CMD_WARNING_CONFIG_FAILED; } @@ -1347,7 +1354,7 @@ DEFUN (debug_bgp_update_prefix, if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, argv_p)) { - vty_outln (vty, "BGP updates debugging is already enabled for %s", + vty_out (vty, "BGP updates debugging is already enabled for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); return CMD_SUCCESS; } @@ -1361,7 +1368,7 @@ DEFUN (debug_bgp_update_prefix, else { TERM_DEBUG_ON (update, UPDATE_PREFIX); - vty_outln (vty, "BGP updates debugging is on for %s", + vty_out (vty, "BGP updates debugging is on for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); } @@ -1390,8 +1397,8 @@ DEFUN (no_debug_bgp_update_prefix, if (!ret) { prefix_free(argv_p); - vty_outln (vty, "%% Malformed Prefix"); - return CMD_WARNING; + vty_out (vty, "%% Malformed Prefix\n"); + return CMD_WARNING_CONFIG_FAILED; } if (bgp_debug_update_prefixes && !list_isempty(bgp_debug_update_prefixes)) @@ -1407,16 +1414,16 @@ DEFUN (no_debug_bgp_update_prefix, else { TERM_DEBUG_OFF (update, UPDATE_PREFIX); - vty_outln (vty, "BGP updates debugging (per prefix) is off"); + vty_out (vty, "BGP updates debugging (per prefix) is off\n"); } } } if (found_prefix) - vty_outln (vty, "BGP updates debugging is off for %s", + vty_out (vty, "BGP updates debugging is off for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); else - vty_outln (vty, "BGP updates debugging was not enabled for %s", + vty_out (vty, "BGP updates debugging was not enabled for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); return CMD_SUCCESS; @@ -1448,7 +1455,7 @@ DEFUN (no_debug_bgp_update, TERM_DEBUG_OFF (update, UPDATE_IN); TERM_DEBUG_OFF (update, UPDATE_OUT); TERM_DEBUG_OFF (update, UPDATE_PREFIX); - vty_outln (vty, "BGP updates debugging is off"); + vty_out (vty, "BGP updates debugging is off\n"); } return CMD_SUCCESS; } @@ -1466,7 +1473,7 @@ DEFUN (debug_bgp_zebra, else { TERM_DEBUG_ON (zebra, ZEBRA); - vty_outln (vty, "BGP zebra debugging is on"); + vty_out (vty, "BGP zebra debugging is on\n"); } return CMD_SUCCESS; } @@ -1491,8 +1498,8 @@ DEFUN (debug_bgp_zebra_prefix, if (!ret) { prefix_free(argv_p); - vty_outln (vty, "%% Malformed Prefix"); - return CMD_WARNING; + vty_out (vty, "%% Malformed Prefix\n"); + return CMD_WARNING_CONFIG_FAILED; } if (!bgp_debug_zebra_prefixes) @@ -1500,7 +1507,7 @@ DEFUN (debug_bgp_zebra_prefix, if (bgp_debug_list_has_entry(bgp_debug_zebra_prefixes, NULL, argv_p)) { - vty_outln (vty, "BGP zebra debugging is already enabled for %s", + vty_out (vty, "BGP zebra debugging is already enabled for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); return CMD_SUCCESS; } @@ -1512,7 +1519,7 @@ DEFUN (debug_bgp_zebra_prefix, else { TERM_DEBUG_ON (zebra, ZEBRA); - vty_outln (vty, "BGP zebra debugging is on for %s", + vty_out (vty, "BGP zebra debugging is on for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); } @@ -1534,7 +1541,7 @@ DEFUN (no_debug_bgp_zebra, else { TERM_DEBUG_OFF (zebra, ZEBRA); - vty_outln (vty, "BGP zebra debugging is off"); + vty_out (vty, "BGP zebra debugging is off\n"); } return CMD_SUCCESS; } @@ -1561,8 +1568,8 @@ DEFUN (no_debug_bgp_zebra_prefix, if (!ret) { prefix_free(argv_p); - vty_outln (vty, "%% Malformed Prefix"); - return CMD_WARNING; + vty_out (vty, "%% Malformed Prefix\n"); + return CMD_WARNING_CONFIG_FAILED; } if (bgp_debug_zebra_prefixes && !list_isempty(bgp_debug_zebra_prefixes)) @@ -1576,16 +1583,16 @@ DEFUN (no_debug_bgp_zebra_prefix, else { TERM_DEBUG_OFF (zebra, ZEBRA); - vty_outln (vty, "BGP zebra debugging is off"); + vty_out (vty, "BGP zebra debugging is off\n"); } } } if (found_prefix) - vty_outln (vty, "BGP zebra debugging is off for %s", + vty_out (vty, "BGP zebra debugging is off for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); else - vty_outln (vty, "BGP zebra debugging was not enabled for %s", + vty_out (vty, "BGP zebra debugging was not enabled for %s\n", argv[idx_ipv4_ipv6_prefixlen]->arg); return CMD_SUCCESS; @@ -1603,7 +1610,7 @@ DEFUN (debug_bgp_allow_martians, else { TERM_DEBUG_ON (allow_martians, ALLOW_MARTIANS); - vty_outln (vty, "BGP allow_martian next hop debugging is on"); + vty_out (vty, "BGP allow_martian next hop debugging is on\n"); } return CMD_SUCCESS; } @@ -1621,7 +1628,7 @@ DEFUN (no_debug_bgp_allow_martians, else { TERM_DEBUG_OFF (allow_martians, ALLOW_MARTIANS); - vty_outln (vty, "BGP allow martian next hop debugging is off"); + vty_out (vty, "BGP allow martian next hop debugging is off\n"); } return CMD_SUCCESS; } @@ -1640,7 +1647,7 @@ DEFUN (debug_bgp_update_groups, else { TERM_DEBUG_ON (update_groups, UPDATE_GROUPS); - vty_outln (vty, "BGP update-groups debugging is on"); + vty_out (vty, "BGP update-groups debugging is on\n"); } return CMD_SUCCESS; } @@ -1658,7 +1665,7 @@ DEFUN (no_debug_bgp_update_groups, else { TERM_DEBUG_OFF (update_groups, UPDATE_GROUPS); - vty_outln (vty, "BGP update-groups debugging is off"); + vty_out (vty, "BGP update-groups debugging is off\n"); } return CMD_SUCCESS; } @@ -1691,7 +1698,7 @@ DEFUN (no_debug_bgp, TERM_DEBUG_OFF (neighbor_events, NEIGHBOR_EVENTS); TERM_DEBUG_OFF (zebra, ZEBRA); TERM_DEBUG_OFF (allow_martians, ALLOW_MARTIANS); - vty_outln (vty, "All possible debugging has been turned off"); + vty_out (vty, "All possible debugging has been turned off\n"); return CMD_SUCCESS; } @@ -1703,13 +1710,13 @@ DEFUN (show_debugging_bgp, DEBUG_STR BGP_STR) { - vty_outln (vty, "BGP debugging status:"); + vty_out (vty, "BGP debugging status:\n"); if (BGP_DEBUG (as4, AS4)) - vty_outln (vty, " BGP as4 debugging is on"); + vty_out (vty, " BGP as4 debugging is on\n"); if (BGP_DEBUG (as4, AS4_SEGMENT)) - vty_outln (vty, " BGP as4 aspath segment debugging is on"); + vty_out (vty, " BGP as4 aspath segment debugging is on\n"); if (BGP_DEBUG (bestpath, BESTPATH)) bgp_debug_list_print (vty, " BGP bestpath debugging is on", @@ -1724,10 +1731,10 @@ DEFUN (show_debugging_bgp, bgp_debug_neighbor_events_peers); if (BGP_DEBUG (nht, NHT)) - vty_outln (vty, " BGP next-hop tracking debugging is on"); + vty_out (vty, " BGP next-hop tracking debugging is on\n"); if (BGP_DEBUG (update_groups, UPDATE_GROUPS)) - vty_outln (vty, " BGP update-groups debugging is on"); + vty_out (vty, " BGP update-groups debugging is on\n"); if (BGP_DEBUG (update, UPDATE_PREFIX)) bgp_debug_list_print (vty, " BGP updates debugging is on", @@ -1746,8 +1753,8 @@ DEFUN (show_debugging_bgp, bgp_debug_zebra_prefixes); if (BGP_DEBUG (allow_martians, ALLOW_MARTIANS)) - vty_outln (vty, " BGP allow martian next hop debugging is on"); - vty_out (vty, VTYNL); + vty_out (vty, " BGP allow martian next hop debugging is on\n"); + vty_out (vty, "\n"); return CMD_SUCCESS; } @@ -1802,13 +1809,13 @@ bgp_config_write_debug (struct vty *vty) if (CONF_BGP_DEBUG (as4, AS4)) { - vty_outln (vty, "debug bgp as4"); + vty_out (vty, "debug bgp as4\n"); write++; } if (CONF_BGP_DEBUG (as4, AS4_SEGMENT)) { - vty_outln (vty, "debug bgp as4 segment"); + vty_out (vty, "debug bgp as4 segment\n"); write++; } @@ -1832,13 +1839,13 @@ bgp_config_write_debug (struct vty *vty) if (CONF_BGP_DEBUG (nht, NHT)) { - vty_outln (vty, "debug bgp nht"); + vty_out (vty, "debug bgp nht\n"); write++; } if (CONF_BGP_DEBUG (update_groups, UPDATE_GROUPS)) { - vty_outln (vty, "debug bgp update-groups"); + vty_out (vty, "debug bgp update-groups\n"); write++; } @@ -1864,7 +1871,7 @@ bgp_config_write_debug (struct vty *vty) { if (!bgp_debug_zebra_prefixes || list_isempty(bgp_debug_zebra_prefixes)) { - vty_outln (vty, "debug bgp zebra"); + vty_out (vty, "debug bgp zebra\n"); write++; } else @@ -1876,7 +1883,7 @@ bgp_config_write_debug (struct vty *vty) if (CONF_BGP_DEBUG (allow_martians, ALLOW_MARTIANS)) { - vty_outln (vty, "debug bgp allow-martians"); + vty_out (vty, "debug bgp allow-martians\n"); write++; } @@ -2142,12 +2149,14 @@ bgp_debug_zebra (struct prefix *p) } const char * -bgp_debug_rdpfxpath2str (struct prefix_rd *prd, union prefixconstptr pu, - int addpath_valid, u_int32_t addpath_id, - char *str, int size) +bgp_debug_rdpfxpath2str (afi_t afi, safi_t safi, + struct prefix_rd *prd, union prefixconstptr pu, + mpls_label_t *label, int addpath_valid, + u_int32_t addpath_id, char *str, int size) { char rd_buf[RD_ADDRSTRLEN]; char pfx_buf[PREFIX_STRLEN]; + char tag_buf[30]; /* ' with addpath ID ' 17 * max strlen of uint32 + 10 * +/- (just in case) + 1 @@ -2163,13 +2172,24 @@ bgp_debug_rdpfxpath2str (struct prefix_rd *prd, union prefixconstptr pu, if (addpath_valid) snprintf(pathid_buf, sizeof(pathid_buf), " with addpath ID %u", addpath_id); + tag_buf[0] = '\0'; + if (bgp_labeled_safi (safi) && label) + { + u_int32_t label_value; + + label_value = decode_label (label); + sprintf (tag_buf, " label %u", label_value); + } + if (prd) - snprintf (str, size, "RD %s %s%s", + snprintf (str, size, "RD %s %s%s%s", prefix_rd2str(prd, rd_buf, sizeof (rd_buf)), - prefix2str (pu, pfx_buf, sizeof (pfx_buf)), pathid_buf); + prefix2str (pu, pfx_buf, sizeof (pfx_buf)), + tag_buf, pathid_buf); else - snprintf (str, size, "%s%s", - prefix2str (pu, pfx_buf, sizeof (pfx_buf)), pathid_buf); + snprintf (str, size, "%s%s%s", + prefix2str (pu, pfx_buf, sizeof (pfx_buf)), + tag_buf, pathid_buf); return str; } |
