diff options
Diffstat (limited to 'bgpd/bgp_debug.c')
-rw-r--r-- | bgpd/bgp_debug.c | 308 |
1 files changed, 188 insertions, 120 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 26b35dfc..eda146dd 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -19,6 +19,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <zebra.h> +#include <stdbool.h> #include <lib/version.h> #include "prefix.h" @@ -28,14 +29,22 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "str.h" #include "log.h" #include "sockunion.h" +#include "memory.h" + +#include "bgpd/bgp_common.h" +#include "bgpd/bgp_engine.h" +#include "bgpd/bgp_session.h" +#include "bgpd/bgp_connection.h" #include "bgpd/bgpd.h" +#include "bgpd/bgp_peer.h" #include "bgpd/bgp_aspath.h" #include "bgpd/bgp_route.h" #include "bgpd/bgp_attr.h" #include "bgpd/bgp_debug.h" #include "bgpd/bgp_community.h" + unsigned long conf_bgp_debug_as4; unsigned long conf_bgp_debug_fsm; unsigned long conf_bgp_debug_events; @@ -57,18 +66,27 @@ unsigned long term_bgp_debug_normal; unsigned long term_bgp_debug_zebra; /* messages for BGP-4 status */ -const struct message bgp_status_msg[] = -{ - { Idle, "Idle" }, - { Connect, "Connect" }, - { Active, "Active" }, - { OpenSent, "OpenSent" }, - { OpenConfirm, "OpenConfirm" }, - { Established, "Established" }, - { Clearing, "Clearing" }, - { Deleted, "Deleted" }, +const struct message bgp_status_msg[] = +{ + { bgp_fsm_sInitial, "Initial" }, + { bgp_fsm_sIdle, "Idle" }, + { bgp_fsm_sConnect, "Connect" }, + { bgp_fsm_sActive, "Active" }, + { bgp_fsm_sOpenSent, "OpenSent" }, + { bgp_fsm_sOpenConfirm, "OpenConfirm" }, + { bgp_fsm_sEstablished, "Established" }, + { bgp_fsm_sStopping, "Stopping" }, }; -const int bgp_status_msg_max = BGP_STATUS_MAX; +const int bgp_status_msg_max = bgp_fsm_last_state + 1 ; + +const struct message bgp_peer_status_msg[] = +{ + { bgp_peer_pIdle, "Idle" }, + { bgp_peer_pEstablished, "Established" }, + { bgp_peer_pClearing, "Clearing" }, + { bgp_peer_pDeleting, "Deleting" }, +}; +const int bgp_peer_status_msg_max = bgp_peer_max_state + 1 ; /* BGP message type string. */ const char *bgp_type_str[] = @@ -83,72 +101,73 @@ const char *bgp_type_str[] = }; /* message for BGP-4 Notify */ -static const struct message bgp_notify_msg[] = -{ - { BGP_NOTIFY_HEADER_ERR, "Message Header Error"}, - { BGP_NOTIFY_OPEN_ERR, "OPEN Message Error"}, - { BGP_NOTIFY_UPDATE_ERR, "UPDATE Message Error"}, - { BGP_NOTIFY_HOLD_ERR, "Hold Timer Expired"}, - { BGP_NOTIFY_FSM_ERR, "Finite State Machine Error"}, - { BGP_NOTIFY_CEASE, "Cease"}, - { BGP_NOTIFY_CAPABILITY_ERR, "CAPABILITY Message Error"}, +static const struct message bgp_notify_msg[] = +{ + { BGP_NOTIFY_HEADER_ERR, "Message Header Error" }, + { BGP_NOTIFY_OPEN_ERR, "OPEN Message Error" }, + { BGP_NOTIFY_UPDATE_ERR, "UPDATE Message Error" }, + { BGP_NOTIFY_HOLD_ERR, "Hold Timer Expired" }, + { BGP_NOTIFY_FSM_ERR, "Finite State Machine Error" }, + { BGP_NOTIFY_CEASE, "Cease" }, + { BGP_NOTIFY_CAPABILITY_ERR, "CAPABILITY Message Error" }, }; static const int bgp_notify_msg_max = BGP_NOTIFY_MAX; -static const struct message bgp_notify_head_msg[] = +static const struct message bgp_notify_head_msg[] = { - { BGP_NOTIFY_HEADER_NOT_SYNC, "/Connection Not Synchronized"}, - { BGP_NOTIFY_HEADER_BAD_MESLEN, "/Bad Message Length"}, - { BGP_NOTIFY_HEADER_BAD_MESTYPE, "/Bad Message Type"} + { BGP_NOTIFY_HEADER_NOT_SYNC, "/Connection Not Synchronized" }, + { BGP_NOTIFY_HEADER_BAD_MESLEN, "/Bad Message Length" }, + { BGP_NOTIFY_HEADER_BAD_MESTYPE, "/Bad Message Type" } }; static const int bgp_notify_head_msg_max = BGP_NOTIFY_HEADER_MAX; -static const struct message bgp_notify_open_msg[] = +static const struct message bgp_notify_open_msg[] = { - { BGP_NOTIFY_OPEN_UNSUP_VERSION, "/Unsupported Version Number" }, - { BGP_NOTIFY_OPEN_BAD_PEER_AS, "/Bad Peer AS"}, - { BGP_NOTIFY_OPEN_BAD_BGP_IDENT, "/Bad BGP Identifier"}, - { BGP_NOTIFY_OPEN_UNSUP_PARAM, "/Unsupported Optional Parameter"}, - { BGP_NOTIFY_OPEN_AUTH_FAILURE, "/Authentication Failure"}, - { BGP_NOTIFY_OPEN_UNACEP_HOLDTIME, "/Unacceptable Hold Time"}, - { BGP_NOTIFY_OPEN_UNSUP_CAPBL, "/Unsupported Capability"}, + { BGP_NOTIFY_OPEN_UNSUP_VERSION, "/Unsupported Version Number" }, + { BGP_NOTIFY_OPEN_BAD_PEER_AS, "/Bad Peer AS" }, + { BGP_NOTIFY_OPEN_BAD_BGP_IDENT, "/Bad BGP Identifier" }, + { BGP_NOTIFY_OPEN_UNSUP_PARAM, "/Unsupported Optional Parameter" }, + { BGP_NOTIFY_OPEN_AUTH_FAILURE, "/Authentication Failure" }, + { BGP_NOTIFY_OPEN_UNACEP_HOLDTIME, "/Unacceptable Hold Time" }, + { BGP_NOTIFY_OPEN_UNSUP_CAPBL, "/Unsupported Capability" }, }; static const int bgp_notify_open_msg_max = BGP_NOTIFY_OPEN_MAX; -static const struct message bgp_notify_update_msg[] = -{ - { BGP_NOTIFY_UPDATE_MAL_ATTR, "/Malformed Attribute List"}, - { BGP_NOTIFY_UPDATE_UNREC_ATTR, "/Unrecognized Well-known Attribute"}, - { BGP_NOTIFY_UPDATE_MISS_ATTR, "/Missing Well-known Attribute"}, - { BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR, "/Attribute Flags Error"}, - { BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, "/Attribute Length Error"}, - { BGP_NOTIFY_UPDATE_INVAL_ORIGIN, "/Invalid ORIGIN Attribute"}, - { BGP_NOTIFY_UPDATE_AS_ROUTE_LOOP, "/AS Routing Loop"}, - { BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP, "/Invalid NEXT_HOP Attribute"}, - { BGP_NOTIFY_UPDATE_OPT_ATTR_ERR, "/Optional Attribute Error"}, - { BGP_NOTIFY_UPDATE_INVAL_NETWORK, "/Invalid Network Field"}, - { BGP_NOTIFY_UPDATE_MAL_AS_PATH, "/Malformed AS_PATH"}, +static const struct message bgp_notify_update_msg[] = +{ + { BGP_NOTIFY_UPDATE_MAL_ATTR, "/Malformed Attribute List" }, + { BGP_NOTIFY_UPDATE_UNREC_ATTR, "/Unrecognized Well-known Attribute" }, + { BGP_NOTIFY_UPDATE_MISS_ATTR, "/Missing Well-known Attribute" }, + { BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR, "/Attribute Flags Error" }, + { BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, "/Attribute Length Error" }, + { BGP_NOTIFY_UPDATE_INVAL_ORIGIN, "/Invalid ORIGIN Attribute" }, + { BGP_NOTIFY_UPDATE_AS_ROUTE_LOOP, "/AS Routing Loop" }, + { BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP, "/Invalid NEXT_HOP Attribute" }, + { BGP_NOTIFY_UPDATE_OPT_ATTR_ERR, "/Optional Attribute Error" }, + { BGP_NOTIFY_UPDATE_INVAL_NETWORK, "/Invalid Network Field" }, + { BGP_NOTIFY_UPDATE_MAL_AS_PATH, "/Malformed AS_PATH" }, }; static const int bgp_notify_update_msg_max = BGP_NOTIFY_UPDATE_MAX; static const struct message bgp_notify_cease_msg[] = { - { BGP_NOTIFY_CEASE_MAX_PREFIX, "/Maximum Number of Prefixes Reached"}, - { BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN, "/Administratively Shutdown"}, - { BGP_NOTIFY_CEASE_PEER_UNCONFIG, "/Peer Unconfigured"}, - { BGP_NOTIFY_CEASE_ADMIN_RESET, "/Administratively Reset"}, - { BGP_NOTIFY_CEASE_CONNECT_REJECT, "/Connection Rejected"}, - { BGP_NOTIFY_CEASE_CONFIG_CHANGE, "/Other Configuration Change"}, - { BGP_NOTIFY_CEASE_COLLISION_RESOLUTION, "/Connection collision resolution"}, - { BGP_NOTIFY_CEASE_OUT_OF_RESOURCE, "/Out of Resource"}, + { BGP_NOTIFY_CEASE_MAX_PREFIX, "/Maximum Number of Prefixes Reached" }, + { BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN, "/Administratively Shutdown" }, + { BGP_NOTIFY_CEASE_PEER_UNCONFIG, "/Peer Unconfigured" }, + { BGP_NOTIFY_CEASE_ADMIN_RESET, "/Administratively Reset" }, + { BGP_NOTIFY_CEASE_CONNECT_REJECT, "/Connection Rejected" }, + { BGP_NOTIFY_CEASE_CONFIG_CHANGE, "/Other Configuration Change" }, + { BGP_NOTIFY_CEASE_COLLISION_RESOLUTION, "/Connection collision resolution" }, + { BGP_NOTIFY_CEASE_OUT_OF_RESOURCE, "/Out of Resource" }, }; static const int bgp_notify_cease_msg_max = BGP_NOTIFY_CEASE_MAX; -static const struct message bgp_notify_capability_msg[] = +static const struct message bgp_notify_capability_msg[] = { - { BGP_NOTIFY_CAPABILITY_INVALID_ACTION, "/Invalid Action Value" }, - { BGP_NOTIFY_CAPABILITY_INVALID_LENGTH, "/Invalid Capability Length"}, - { BGP_NOTIFY_CAPABILITY_MALFORMED_CODE, "/Malformed Capability Value"}, + { BGP_NOTIFY_CAPABILITY_INVALID_ACTION, "/Invalid Action Value" }, + { BGP_NOTIFY_CAPABILITY_INVALID_LENGTH, "/Invalid Capability Length" }, + { BGP_NOTIFY_CAPABILITY_MALFORMED_CODE, "/Malformed Capability Value" }, + { 4, "/Unsupported Capability" } }; static const int bgp_notify_capability_msg_max = BGP_NOTIFY_CAPABILITY_MAX; @@ -164,7 +183,7 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) return 0; if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP))) - snprintf (buf, size, "nexthop %s", inet_ntoa (attr->nexthop)); + snprintf (buf, size, "nexthop %s", safe_inet_ntoa (attr->nexthop)); if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ORIGIN))) snprintf (buf + strlen (buf), size - strlen (buf), ", origin %s", @@ -176,15 +195,15 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) char addrbuf[BUFSIZ]; /* Add MP case. */ - if (attr->extra->mp_nexthop_len == 16 + if (attr->extra->mp_nexthop_len == 16 || attr->extra->mp_nexthop_len == 32) snprintf (buf + strlen (buf), size - strlen (buf), ", mp_nexthop %s", - inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global, + inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global, addrbuf, BUFSIZ)); if (attr->extra->mp_nexthop_len == 32) snprintf (buf + strlen (buf), size - strlen (buf), "(%s)", - inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local, + inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local, addrbuf, BUFSIZ)); } #endif /* HAVE_IPV6 */ @@ -193,11 +212,11 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %d", 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 %d", 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)); @@ -207,11 +226,11 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) 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)); + safe_inet_ntoa (attr->extra->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)); + safe_inet_ntoa (attr->extra->originator_id)); if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_CLUSTER_LIST))) { @@ -220,10 +239,10 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) snprintf (buf + strlen (buf), size - strlen (buf), ", clusterlist"); for (i = 0; i < attr->extra->cluster->length / 4; i++) snprintf (buf + strlen (buf), size - strlen (buf), " %s", - inet_ntoa (attr->extra->cluster->list[i])); + safe_inet_ntoa (attr->extra->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)); @@ -235,61 +254,110 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) /* dump notify packet */ void -bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify, - const char *direct) -{ - const char *subcode_str; +bgp_notify_print(struct peer *peer, bgp_notify notification) +{ + const char* subcode_str ; + const char* code_str ; + const char* hex_form ; + bool log_neighbor_changes ; + int length ; + char* alloc ; + int subcode ; + + /* See if we need to do any of this */ + if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) + log_neighbor_changes = true ; + else if (BGP_DEBUG (normal, NORMAL)) + log_neighbor_changes = false ; + else + return ; /* quit if nothing to do */ + + /* Sort out string forms of code and subcode */ + code_str = LOOKUP (bgp_notify_msg, notification->code) ; - subcode_str = ""; + subcode = notification->subcode ; + subcode_str = "/Unspecific"; - switch (bgp_notify->code) + switch (notification->code) { case BGP_NOTIFY_HEADER_ERR: - subcode_str = LOOKUP (bgp_notify_head_msg, bgp_notify->subcode); + if (subcode != 0) + subcode_str = LOOKUP (bgp_notify_head_msg, subcode); break; case BGP_NOTIFY_OPEN_ERR: - subcode_str = LOOKUP (bgp_notify_open_msg, bgp_notify->subcode); + if (subcode != 0) + subcode_str = LOOKUP (bgp_notify_open_msg, subcode); break; case BGP_NOTIFY_UPDATE_ERR: - subcode_str = LOOKUP (bgp_notify_update_msg, bgp_notify->subcode); + if (subcode != 0) + subcode_str = LOOKUP (bgp_notify_update_msg, subcode); break; case BGP_NOTIFY_HOLD_ERR: - subcode_str = ""; - break; case BGP_NOTIFY_FSM_ERR: - subcode_str = ""; + if (subcode != 0) + subcode_str = "/*unknown*" ; + else + subcode_str = ""; break; case BGP_NOTIFY_CEASE: - subcode_str = LOOKUP (bgp_notify_cease_msg, bgp_notify->subcode); + if (subcode != 0) + subcode_str = LOOKUP (bgp_notify_cease_msg, subcode); break; case BGP_NOTIFY_CAPABILITY_ERR: - subcode_str = LOOKUP (bgp_notify_capability_msg, bgp_notify->subcode); + if (subcode != 0) + subcode_str = LOOKUP (bgp_notify_capability_msg, subcode); break; } - if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) - 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, - LOOKUP (bgp_notify_msg, bgp_notify->code), - subcode_str, bgp_notify->length, - bgp_notify->data ? bgp_notify->data : ""); - else if (BGP_DEBUG (normal, NORMAL)) - plog_debug (peer->log, "%s %s NOTIFICATION %d/%d (%s%s) %d bytes %s", - peer ? peer->host : "", - direct, bgp_notify->code, bgp_notify->subcode, - LOOKUP (bgp_notify_msg, bgp_notify->code), - subcode_str, bgp_notify->length, - bgp_notify->data ? bgp_notify->data : ""); -} - + /* Construct hex_form of data, if required. */ + length = bgp_notify_get_length(notification) ; + if (length != 0) + { + const char* form ; + uint8_t* p = bgp_notify_get_data(notification) ; + uint8_t* e = p + length ; + char* q ; + + hex_form = alloc = q = XMALLOC(MTYPE_TMP, (length * 3) + 1) ; + + form = "%02x" ; + while (p < e) + { + int n = snprintf (q, 4, form, *p++) ; + q += n ; + form = " %02x" ; + } ; + } + else + { + hex_form = "" ; + alloc = NULL ; + } ; + + /* Output the required logging */ + if (log_neighbor_changes) + zlog_info("%%NOTIFICATION: %s neighbor %s %d/%d (%s%s) %d bytes %s", + notification->received ? "received from" : "sent to", peer->host, + notification->code, notification->subcode, + code_str, subcode_str, length, hex_form) ; + else + plog_debug(peer->log, "%s %s NOTIFICATION %d/%d (%s%s) %d bytes %s", + peer->host, notification->received ? "received" : "sending", + notification->code, notification->subcode, + code_str, subcode_str, length, hex_form) ; + + /* Release the space allocated to the hex form of the data, if any */ + if (alloc != NULL) + XFREE(MTYPE_TMP, alloc) ; +} ; + /* Debug option setting interface. */ unsigned long bgp_debug_option = 0; -int +int debug (unsigned int option) { - return bgp_debug_option & option; + return bgp_debug_option & option; } DEFUN (debug_bgp_as4, @@ -299,7 +367,7 @@ DEFUN (debug_bgp_as4, BGP_STR "BGP AS4 actions\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_ON (as4, AS4); else { @@ -317,7 +385,7 @@ DEFUN (no_debug_bgp_as4, BGP_STR "BGP AS4 actions\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_OFF (as4, AS4); else { @@ -342,7 +410,7 @@ DEFUN (debug_bgp_as4_segment, "BGP AS4 actions\n" "BGP AS4 aspath segment handling\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_ON (as4, AS4_SEGMENT); else { @@ -361,7 +429,7 @@ DEFUN (no_debug_bgp_as4_segment, "BGP AS4 actions\n" "BGP AS4 aspath segment handling\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_OFF (as4, AS4_SEGMENT); else { @@ -386,7 +454,7 @@ DEFUN (debug_bgp_fsm, BGP_STR "BGP Finite State Machine\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_ON (fsm, FSM); else { @@ -404,7 +472,7 @@ DEFUN (no_debug_bgp_fsm, BGP_STR "Finite State Machine\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_OFF (fsm, FSM); else { @@ -428,7 +496,7 @@ DEFUN (debug_bgp_events, BGP_STR "BGP events\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_ON (events, EVENTS); else { @@ -446,7 +514,7 @@ DEFUN (no_debug_bgp_events, BGP_STR "BGP events\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_OFF (events, EVENTS); else { @@ -470,7 +538,7 @@ DEFUN (debug_bgp_filter, BGP_STR "BGP filters\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_ON (filter, FILTER); else { @@ -488,7 +556,7 @@ DEFUN (no_debug_bgp_filter, BGP_STR "BGP filters\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_OFF (filter, FILTER); else { @@ -512,7 +580,7 @@ DEFUN (debug_bgp_keepalive, BGP_STR "BGP keepalives\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_ON (keepalive, KEEPALIVE); else { @@ -530,7 +598,7 @@ DEFUN (no_debug_bgp_keepalive, BGP_STR "BGP keepalives\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_OFF (keepalive, KEEPALIVE); else { @@ -554,7 +622,7 @@ DEFUN (debug_bgp_update, BGP_STR "BGP updates\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) { DEBUG_ON (update, UPDATE_IN); DEBUG_ON (update, UPDATE_OUT); @@ -577,7 +645,7 @@ DEFUN (debug_bgp_update_direct, "Inbound updates\n" "Outbound updates\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) { if (strncmp ("i", argv[0], 1) == 0) { @@ -585,7 +653,7 @@ DEFUN (debug_bgp_update_direct, DEBUG_ON (update, UPDATE_IN); } else - { + { DEBUG_OFF (update, UPDATE_IN); DEBUG_ON (update, UPDATE_OUT); } @@ -616,7 +684,7 @@ DEFUN (no_debug_bgp_update, BGP_STR "BGP updates\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) { DEBUG_OFF (update, UPDATE_IN); DEBUG_OFF (update, UPDATE_OUT); @@ -643,7 +711,7 @@ DEFUN (debug_bgp_normal, DEBUG_STR BGP_STR) { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_ON (normal, NORMAL); else { @@ -660,7 +728,7 @@ DEFUN (no_debug_bgp_normal, DEBUG_STR BGP_STR) { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_OFF (normal, NORMAL); else { @@ -683,7 +751,7 @@ DEFUN (debug_bgp_zebra, BGP_STR "BGP Zebra messages\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_ON (zebra, ZEBRA); else { @@ -701,7 +769,7 @@ DEFUN (no_debug_bgp_zebra, BGP_STR "BGP Zebra messages\n") { - if (vty->node == CONFIG_NODE) + if (vty_get_node(vty) == CONFIG_NODE) DEBUG_OFF (zebra, ZEBRA); else { @@ -737,7 +805,7 @@ DEFUN (no_debug_bgp_all, TERM_DEBUG_OFF (filter, FILTER); TERM_DEBUG_OFF (zebra, ZEBRA); vty_out (vty, "All possible debugging has been turned off%s", VTY_NEWLINE); - + return CMD_SUCCESS; } |