{
if (!peer->radv_adjusted)
{
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_update(peer, NULL, 0))
zlog_debug("%s scheduling MRAI timer after adj_out_set", peer->host);
bgp_adjust_routeadv(peer);
}
{
if (!peer->t_write)
{
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_update(peer, NULL, 0))
zlog_debug("%s scheduling write thread after adj_out_unset",
peer->host);
BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd);
CHECK_FLAG (real_flags, attr_flag_str[i].key)
)
{
- zlog (args->peer->log, LOG_ERR, "%s attribute must%s be flagged as \"%s\"",
- LOOKUP (attr_str, attr_code),
- CHECK_FLAG (desired_flags, attr_flag_str[i].key) ? "" : " not",
- attr_flag_str[i].str);
+ zlog_err ("%s attribute must%s be flagged as \"%s\"",
+ LOOKUP (attr_str, attr_code),
+ CHECK_FLAG (desired_flags, attr_flag_str[i].key) ? "" : " not",
+ attr_flag_str[i].str);
seen = 1;
}
if (!seen)
{
- zlog (args->peer->log, LOG_DEBUG,
- "Strange, %s called for attr %s, but no problem found with flags"
- " (real flags 0x%x, desired 0x%x)",
- __func__, LOOKUP (attr_str, attr_code),
- real_flags, desired_flags);
+ zlog_debug ("Strange, %s called for attr %s, but no problem found with flags"
+ " (real flags 0x%x, desired 0x%x)",
+ __func__, LOOKUP (attr_str, attr_code),
+ real_flags, desired_flags);
}
}
if (!CHECK_FLAG (BGP_ATTR_FLAG_OPTIONAL, flags)
&& !CHECK_FLAG (BGP_ATTR_FLAG_TRANS, flags))
{
- zlog (peer->log, LOG_ERR,
- "%s well-known attributes must have transitive flag set (%x)",
- LOOKUP (attr_str, attr_code), flags);
+ zlog_err ("%s well-known attributes must have transitive flag set (%x)",
+ LOOKUP (attr_str, attr_code), flags);
return 1;
}
{
if (!CHECK_FLAG (flags, BGP_ATTR_FLAG_OPTIONAL))
{
- zlog (peer->log, LOG_ERR,
- "%s well-known attribute "
- "must NOT have the partial flag set (%x)",
- LOOKUP (attr_str, attr_code), flags);
+ zlog_err ("%s well-known attribute "
+ "must NOT have the partial flag set (%x)",
+ LOOKUP (attr_str, attr_code), flags);
return 1;
}
if (CHECK_FLAG (flags, BGP_ATTR_FLAG_OPTIONAL)
&& !CHECK_FLAG (flags, BGP_ATTR_FLAG_TRANS))
{
- zlog (peer->log, LOG_ERR,
- "%s optional + transitive attribute "
- "must NOT have the partial flag set (%x)",
- LOOKUP (attr_str, attr_code), flags);
+ zlog_err ("%s optional + transitive attribute "
+ "must NOT have the partial flag set (%x)",
+ LOOKUP (attr_str, attr_code), flags);
return 1;
}
}
value). */
if (length != 1)
{
- zlog (peer->log, LOG_ERR, "Origin attribute length is not one %d",
- length);
+ zlog_err ("Origin attribute length is not one %d", length);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
&& (attr->origin != BGP_ORIGIN_EGP)
&& (attr->origin != BGP_ORIGIN_INCOMPLETE))
{
- zlog (peer->log, LOG_ERR, "Origin attribute value is invalid %d",
- attr->origin);
+ zlog_err ("Origin attribute value is invalid %d", attr->origin);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_INVAL_ORIGIN,
args->total);
/* In case of IBGP, length will be zero. */
if (! attr->aspath)
{
- zlog (peer->log, LOG_ERR,
- "Malformed AS path from %s, length is %d",
- peer->host, length);
+ zlog_err ("Malformed AS path from %s, length is %d", peer->host, length);
return bgp_attr_malformed (args, BGP_NOTIFY_UPDATE_MAL_AS_PATH, 0);
}
if ((peer->sort == BGP_PEER_CONFED && ! aspath_left_confed_check (attr->aspath)) ||
(peer->sort == BGP_PEER_EBGP && aspath_confed_check (attr->aspath)))
{
- zlog (peer->log, LOG_ERR, "Malformed AS path from %s", peer->host);
+ zlog_err ("Malformed AS path from %s", peer->host);
bgp_notify_send (peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_AS_PATH);
return BGP_ATTR_PARSE_ERROR;
if (peer->sort == BGP_PEER_EBGP
&& ! aspath_firstas_check (attr->aspath, peer->as))
{
- zlog (peer->log, LOG_ERR,
- "%s incorrect first AS (must be %u)", peer->host, peer->as);
+ zlog_err ("%s incorrect first AS (must be %u)", peer->host, peer->as);
bgp_notify_send (peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_AS_PATH);
return BGP_ATTR_PARSE_ERROR;
/* In case of IBGP, length will be zero. */
if (!*as4_path)
{
- zlog (peer->log, LOG_ERR,
- "Malformed AS4 path from %s, length is %d",
- peer->host, length);
+ zlog_err ("Malformed AS4 path from %s, length is %d", peer->host, length);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_MAL_AS_PATH,
0);
/* Check nexthop attribute length. */
if (length != 4)
{
- zlog (peer->log, LOG_ERR, "Nexthop attribute length isn't four [%d]",
- length);
+ zlog_err ("Nexthop attribute length isn't four [%d]", length);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
{
char buf[INET_ADDRSTRLEN];
inet_ntop (AF_INET, &nexthop_n, buf, INET_ADDRSTRLEN);
- zlog (peer->log, LOG_ERR, "Martian nexthop %s", buf);
+ zlog_err ("Martian nexthop %s", buf);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP,
args->total);
/* Length check. */
if (length != 4)
{
- zlog (peer->log, LOG_ERR,
- "MED attribute length isn't four [%d]", length);
+ zlog_err ("MED attribute length isn't four [%d]", length);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
/* Length check. */
if (length != 4)
{
- zlog (peer->log, LOG_ERR, "LOCAL_PREF attribute length isn't 4 [%u]",
- length);
+ zlog_err ("LOCAL_PREF attribute length isn't 4 [%u]", length);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
/* Length check. */
if (length != 0)
{
- zlog (peer->log, LOG_ERR, "ATOMIC_AGGREGATE attribute length isn't 0 [%u]",
- length);
+ zlog_err ("ATOMIC_AGGREGATE attribute length isn't 0 [%u]", length);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
if (length != wantedlen)
{
- zlog (peer->log, LOG_ERR, "AGGREGATOR attribute length isn't %u [%u]",
- wantedlen, length);
+ zlog_err ("AGGREGATOR attribute length isn't %u [%u]", wantedlen, length);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
if (length != 8)
{
- zlog (peer->log, LOG_ERR, "New Aggregator length is not 8 [%d]",
- length);
+ zlog_err ("New Aggregator length is not 8 [%d]", length);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
0);
/* Length check. */
if (length != 4)
{
- zlog (peer->log, LOG_ERR, "Bad originator ID length %d", length);
+ zlog_err ("Bad originator ID length %d", length);
return bgp_attr_malformed (args,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
/* Check length. */
if (length % 4)
{
- zlog (peer->log, LOG_ERR, "Bad cluster list length %d", length);
+ zlog_err ("Bad cluster list length %d", length);
return bgp_attr_malformed (args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
args->total);
char buf1[INET6_ADDRSTRLEN];
char buf2[INET6_ADDRSTRLEN];
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog_debug ("%s got two nexthop %s %s but second one is not a link-local nexthop", peer->host,
+ if (bgp_debug_update(peer, NULL, 1))
+ zlog_debug ("%s sent two nexthops %s %s but second one is not a link-local nexthop", peer->host,
inet_ntop (AF_INET6, &attre->mp_nexthop_global,
buf1, INET6_ADDRSTRLEN),
inet_ntop (AF_INET6, &attre->mp_nexthop_local,
const u_char flag = args->flags;
const bgp_size_t length = args->length;
-
- if (BGP_DEBUG (normal, NORMAL))
- zlog_debug ("%s Unknown attribute is received (type %d, length %d)",
- peer->host, type, length);
+ if (bgp_debug_update(peer, NULL, 1))
+ zlog_debug ("%s Unknown attribute is received (type %d, length %d)",
+ peer->host, type, length);
- if (BGP_DEBUG (events, EVENTS))
- zlog (peer->log, LOG_DEBUG,
- "Unknown attribute type %d length %d is received", type, length);
-
/* Forward read pointer of input stream. */
stream_forward_getp (peer->ibuf, length);
if (endp - BGP_INPUT_PNT (peer) < BGP_ATTR_MIN_LEN)
{
/* XXX warning: long int format, int arg (arg 5) */
- zlog (peer->log, LOG_WARNING,
- "%s: error BGP attribute length %lu is smaller than min len",
- peer->host,
- (unsigned long) (endp - STREAM_PNT (BGP_INPUT (peer))));
+ zlog_warn ("%s: error BGP attribute length %lu is smaller than min len",
+ peer->host,
+ (unsigned long) (endp - STREAM_PNT (BGP_INPUT (peer))));
bgp_notify_send (peer,
BGP_NOTIFY_UPDATE_ERR,
if (CHECK_FLAG (flag, BGP_ATTR_FLAG_EXTLEN)
&& ((endp - startp) < (BGP_ATTR_MIN_LEN + 1)))
{
- zlog (peer->log, LOG_WARNING,
- "%s: Extended length set, but just %lu bytes of attr header",
- peer->host,
- (unsigned long) (endp - STREAM_PNT (BGP_INPUT (peer))));
+ zlog_warn ("%s: Extended length set, but just %lu bytes of attr header",
+ peer->host,
+ (unsigned long) (endp - STREAM_PNT (BGP_INPUT (peer))));
bgp_notify_send (peer,
BGP_NOTIFY_UPDATE_ERR,
if (CHECK_BITMAP (seen, type))
{
- zlog (peer->log, LOG_WARNING,
- "%s: error BGP attribute type %d appears twice in a message",
- peer->host, type);
+ zlog_warn ("%s: error BGP attribute type %d appears twice in a message",
+ peer->host, type);
bgp_notify_send (peer,
BGP_NOTIFY_UPDATE_ERR,
if (attr_endp > endp)
{
- zlog (peer->log, LOG_WARNING,
- "%s: BGP type %d length %d is too large, attribute total length is %d. attr_endp is %p. endp is %p", peer->host, type, length, size, attr_endp, endp);
+ zlog_warn ("%s: BGP type %d length %d is too large, attribute total length is %d. attr_endp is %p. endp is %p", peer->host, type, length, size, attr_endp, endp);
bgp_notify_send (peer,
BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
/* If hard error occured immediately return to the caller. */
if (ret == BGP_ATTR_PARSE_ERROR)
{
- zlog (peer->log, LOG_WARNING,
- "%s: Attribute %s, parse error",
- peer->host,
- LOOKUP (attr_str, type));
+ zlog_warn ("%s: Attribute %s, parse error",
+ peer->host,
+ LOOKUP (attr_str, type));
if (as4_path)
aspath_unintern (&as4_path);
return ret;
if (ret == BGP_ATTR_PARSE_WITHDRAW)
{
- zlog (peer->log, LOG_WARNING,
- "%s: Attribute %s, parse error - treating as withdrawal",
- peer->host,
- LOOKUP (attr_str, type));
+ zlog_warn ("%s: Attribute %s, parse error - treating as withdrawal",
+ peer->host,
+ LOOKUP (attr_str, type));
if (as4_path)
aspath_unintern (&as4_path);
return ret;
/* Check the fetched length. */
if (BGP_INPUT_PNT (peer) != attr_endp)
{
- zlog (peer->log, LOG_WARNING,
- "%s: BGP attribute %s, fetch error",
- peer->host, LOOKUP (attr_str, type));
+ zlog_warn ("%s: BGP attribute %s, fetch error",
+ peer->host, LOOKUP (attr_str, type));
bgp_notify_send (peer,
BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
/* Check final read pointer is same as end pointer. */
if (BGP_INPUT_PNT (peer) != endp)
{
- zlog (peer->log, LOG_WARNING,
- "%s: BGP attribute %s, length mismatch",
- peer->host, LOOKUP (attr_str, type));
+ zlog_warn ("%s: BGP attribute %s, length mismatch",
+ peer->host, LOOKUP (attr_str, type));
bgp_notify_send (peer,
BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
if (type)
{
- zlog (peer->log, LOG_WARNING,
- "%s Missing well-known attribute %d.",
- peer->host, type);
+ zlog_warn ("%s Missing well-known attribute %d.", peer->host, type);
bgp_notify_send_with_data (peer,
BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MISS_ATTR,
#include "str.h"
#include "log.h"
#include "sockunion.h"
+#include "memory.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_aspath.h"
#include "bgpd/bgp_community.h"
unsigned long conf_bgp_debug_as4;
-unsigned long conf_bgp_debug_fsm;
+unsigned long conf_bgp_debug_neighbor_events;
unsigned long conf_bgp_debug_events;
unsigned long conf_bgp_debug_packet;
unsigned long conf_bgp_debug_filter;
unsigned long conf_bgp_debug_keepalive;
unsigned long conf_bgp_debug_update;
-unsigned long conf_bgp_debug_normal;
unsigned long conf_bgp_debug_zebra;
unsigned long conf_bgp_debug_nht;
unsigned long term_bgp_debug_as4;
-unsigned long term_bgp_debug_fsm;
+unsigned long term_bgp_debug_neighbor_events;
unsigned long term_bgp_debug_events;
unsigned long term_bgp_debug_packet;
unsigned long term_bgp_debug_filter;
unsigned long term_bgp_debug_keepalive;
unsigned long term_bgp_debug_update;
-unsigned long term_bgp_debug_normal;
unsigned long term_bgp_debug_zebra;
unsigned long term_bgp_debug_nht;
+struct list *bgp_debug_neighbor_events_peers = NULL;
+struct list *bgp_debug_keepalive_peers = NULL;
+struct list *bgp_debug_update_out_peers = NULL;
+struct list *bgp_debug_update_in_peers = NULL;
+struct list *bgp_debug_update_prefixes = NULL;
+struct list *bgp_debug_zebra_prefixes = NULL;
+
/* messages for BGP-4 status */
const struct message bgp_status_msg[] =
{
{ 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_FSM_ERR, "Neighbor Events Error"},
{ BGP_NOTIFY_CEASE, "Cease"},
{ BGP_NOTIFY_CAPABILITY_ERR, "CAPABILITY Message Error"},
};
const char *bgp_origin_str[] = {"i","e","?"};
const char *bgp_origin_long_str[] = {"IGP","EGP","incomplete"};
+
+/* Given a string return a pointer the corresponding peer structure */
+static struct peer *
+bgp_find_peer (struct vty *vty, const char *peer_str)
+{
+ int ret;
+ union sockunion su;
+ struct bgp *bgp;
+
+ bgp = vty->index;
+ ret = str2sockunion (peer_str, &su);
+
+ /* 'swpX' string */
+ if (ret < 0)
+ return peer_lookup_by_conf_if (bgp, peer_str);
+ else
+ return peer_lookup (bgp, &su);
+}
+
+static void
+bgp_debug_list_free(struct list *list)
+{
+ struct bgp_debug_filter *filter;
+ struct listnode *node, *nnode;
+
+ if (list)
+ for (ALL_LIST_ELEMENTS (list, node, nnode, filter))
+ {
+ listnode_delete (list, filter);
+
+ if (filter->p)
+ prefix_free(filter->p);
+
+ if (filter->peer)
+ peer_unlock (filter->peer);
+
+ XFREE (MTYPE_BGP_DEBUG_FILTER, filter);
+ }
+}
+
+/* Print the desc along with a list of peers/prefixes this debug is
+ * enabled for */
+static void
+bgp_debug_list_print (struct vty *vty, const char *desc, struct list *list)
+{
+ struct bgp_debug_filter *filter;
+ struct listnode *node, *nnode;
+ char buf[INET6_ADDRSTRLEN];
+
+ vty_out (vty, "%s", desc);
+
+ if (list && !list_isempty(list))
+ {
+ vty_out (vty, " for");
+ for (ALL_LIST_ELEMENTS (list, node, nnode, filter))
+ {
+ if (filter->peer)
+ vty_out (vty, " %s", filter->peer->host);
+
+ if (filter->p)
+ vty_out (vty, " %s/%d",
+ inet_ntop (filter->p->family, &filter->p->u.prefix, buf, INET6_ADDRSTRLEN),
+ filter->p->prefixlen);
+ }
+ }
+
+ vty_out (vty, "%s", VTY_NEWLINE);
+}
+
+static void
+bgp_debug_list_add_entry(struct list *list, struct peer *peer, struct prefix *p)
+{
+ struct bgp_debug_filter *filter;
+
+ filter = XCALLOC (MTYPE_BGP_DEBUG_FILTER, sizeof (struct bgp_debug_filter));
+
+ if (peer)
+ {
+ peer_lock (peer);
+ filter->peer = peer;
+ filter->p = NULL;
+ }
+ else if (p)
+ {
+ filter->peer = NULL;
+ filter->p = p;
+ }
+
+ listnode_add(list, filter);
+}
+
+static int
+bgp_debug_list_remove_entry(struct list *list, struct peer *peer, struct prefix *p)
+{
+ struct bgp_debug_filter *filter;
+ struct listnode *node, *nnode;
+
+ for (ALL_LIST_ELEMENTS (list, node, nnode, filter))
+ {
+ if (peer && filter->peer == peer)
+ {
+ listnode_delete (list, filter);
+ peer_unlock (filter->peer);
+ XFREE (MTYPE_BGP_DEBUG_FILTER, filter);
+ return 1;
+ }
+ else if (p && filter->p->prefixlen == p->prefixlen && prefix_match(filter->p, p))
+ {
+ listnode_delete (list, filter);
+ prefix_free (filter->p);
+ XFREE (MTYPE_BGP_DEBUG_FILTER, filter);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static int
+bgp_debug_list_has_entry(struct list *list, struct peer *peer, struct prefix *p)
+{
+ struct bgp_debug_filter *filter;
+ struct listnode *node, *nnode;
+
+ for (ALL_LIST_ELEMENTS (list, node, nnode, filter))
+ {
+ if (peer)
+ {
+ if (filter->peer == peer)
+ {
+ return 1;
+ }
+ }
+ else if (p)
+ {
+ if (filter->p->prefixlen == p->prefixlen && prefix_match(filter->p, p))
+ {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
/* Dump attribute. */
int
bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size)
break;
}
- if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES))
+ if (BGP_DEBUG (neighbor_events, NEIGHBOR_EVENTS) || 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,
code_str, 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,
- code_str, subcode_str, bgp_notify->length,
- bgp_notify->data ? bgp_notify->data : "");
}
/* Debug option setting interface. */
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_as4,
- undebug_bgp_as4_cmd,
- "undebug bgp as4",
- UNDEBUG_STR
- BGP_STR
- "BGP AS4 actions\n")
-
DEFUN (debug_bgp_as4_segment,
debug_bgp_as4_segment_cmd,
"debug bgp as4 segment",
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_as4_segment,
- undebug_bgp_as4_segment_cmd,
- "undebug bgp as4 segment",
- UNDEBUG_STR
- BGP_STR
- "BGP AS4 actions\n"
- "BGP AS4 aspath segment handling\n")
-
-DEFUN (debug_bgp_fsm,
- debug_bgp_fsm_cmd,
- "debug bgp fsm",
+/* debug bgp neighbor_events */
+DEFUN (debug_bgp_neighbor_events,
+ debug_bgp_neighbor_events_cmd,
+ "debug bgp neighbor-events",
DEBUG_STR
BGP_STR
- "BGP Finite State Machine\n")
+ "BGP Neighbor Events\n")
{
if (vty->node == CONFIG_NODE)
- DEBUG_ON (fsm, FSM);
+ DEBUG_ON (neighbor_events, NEIGHBOR_EVENTS);
else
{
- TERM_DEBUG_ON (fsm, FSM);
- vty_out (vty, "BGP fsm debugging is on%s", VTY_NEWLINE);
+ TERM_DEBUG_ON (neighbor_events, NEIGHBOR_EVENTS);
+ vty_out (vty, "BGP neighbor-events debugging is on%s", VTY_NEWLINE);
}
return CMD_SUCCESS;
}
-DEFUN (no_debug_bgp_fsm,
- no_debug_bgp_fsm_cmd,
- "no debug bgp fsm",
- NO_STR
+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_STR
BGP_STR
- "Finite State Machine\n")
+ "BGP Neighbor Events\n"
+ "BGP neighbor IP address to debug\n"
+ "BGP IPv6 neighbor to debug\n"
+ "BGP neighbor on interface to debug\n")
{
+ struct peer *peer;
+
+ peer = bgp_find_peer (vty, argv[0]);
+ if (!peer)
+ {
+ vty_out (vty, "%s is not a configured peer%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (!bgp_debug_neighbor_events_peers)
+ bgp_debug_neighbor_events_peers = list_new ();
+
+ if (bgp_debug_list_has_entry(bgp_debug_neighbor_events_peers, peer, NULL))
+ {
+ vty_out (vty, "BGP neighbor-events debugging is already enabled for %s%s", peer->host, VTY_NEWLINE);
+ return CMD_SUCCESS;
+ }
+
+ bgp_debug_list_add_entry(bgp_debug_neighbor_events_peers, peer, NULL);
+
if (vty->node == CONFIG_NODE)
- DEBUG_OFF (fsm, FSM);
+ DEBUG_ON (neighbor_events, NEIGHBOR_EVENTS);
else
{
- TERM_DEBUG_OFF (fsm, FSM);
- vty_out (vty, "BGP fsm debugging is off%s", VTY_NEWLINE);
+ TERM_DEBUG_ON (neighbor_events, NEIGHBOR_EVENTS);
+ vty_out (vty, "BGP neighbor-events debugging is on for %s%s", argv[0], VTY_NEWLINE);
}
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_fsm,
- undebug_bgp_fsm_cmd,
- "undebug bgp fsm",
- UNDEBUG_STR
- BGP_STR
- "Finite State Machine\n")
-
-DEFUN (debug_bgp_events,
- debug_bgp_events_cmd,
- "debug bgp events",
+DEFUN (no_debug_bgp_neighbor_events,
+ no_debug_bgp_neighbor_events_cmd,
+ "no debug bgp neighbor-events",
+ NO_STR
DEBUG_STR
BGP_STR
- "BGP events\n")
+ "Neighbor Events\n")
{
+ bgp_debug_list_free(bgp_debug_neighbor_events_peers);
+
if (vty->node == CONFIG_NODE)
- DEBUG_ON (events, EVENTS);
+ DEBUG_OFF (neighbor_events, NEIGHBOR_EVENTS);
else
{
- TERM_DEBUG_ON (events, EVENTS);
- vty_out (vty, "BGP events debugging is on%s", VTY_NEWLINE);
+ TERM_DEBUG_OFF (neighbor_events, NEIGHBOR_EVENTS);
+ vty_out (vty, "BGP neighbor-events debugging is off%s", VTY_NEWLINE);
}
return CMD_SUCCESS;
}
-DEFUN (no_debug_bgp_events,
- no_debug_bgp_events_cmd,
- "no debug bgp 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_STR
DEBUG_STR
BGP_STR
- "BGP events\n")
+ "Neighbor Events\n"
+ "BGP neighbor IP address to debug\n"
+ "BGP IPv6 neighbor to debug\n"
+ "BGP neighbor on interface to debug\n")
{
- if (vty->node == CONFIG_NODE)
- DEBUG_OFF (events, EVENTS);
- else
+ int found_peer = 0;
+ struct peer *peer;
+
+ peer = bgp_find_peer (vty, argv[0]);
+ if (!peer)
+ {
+ vty_out (vty, "%s is not a configured peer%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (bgp_debug_neighbor_events_peers && !list_isempty(bgp_debug_neighbor_events_peers))
{
- TERM_DEBUG_OFF (events, EVENTS);
- vty_out (vty, "BGP events debugging is off%s", VTY_NEWLINE);
+ found_peer = bgp_debug_list_remove_entry(bgp_debug_neighbor_events_peers, peer, NULL);
+
+ if (list_isempty(bgp_debug_neighbor_events_peers))
+ {
+ if (vty->node == CONFIG_NODE)
+ DEBUG_OFF (neighbor_events, NEIGHBOR_EVENTS);
+ else
+ TERM_DEBUG_OFF (neighbor_events, NEIGHBOR_EVENTS);
+ }
}
+
+ if (found_peer)
+ vty_out (vty, "BGP neighbor-events debugging is off for %s%s", argv[0], VTY_NEWLINE);
+ else
+ vty_out (vty, "BGP neighbor-events debugging was not enabled for %s%s", argv[0], VTY_NEWLINE);
+
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_events,
- undebug_bgp_events_cmd,
- "undebug bgp events",
- UNDEBUG_STR
- BGP_STR
- "BGP events\n")
-
+/* debug bgp nht */
DEFUN (debug_bgp_nht,
debug_bgp_nht_cmd,
"debug bgp nht",
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_nht,
- undebug_bgp_nht_cmd,
- "undebug bgp nht",
- UNDEBUG_STR
- BGP_STR
- "BGP next-hop tracking updates\n")
-
-DEFUN (debug_bgp_filter,
- debug_bgp_filter_cmd,
- "debug bgp filters",
+/* debug bgp keepalives */
+DEFUN (debug_bgp_keepalive,
+ debug_bgp_keepalive_cmd,
+ "debug bgp keepalives",
DEBUG_STR
BGP_STR
- "BGP filters\n")
+ "BGP keepalives\n")
{
if (vty->node == CONFIG_NODE)
- DEBUG_ON (filter, FILTER);
+ DEBUG_ON (keepalive, KEEPALIVE);
else
{
- TERM_DEBUG_ON (filter, FILTER);
- vty_out (vty, "BGP filters debugging is on%s", VTY_NEWLINE);
+ TERM_DEBUG_ON (keepalive, KEEPALIVE);
+ vty_out (vty, "BGP keepalives debugging is on%s", VTY_NEWLINE);
}
return CMD_SUCCESS;
}
-DEFUN (no_debug_bgp_filter,
- no_debug_bgp_filter_cmd,
- "no debug bgp filters",
- NO_STR
+DEFUN (debug_bgp_keepalive_peer,
+ debug_bgp_keepalive_peer_cmd,
+ "debug bgp keepalives (A.B.C.D|X:X::X:X|WORD)",
DEBUG_STR
BGP_STR
- "BGP filters\n")
+ "BGP Neighbor Events\n"
+ "BGP neighbor IP address to debug\n"
+ "BGP IPv6 neighbor to debug\n"
+ "BGP neighbor on interface to debug\n")
{
- if (vty->node == CONFIG_NODE)
- DEBUG_OFF (filter, FILTER);
- else
+ struct peer *peer;
+
+ peer = bgp_find_peer (vty, argv[0]);
+ if (!peer)
{
- TERM_DEBUG_OFF (filter, FILTER);
- vty_out (vty, "BGP filters debugging is off%s", VTY_NEWLINE);
+ vty_out (vty, "%s is not a configured peer%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
}
- return CMD_SUCCESS;
-}
-ALIAS (no_debug_bgp_filter,
- undebug_bgp_filter_cmd,
- "undebug bgp filters",
- UNDEBUG_STR
- BGP_STR
- "BGP filters\n")
+ if (!bgp_debug_keepalive_peers)
+ bgp_debug_keepalive_peers = list_new ();
+
+ if (bgp_debug_list_has_entry(bgp_debug_keepalive_peers, peer, NULL))
+ {
+ vty_out (vty, "BGP keepalive debugging is already enabled for %s%s", peer->host, VTY_NEWLINE);
+ return CMD_SUCCESS;
+ }
+
+ bgp_debug_list_add_entry(bgp_debug_keepalive_peers, peer, NULL);
-DEFUN (debug_bgp_keepalive,
- debug_bgp_keepalive_cmd,
- "debug bgp keepalives",
- DEBUG_STR
- BGP_STR
- "BGP keepalives\n")
-{
if (vty->node == CONFIG_NODE)
DEBUG_ON (keepalive, KEEPALIVE);
else
{
TERM_DEBUG_ON (keepalive, KEEPALIVE);
- vty_out (vty, "BGP keepalives debugging is on%s", VTY_NEWLINE);
+ vty_out (vty, "BGP keepalives debugging is on for %s%s", argv[0], VTY_NEWLINE);
}
return CMD_SUCCESS;
}
BGP_STR
"BGP keepalives\n")
{
+ bgp_debug_list_free(bgp_debug_keepalive_peers);
+
if (vty->node == CONFIG_NODE)
DEBUG_OFF (keepalive, KEEPALIVE);
else
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_keepalive,
- undebug_bgp_keepalive_cmd,
- "undebug bgp keepalives",
- UNDEBUG_STR
+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_STR
+ DEBUG_STR
BGP_STR
- "BGP keepalives\n")
+ "BGP keepalives\n"
+ "BGP neighbor IP address to debug\n"
+ "BGP IPv6 neighbor to debug\n"
+ "BGP neighbor on interface to debug\n")
+{
+ int found_peer = 0;
+ struct peer *peer;
+
+ peer = bgp_find_peer (vty, argv[0]);
+ if (!peer)
+ {
+ vty_out (vty, "%s is not a configured peer%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ if (bgp_debug_keepalive_peers && !list_isempty(bgp_debug_keepalive_peers))
+ {
+ found_peer = bgp_debug_list_remove_entry(bgp_debug_keepalive_peers, peer, NULL);
+
+ if (list_isempty(bgp_debug_keepalive_peers))
+ {
+ if (vty->node == CONFIG_NODE)
+ DEBUG_OFF (keepalive, KEEPALIVE);
+ else
+ TERM_DEBUG_OFF (keepalive, KEEPALIVE);
+ }
+ }
+
+ if (found_peer)
+ vty_out (vty, "BGP keepalives debugging is off for %s%s", argv[0], VTY_NEWLINE);
+ else
+ vty_out (vty, "BGP keepalives debugging was not enabled for %s%s", argv[0], VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
+/* debug bgp updates */
DEFUN (debug_bgp_update,
debug_bgp_update_cmd,
"debug bgp updates",
return CMD_SUCCESS;
}
-DEFUN (no_debug_bgp_update,
- no_debug_bgp_update_cmd,
- "no debug bgp updates",
- NO_STR
+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_STR
BGP_STR
- "BGP updates\n")
+ "BGP updates\n"
+ "Inbound updates\n"
+ "Outbound updates\n"
+ "BGP neighbor IP address to debug\n"
+ "BGP IPv6 neighbor to debug\n"
+ "BGP neighbor on interface to debug\n")
{
+ struct peer *peer;
+ int inbound;
+
+ peer = bgp_find_peer (vty, argv[1]);
+ if (!peer)
+ {
+ vty_out (vty, "%s is not a configured peer%s", argv[1], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+
+ if (!bgp_debug_update_in_peers)
+ bgp_debug_update_in_peers = list_new ();
+
+ if (!bgp_debug_update_out_peers)
+ bgp_debug_update_out_peers = list_new ();
+
+ if (strncmp ("i", argv[0], 1) == 0)
+ inbound = 1;
+ else
+ inbound = 0;
+
+ if (inbound)
+ {
+ if (bgp_debug_list_has_entry(bgp_debug_update_in_peers, peer, NULL))
+ {
+ vty_out (vty, "BGP inbound update debugging is already enabled for %s%s", peer->host, VTY_NEWLINE);
+ return CMD_SUCCESS;
+ }
+ }
+
+ else
+ {
+ if (bgp_debug_list_has_entry(bgp_debug_update_out_peers, peer, NULL))
+ {
+ vty_out (vty, "BGP outbound update debugging is already enabled for %s%s", peer->host, VTY_NEWLINE);
+ return CMD_SUCCESS;
+ }
+ }
+
+ if (inbound)
+ bgp_debug_list_add_entry(bgp_debug_update_in_peers, peer, NULL);
+ else
+ bgp_debug_list_add_entry(bgp_debug_update_out_peers, peer, NULL);
+
if (vty->node == CONFIG_NODE)
{
- DEBUG_OFF (update, UPDATE_IN);
- DEBUG_OFF (update, UPDATE_OUT);
+ if (inbound)
+ {
+ DEBUG_OFF (update, UPDATE_OUT);
+ DEBUG_ON (update, UPDATE_IN);
+ }
+ else
+ {
+ DEBUG_OFF (update, UPDATE_IN);
+ DEBUG_ON (update, UPDATE_OUT);
+ }
}
else
{
- TERM_DEBUG_OFF (update, UPDATE_IN);
- TERM_DEBUG_OFF (update, UPDATE_OUT);
- vty_out (vty, "BGP updates debugging is off%s", VTY_NEWLINE);
+ if (inbound)
+ {
+ TERM_DEBUG_OFF (update, UPDATE_OUT);
+ TERM_DEBUG_ON (update, UPDATE_IN);
+ vty_out (vty, "BGP updates debugging is on (inbound) for %s%s", argv[1], VTY_NEWLINE);
+ }
+ else
+ {
+ TERM_DEBUG_OFF (update, UPDATE_IN);
+ TERM_DEBUG_ON (update, UPDATE_OUT);
+ vty_out (vty, "BGP updates debugging is on (outbound) for %s%s", argv[1], VTY_NEWLINE);
+ }
}
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_update,
- undebug_bgp_update_cmd,
- "undebug bgp updates",
- UNDEBUG_STR
+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_STR
+ DEBUG_STR
BGP_STR
- "BGP updates\n")
+ "BGP updates\n"
+ "Inbound updates\n"
+ "Outbound updates\n"
+ "BGP neighbor IP address to debug\n"
+ "BGP IPv6 neighbor to debug\n"
+ "BGP neighbor on interface to debug\n")
+{
+ int inbound;
+ int found_peer = 0;
+ struct peer *peer;
+
+ peer = bgp_find_peer (vty, argv[1]);
+ if (!peer)
+ {
+ vty_out (vty, "%s is not a configured peer%s", argv[1], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
-DEFUN (debug_bgp_normal,
- debug_bgp_normal_cmd,
- "debug bgp",
+ if (strncmp ("i", argv[0], 1) == 0)
+ inbound = 1;
+ else
+ inbound = 0;
+
+ if (inbound && bgp_debug_update_in_peers &&
+ !list_isempty(bgp_debug_update_in_peers))
+ {
+ found_peer = bgp_debug_list_remove_entry(bgp_debug_update_in_peers, peer, NULL);
+
+ if (list_isempty(bgp_debug_update_in_peers))
+ {
+ if (vty->node == CONFIG_NODE)
+ DEBUG_OFF (update, UPDATE_IN);
+ else
+ {
+ TERM_DEBUG_OFF (update, UPDATE_IN);
+ vty_out (vty, "BGP updates debugging (inbound) is off%s", VTY_NEWLINE);
+ }
+ }
+ }
+
+ if (!inbound && bgp_debug_update_out_peers &&
+ !list_isempty(bgp_debug_update_out_peers))
+ {
+ found_peer = bgp_debug_list_remove_entry(bgp_debug_update_out_peers, peer, NULL);
+
+ if (list_isempty(bgp_debug_update_out_peers))
+ {
+ if (vty->node == CONFIG_NODE)
+ DEBUG_OFF (update, UPDATE_OUT);
+ else
+ {
+ TERM_DEBUG_OFF (update, UPDATE_OUT);
+ vty_out (vty, "BGP updates debugging (outbound) is off%s", VTY_NEWLINE);
+ }
+ }
+ }
+
+ if (found_peer)
+ if (inbound)
+ vty_out (vty, "BGP updates debugging (inbound) is off for %s%s", argv[1], VTY_NEWLINE);
+ else
+ vty_out (vty, "BGP updates debugging (outbound) is off for %s%s", argv[1], VTY_NEWLINE);
+ else
+ if (inbound)
+ vty_out (vty, "BGP updates debugging (inbound) was not enabled for %s%s", argv[1], VTY_NEWLINE);
+ else
+ vty_out (vty, "BGP updates debugging (outbound) was not enabled for %s%s", argv[1], VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
+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_STR
- BGP_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")
+
{
+ struct prefix *argv_p;
+ int ret;
+
+ argv_p = prefix_new();
+ ret = str2prefix (argv[0], argv_p);
+ if (!ret)
+ {
+ prefix_free(argv_p);
+ vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+
+ if (!bgp_debug_update_prefixes)
+ bgp_debug_update_prefixes = list_new ();
+
+ 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);
+ return CMD_SUCCESS;
+ }
+
+ bgp_debug_list_add_entry(bgp_debug_update_prefixes, NULL, argv_p);
+
if (vty->node == CONFIG_NODE)
- DEBUG_ON (normal, NORMAL);
+ {
+ DEBUG_ON (update, UPDATE_PREFIX);
+ }
else
{
- TERM_DEBUG_ON (normal, NORMAL);
- vty_out (vty, "BGP debugging is on%s", VTY_NEWLINE);
+ TERM_DEBUG_ON (update, UPDATE_PREFIX);
+ vty_out (vty, "BGP updates debugging is on for %s%s", argv[0], VTY_NEWLINE);
}
+
return CMD_SUCCESS;
}
-DEFUN (no_debug_bgp_normal,
- no_debug_bgp_normal_cmd,
- "no debug bgp",
+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_STR
DEBUG_STR
- BGP_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")
+
+{
+ struct prefix *argv_p;
+ int found_prefix = 0;
+ int ret;
+
+ argv_p = prefix_new();
+ ret = str2prefix (argv[0], argv_p);
+ if (!ret)
+ {
+ prefix_free(argv_p);
+ vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ 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);
+
+ if (list_isempty(bgp_debug_update_prefixes))
+ {
+ if (vty->node == CONFIG_NODE)
+ {
+ DEBUG_OFF (update, UPDATE_PREFIX);
+ }
+ else
+ {
+ TERM_DEBUG_OFF (update, UPDATE_PREFIX);
+ vty_out (vty, "BGP updates debugging (per prefix) is off%s", VTY_NEWLINE);
+ }
+ }
+ }
+
+ if (found_prefix)
+ vty_out (vty, "BGP updates debugging is off for %s%s", argv[0], VTY_NEWLINE);
+ else
+ vty_out (vty, "BGP updates debugging was not enabled for %s%s", argv[0], VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_bgp_update,
+ no_debug_bgp_update_cmd,
+ "no debug bgp updates",
+ NO_STR
+ DEBUG_STR
+ BGP_STR
+ "BGP updates\n")
{
+ 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);
+
if (vty->node == CONFIG_NODE)
- DEBUG_OFF (normal, NORMAL);
+ {
+ DEBUG_OFF (update, UPDATE_IN);
+ DEBUG_OFF (update, UPDATE_OUT);
+ DEBUG_OFF (update, UPDATE_PREFIX);
+ }
else
{
- TERM_DEBUG_OFF (normal, NORMAL);
- vty_out (vty, "BGP debugging is off%s", VTY_NEWLINE);
+ TERM_DEBUG_OFF (update, UPDATE_IN);
+ TERM_DEBUG_OFF (update, UPDATE_OUT);
+ TERM_DEBUG_OFF (update, UPDATE_PREFIX);
+ vty_out (vty, "BGP updates debugging is off%s", VTY_NEWLINE);
}
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_normal,
- undebug_bgp_normal_cmd,
- "undebug bgp",
- UNDEBUG_STR
- BGP_STR)
-
+/* debug bgp zebra */
DEFUN (debug_bgp_zebra,
debug_bgp_zebra_cmd,
"debug bgp zebra",
return CMD_SUCCESS;
}
+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_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")
+
+{
+ struct prefix *argv_p;
+ int ret;
+
+ argv_p = prefix_new();
+ ret = str2prefix (argv[0], argv_p);
+ if (!ret)
+ {
+ prefix_free(argv_p);
+ vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (!bgp_debug_zebra_prefixes)
+ bgp_debug_zebra_prefixes = list_new();
+
+ 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);
+ return CMD_SUCCESS;
+ }
+
+ bgp_debug_list_add_entry(bgp_debug_zebra_prefixes, NULL, argv_p);
+
+ 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%s", argv[0], VTY_NEWLINE);
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN (no_debug_bgp_zebra,
no_debug_bgp_zebra_cmd,
"no debug bgp zebra",
BGP_STR
"BGP Zebra messages\n")
{
+ bgp_debug_list_free(bgp_debug_zebra_prefixes);
+
if (vty->node == CONFIG_NODE)
DEBUG_OFF (zebra, ZEBRA);
else
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_zebra,
- undebug_bgp_zebra_cmd,
- "undebug bgp zebra",
- UNDEBUG_STR
+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_STR
+ DEBUG_STR
BGP_STR
- "BGP Zebra messages\n")
+ "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")
+
+{
+ struct prefix *argv_p;
+ int found_prefix = 0;
+ int ret;
+
+ argv_p = prefix_new();
+ ret = str2prefix (argv[0], argv_p);
+ if (!ret)
+ {
+ prefix_free(argv_p);
+ vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (bgp_debug_zebra_prefixes && !list_isempty(bgp_debug_zebra_prefixes))
+ {
+ found_prefix = bgp_debug_list_remove_entry(bgp_debug_neighbor_events_peers, NULL, argv_p);
+
+ if (list_isempty(bgp_debug_zebra_prefixes))
+ {
+ if (vty->node == CONFIG_NODE)
+ DEBUG_OFF (zebra, ZEBRA);
+ else
+ {
+ TERM_DEBUG_OFF (zebra, ZEBRA);
+ vty_out (vty, "BGP zebra debugging is off%s", VTY_NEWLINE);
+ }
+ }
+ }
-DEFUN (no_debug_bgp_all,
- no_debug_bgp_all_cmd,
- "no debug all bgp",
+ if (found_prefix)
+ vty_out (vty, "BGP zebra debugging is off for %s%s", argv[0], VTY_NEWLINE);
+ else
+ vty_out (vty, "BGP zebra debugging was not enabled for %s%s", argv[0], VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_bgp,
+ no_debug_bgp_cmd,
+ "no debug bgp",
NO_STR
DEBUG_STR
- "Enable all debugging\n"
BGP_STR)
{
- TERM_DEBUG_OFF (normal, NORMAL);
- TERM_DEBUG_OFF (events, EVENTS);
+ 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);
+ bgp_debug_list_free(bgp_debug_update_out_peers);
+ bgp_debug_list_free(bgp_debug_update_prefixes);
+ bgp_debug_list_free(bgp_debug_zebra_prefixes);
+
TERM_DEBUG_OFF (keepalive, KEEPALIVE);
TERM_DEBUG_OFF (update, UPDATE_IN);
TERM_DEBUG_OFF (update, UPDATE_OUT);
+ TERM_DEBUG_OFF (update, UPDATE_PREFIX);
TERM_DEBUG_OFF (as4, AS4);
TERM_DEBUG_OFF (as4, AS4_SEGMENT);
- TERM_DEBUG_OFF (fsm, FSM);
- TERM_DEBUG_OFF (filter, FILTER);
+ TERM_DEBUG_OFF (neighbor_events, NEIGHBOR_EVENTS);
TERM_DEBUG_OFF (zebra, ZEBRA);
vty_out (vty, "All possible debugging has been turned off%s", VTY_NEWLINE);
return CMD_SUCCESS;
}
-ALIAS (no_debug_bgp_all,
- undebug_bgp_all_cmd,
- "undebug all bgp",
- UNDEBUG_STR
- "Enable all debugging\n"
- BGP_STR)
-
DEFUN (show_debugging_bgp,
show_debugging_bgp_cmd,
"show debugging bgp",
{
vty_out (vty, "BGP debugging status:%s", VTY_NEWLINE);
- if (BGP_DEBUG (normal, NORMAL))
- vty_out (vty, " BGP debugging is on%s", VTY_NEWLINE);
- if (BGP_DEBUG (events, EVENTS))
- vty_out (vty, " BGP events debugging is on%s", VTY_NEWLINE);
- if (BGP_DEBUG (keepalive, KEEPALIVE))
- vty_out (vty, " BGP keepalives debugging is on%s", VTY_NEWLINE);
- if (BGP_DEBUG (update, UPDATE_IN) && BGP_DEBUG (update, UPDATE_OUT))
- vty_out (vty, " BGP updates debugging is on%s", VTY_NEWLINE);
- else if (BGP_DEBUG (update, UPDATE_IN))
- vty_out (vty, " BGP updates debugging is on (inbound)%s", VTY_NEWLINE);
- else if (BGP_DEBUG (update, UPDATE_OUT))
- vty_out (vty, " BGP updates debugging is on (outbound)%s", VTY_NEWLINE);
- if (BGP_DEBUG (fsm, FSM))
- vty_out (vty, " BGP fsm debugging is on%s", VTY_NEWLINE);
- if (BGP_DEBUG (filter, FILTER))
- vty_out (vty, " BGP filter debugging is on%s", VTY_NEWLINE);
- if (BGP_DEBUG (zebra, ZEBRA))
- vty_out (vty, " BGP zebra debugging is on%s", VTY_NEWLINE);
if (BGP_DEBUG (as4, AS4))
vty_out (vty, " BGP as4 debugging is on%s", VTY_NEWLINE);
+
if (BGP_DEBUG (as4, AS4_SEGMENT))
vty_out (vty, " BGP as4 aspath segment debugging is on%s", VTY_NEWLINE);
+
+ if (BGP_DEBUG (neighbor_events, NEIGHBOR_EVENTS))
+ bgp_debug_list_print (vty, " BGP neighbor-events debugging is on",
+ bgp_debug_neighbor_events_peers);
+
+ if (BGP_DEBUG (keepalive, KEEPALIVE))
+ bgp_debug_list_print (vty, " BGP keepalives debugging is on",
+ bgp_debug_keepalive_peers);
+
if (BGP_DEBUG (nht, NHT))
vty_out (vty, " BGP next-hop tracking debugging is on%s", VTY_NEWLINE);
+
+ if (BGP_DEBUG (update, UPDATE_PREFIX))
+ bgp_debug_list_print (vty, " BGP updates debugging is on for",
+ bgp_debug_update_prefixes);
+
+ if (BGP_DEBUG (update, UPDATE_IN))
+ bgp_debug_list_print (vty, " BGP updates debugging is on (inbound)",
+ bgp_debug_update_in_peers);
+
+ if (BGP_DEBUG (update, UPDATE_OUT))
+ bgp_debug_list_print (vty, " BGP updates debugging is on (outbound)",
+ bgp_debug_update_out_peers);
+
+ if (BGP_DEBUG (zebra, ZEBRA))
+ bgp_debug_list_print (vty, " BGP zebra debugging is on",
+ bgp_debug_zebra_prefixes);
+
vty_out (vty, "%s", VTY_NEWLINE);
return CMD_SUCCESS;
}
{
int write = 0;
- if (CONF_BGP_DEBUG (normal, NORMAL))
- {
- vty_out (vty, "debug bgp%s", VTY_NEWLINE);
- write++;
- }
-
if (CONF_BGP_DEBUG (as4, AS4))
{
vty_out (vty, "debug bgp as4%s", VTY_NEWLINE);
write++;
}
- if (CONF_BGP_DEBUG (events, EVENTS))
- {
- vty_out (vty, "debug bgp events%s", VTY_NEWLINE);
- write++;
- }
-
if (CONF_BGP_DEBUG (keepalive, KEEPALIVE))
{
vty_out (vty, "debug bgp keepalives%s", VTY_NEWLINE);
write++;
}
- if (CONF_BGP_DEBUG (fsm, FSM))
+ if (CONF_BGP_DEBUG (neighbor_events, NEIGHBOR_EVENTS))
{
- vty_out (vty, "debug bgp fsm%s", VTY_NEWLINE);
- write++;
- }
-
- if (CONF_BGP_DEBUG (filter, FILTER))
- {
- vty_out (vty, "debug bgp filters%s", VTY_NEWLINE);
+ vty_out (vty, "debug bgp neighbor-events%s", VTY_NEWLINE);
write++;
}
install_element (ENABLE_NODE, &debug_bgp_as4_segment_cmd);
install_element (CONFIG_NODE, &debug_bgp_as4_segment_cmd);
- install_element (ENABLE_NODE, &debug_bgp_fsm_cmd);
- install_element (CONFIG_NODE, &debug_bgp_fsm_cmd);
- install_element (ENABLE_NODE, &debug_bgp_events_cmd);
- install_element (CONFIG_NODE, &debug_bgp_events_cmd);
+ install_element (ENABLE_NODE, &debug_bgp_neighbor_events_cmd);
+ install_element (CONFIG_NODE, &debug_bgp_neighbor_events_cmd);
install_element (ENABLE_NODE, &debug_bgp_nht_cmd);
install_element (CONFIG_NODE, &debug_bgp_nht_cmd);
- install_element (ENABLE_NODE, &debug_bgp_filter_cmd);
- install_element (CONFIG_NODE, &debug_bgp_filter_cmd);
install_element (ENABLE_NODE, &debug_bgp_keepalive_cmd);
install_element (CONFIG_NODE, &debug_bgp_keepalive_cmd);
install_element (ENABLE_NODE, &debug_bgp_update_cmd);
install_element (CONFIG_NODE, &debug_bgp_update_cmd);
install_element (ENABLE_NODE, &debug_bgp_update_direct_cmd);
install_element (CONFIG_NODE, &debug_bgp_update_direct_cmd);
- install_element (ENABLE_NODE, &debug_bgp_normal_cmd);
- install_element (CONFIG_NODE, &debug_bgp_normal_cmd);
install_element (ENABLE_NODE, &debug_bgp_zebra_cmd);
install_element (CONFIG_NODE, &debug_bgp_zebra_cmd);
+ /* deb bgp updates [in|out] A.B.C.D */
+ install_element (ENABLE_NODE, &debug_bgp_update_direct_peer_cmd);
+ install_element (CONFIG_NODE, &debug_bgp_update_direct_peer_cmd);
+ install_element (ENABLE_NODE, &no_debug_bgp_update_direct_peer_cmd);
+ install_element (CONFIG_NODE, &no_debug_bgp_update_direct_peer_cmd);
+
+ /* deb bgp updates prefix A.B.C.D/M */
+ install_element (ENABLE_NODE, &debug_bgp_update_prefix_cmd);
+ install_element (CONFIG_NODE, &debug_bgp_update_prefix_cmd);
+ install_element (ENABLE_NODE, &no_debug_bgp_update_prefix_cmd);
+ install_element (CONFIG_NODE, &no_debug_bgp_update_prefix_cmd);
+
+ /* deb bgp zebra prefix A.B.C.D/M */
+ install_element (ENABLE_NODE, &debug_bgp_zebra_prefix_cmd);
+ install_element (CONFIG_NODE, &debug_bgp_zebra_prefix_cmd);
+ install_element (ENABLE_NODE, &no_debug_bgp_zebra_prefix_cmd);
+ install_element (CONFIG_NODE, &no_debug_bgp_zebra_prefix_cmd);
+
install_element (ENABLE_NODE, &no_debug_bgp_as4_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_as4_cmd);
install_element (CONFIG_NODE, &no_debug_bgp_as4_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_as4_segment_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_as4_segment_cmd);
install_element (CONFIG_NODE, &no_debug_bgp_as4_segment_cmd);
- install_element (ENABLE_NODE, &no_debug_bgp_fsm_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_fsm_cmd);
- install_element (CONFIG_NODE, &no_debug_bgp_fsm_cmd);
- install_element (ENABLE_NODE, &no_debug_bgp_events_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_events_cmd);
- install_element (CONFIG_NODE, &no_debug_bgp_events_cmd);
+ /* deb bgp neighbor-events A.B.C.D */
+ install_element (ENABLE_NODE, &debug_bgp_neighbor_events_peer_cmd);
+ install_element (CONFIG_NODE, &debug_bgp_neighbor_events_peer_cmd);
+ install_element (ENABLE_NODE, &no_debug_bgp_neighbor_events_peer_cmd);
+ install_element (CONFIG_NODE, &no_debug_bgp_neighbor_events_peer_cmd);
+
+ /* deb bgp keepalive A.B.C.D */
+ install_element (ENABLE_NODE, &debug_bgp_keepalive_peer_cmd);
+ install_element (CONFIG_NODE, &debug_bgp_keepalive_peer_cmd);
+ install_element (ENABLE_NODE, &no_debug_bgp_keepalive_peer_cmd);
+ install_element (CONFIG_NODE, &no_debug_bgp_keepalive_peer_cmd);
+
+ install_element (ENABLE_NODE, &no_debug_bgp_neighbor_events_cmd);
+ install_element (CONFIG_NODE, &no_debug_bgp_neighbor_events_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_nht_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_nht_cmd);
install_element (CONFIG_NODE, &no_debug_bgp_nht_cmd);
- install_element (ENABLE_NODE, &no_debug_bgp_filter_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_filter_cmd);
- install_element (CONFIG_NODE, &no_debug_bgp_filter_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_keepalive_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_keepalive_cmd);
install_element (CONFIG_NODE, &no_debug_bgp_keepalive_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_update_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_update_cmd);
install_element (CONFIG_NODE, &no_debug_bgp_update_cmd);
- install_element (ENABLE_NODE, &no_debug_bgp_normal_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_normal_cmd);
- install_element (CONFIG_NODE, &no_debug_bgp_normal_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_zebra_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_zebra_cmd);
install_element (CONFIG_NODE, &no_debug_bgp_zebra_cmd);
- install_element (ENABLE_NODE, &no_debug_bgp_all_cmd);
- install_element (ENABLE_NODE, &undebug_bgp_all_cmd);
+ install_element (ENABLE_NODE, &no_debug_bgp_cmd);
+}
+
+/* Return true if this prefix is on the per_prefix_list of prefixes to debug
+ * for BGP_DEBUG_TYPE
+ */
+static int
+bgp_debug_per_prefix (struct prefix *p, unsigned long term_bgp_debug_type,
+ unsigned int BGP_DEBUG_TYPE, struct list *per_prefix_list)
+{
+ struct bgp_debug_filter *filter;
+ struct listnode *node, *nnode;
+
+ if (term_bgp_debug_type & BGP_DEBUG_TYPE)
+ {
+ /* We are debugging all prefixes so return true */
+ if (!per_prefix_list || list_isempty(per_prefix_list))
+ return 1;
+
+ else
+ {
+ if (!p)
+ return 0;
+
+ for (ALL_LIST_ELEMENTS (per_prefix_list, node, nnode, filter))
+ if (filter->p->prefixlen == p->prefixlen && prefix_match(filter->p, p))
+ return 1;
+
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
+/* Return true if this peer is on the per_peer_list of peers to debug
+ * for BGP_DEBUG_TYPE
+ */
+static int
+bgp_debug_per_peer(struct peer *peer, unsigned long term_bgp_debug_type,
+ unsigned int BGP_DEBUG_TYPE, struct list *per_peer_list)
+{
+ struct bgp_debug_filter *filter;
+ struct listnode *node, *nnode;
+
+ if (term_bgp_debug_type & BGP_DEBUG_TYPE)
+ {
+ /* We are debugging all peers so return true */
+ if (!per_peer_list || list_isempty(per_peer_list))
+ return 1;
+
+ else
+ {
+ if (!peer)
+ return 0;
+
+ for (ALL_LIST_ELEMENTS (per_peer_list, node, nnode, filter))
+ if (filter->peer == peer)
+ return 1;
+
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
+int
+bgp_debug_neighbor_events (struct peer *peer)
+{
+ return bgp_debug_per_peer (peer,
+ term_bgp_debug_neighbor_events,
+ BGP_DEBUG_NEIGHBOR_EVENTS,
+ bgp_debug_neighbor_events_peers);
+}
+
+int
+bgp_debug_keepalive (struct peer *peer)
+{
+ return bgp_debug_per_peer (peer,
+ term_bgp_debug_keepalive,
+ BGP_DEBUG_KEEPALIVE,
+ bgp_debug_keepalive_peers);
+}
+
+int
+bgp_debug_update (struct peer *peer, struct prefix *p, unsigned int inbound)
+{
+ if (inbound)
+ {
+ if (bgp_debug_per_peer (peer, term_bgp_debug_update, BGP_DEBUG_UPDATE_IN,
+ bgp_debug_update_in_peers))
+ return 1;
+ }
+
+ /* outbound */
+ else
+ {
+ if (bgp_debug_per_peer (peer, term_bgp_debug_update,
+ BGP_DEBUG_UPDATE_OUT,
+ bgp_debug_update_out_peers))
+ return 1;
+ }
+
+
+ if (BGP_DEBUG (update, UPDATE_PREFIX))
+ {
+ if (bgp_debug_per_prefix (p, term_bgp_debug_update,
+ BGP_DEBUG_UPDATE_PREFIX,
+ bgp_debug_update_prefixes))
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+bgp_debug_zebra (struct prefix *p)
+{
+ if (BGP_DEBUG (zebra, ZEBRA))
+ {
+ if (bgp_debug_per_prefix (p, term_bgp_debug_zebra, BGP_DEBUG_ZEBRA,
+ bgp_debug_zebra_prefixes))
+ return 1;
+ }
+
+ return 0;
}
extern int debug (unsigned int option);
extern unsigned long conf_bgp_debug_as4;
-extern unsigned long conf_bgp_debug_fsm;
-extern unsigned long conf_bgp_debug_events;
+extern unsigned long conf_bgp_debug_neighbor_events;
extern unsigned long conf_bgp_debug_packet;
-extern unsigned long conf_bgp_debug_filter;
extern unsigned long conf_bgp_debug_keepalive;
extern unsigned long conf_bgp_debug_update;
-extern unsigned long conf_bgp_debug_normal;
extern unsigned long conf_bgp_debug_zebra;
extern unsigned long conf_bgp_debug_nht;
extern unsigned long term_bgp_debug_as4;
-extern unsigned long term_bgp_debug_fsm;
-extern unsigned long term_bgp_debug_events;
+extern unsigned long term_bgp_debug_neighbor_events;
extern unsigned long term_bgp_debug_packet;
-extern unsigned long term_bgp_debug_filter;
extern unsigned long term_bgp_debug_keepalive;
extern unsigned long term_bgp_debug_update;
-extern unsigned long term_bgp_debug_normal;
extern unsigned long term_bgp_debug_zebra;
extern unsigned long term_bgp_debug_nht;
+extern struct list *bgp_debug_neighbor_events_peers;
+extern struct list *bgp_debug_keepalive_peers;
+extern struct list *bgp_debug_update_in_peers;
+extern struct list *bgp_debug_update_out_peers;
+extern struct list *bgp_debug_update_prefixes;
+extern struct list *bgp_debug_zebra_prefixes;
+
+struct bgp_debug_filter
+{
+ struct peer *peer;
+ struct prefix *p;
+};
+
#define BGP_DEBUG_AS4 0x01
#define BGP_DEBUG_AS4_SEGMENT 0x02
-#define BGP_DEBUG_FSM 0x01
-#define BGP_DEBUG_EVENTS 0x01
+#define BGP_DEBUG_NEIGHBOR_EVENTS 0x01
#define BGP_DEBUG_PACKET 0x01
-#define BGP_DEBUG_FILTER 0x01
#define BGP_DEBUG_KEEPALIVE 0x01
#define BGP_DEBUG_UPDATE_IN 0x01
#define BGP_DEBUG_UPDATE_OUT 0x02
-#define BGP_DEBUG_NORMAL 0x01
+#define BGP_DEBUG_UPDATE_PREFIX 0x04
#define BGP_DEBUG_ZEBRA 0x01
#define BGP_DEBUG_NHT 0x01
#define BGP_DEBUG_PACKET_SEND 0x01
#define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
-#define BGP_DEBUG_PACKET_RECV 0x01
-#define BGP_DEBUG_PACKET_RECV_DETAIL 0x02
-
#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))
extern const struct message bgp_status_msg[];
extern const int bgp_status_msg_max;
+extern int bgp_debug_neighbor_events(struct peer *peer);
+extern int bgp_debug_keepalive(struct peer *peer);
+extern int bgp_debug_update(struct peer *peer, struct prefix *p, unsigned int inbound);
+extern int bgp_debug_zebra(struct prefix *p);
#endif /* _QUAGGA_BGP_DEBUG_H */
peer = THREAD_ARG (thread);
peer->t_start = NULL;
- if (BGP_DEBUG (fsm, FSM))
- zlog (peer->log, LOG_DEBUG,
- "%s [FSM] Timer (start timer expire).", peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug("%s [FSM] Timer (start timer expire).", peer->host);
THREAD_VAL (thread) = BGP_Start;
bgp_event (thread); /* bgp_event unlocks peer */
peer = THREAD_ARG (thread);
peer->t_connect = NULL;
- if (BGP_DEBUG (fsm, FSM))
- zlog (peer->log, LOG_DEBUG, "%s [FSM] Timer (connect timer expire)",
- peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug("%s [FSM] Timer (connect timer expire)", peer->host);
if (CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER))
{
peer = THREAD_ARG (thread);
peer->t_holdtime = NULL;
- if (BGP_DEBUG (fsm, FSM))
- zlog (peer->log, LOG_DEBUG,
- "%s [FSM] Timer (holdtime timer expire)",
- peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [FSM] Timer (holdtime timer expire)", peer->host);
THREAD_VAL (thread) = Hold_Timer_expired;
bgp_event (thread); /* bgp_event unlocks peer */
peer = THREAD_ARG (thread);
peer->t_keepalive = NULL;
- if (BGP_DEBUG (fsm, FSM))
- zlog (peer->log, LOG_DEBUG,
- "%s [FSM] Timer (keepalive timer expire)",
- peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [FSM] Timer (keepalive timer expire)", peer->host);
THREAD_VAL (thread) = KeepAlive_timer_expired;
bgp_event (thread); /* bgp_event unlocks peer */
peer->t_routeadv = NULL;
peer->radv_adjusted = 0;
- if (BGP_DEBUG (fsm, FSM))
- zlog (peer->log, LOG_DEBUG,
- "%s [FSM] Timer (routeadv timer expire)",
- peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [FSM] Timer (routeadv timer expire)", peer->host);
peer->synctime = bgp_clock ();
UNSET_FLAG (peer->sflags, PEER_STATUS_NSF_WAIT);
BGP_TIMER_OFF (peer->t_gr_stale);
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
{
zlog_debug ("%s graceful restart timer expired", peer->host);
zlog_debug ("%s graceful restart stalepath timer stopped", peer->host);
peer = THREAD_ARG (thread);
peer->t_gr_stale = NULL;
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s graceful restart stalepath timer expired", peer->host);
/* NSF delete stale route */
{
BGP_TIMER_OFF(peer->t_routeadv);
BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0);
- if (BGP_DEBUG (update, UPDATE_OUT))
- zlog (peer->log, LOG_DEBUG, "%s: MRAI timer to expire instantly\n",
- peer->host);
+ if (bgp_debug_update(peer, NULL, 0))
+ zlog_debug ("%s: MRAI timer to expire instantly", peer->host);
return;
}
{
BGP_TIMER_OFF(peer->t_routeadv);
BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, diff);
- if (BGP_DEBUG (update, UPDATE_OUT))
- zlog (peer->log, LOG_DEBUG, "%s: MRAI timer to expire in %f secs\n",
- peer->host, diff);
+ if (bgp_debug_update(peer, NULL, 0))
+ zlog_debug ("%s: MRAI timer to expire in %f secs", peer->host, diff);
}
}
bgp_update_delay_applicable(peer->bgp))
bgp_update_delay_process_status_change(peer);
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s went from %s to %s",
peer->host,
LOOKUP (bgp_status_msg, peer->ostatus),
if (peer->t_gr_stale)
{
BGP_TIMER_OFF (peer->t_gr_stale);
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s graceful restart stalepath timer stopped", peer->host);
}
if (CHECK_FLAG (peer->sflags, PEER_STATUS_NSF_WAIT))
{
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
{
zlog_debug ("%s graceful restart timer started for %d sec",
peer->host, peer->v_gr_restart);
BGP_READ_ON (peer->t_read, bgp_read, peer->fd);
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
{
char buf1[SU_ADDRSTRLEN];
if (BGP_PEER_START_SUPPRESSED (peer))
{
- if (BGP_DEBUG (fsm, FSM))
- plog_err (peer->log, "%s [FSM] Trying to start suppressed peer"
+ if (bgp_debug_neighbor_events(peer))
+ zlog_err ("%s [FSM] Trying to start suppressed peer"
" - this is never supposed to happen!", peer->host);
return -1;
}
switch (status)
{
case connect_error:
- if (BGP_DEBUG (fsm, FSM))
- plog_debug (peer->log, "%s [FSM] Connect error", peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [FSM] Connect error", peer->host);
BGP_EVENT_ADD (peer, TCP_connection_open_failed);
break;
case connect_success:
- if (BGP_DEBUG (fsm, FSM))
- plog_debug (peer->log, "%s [FSM] Connect immediately success",
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [FSM] Connect immediately success",
peer->host);
BGP_EVENT_ADD (peer, TCP_connection_open);
break;
case connect_in_progress:
/* To check nonblocking connect, we wait until socket is
readable or writable. */
- if (BGP_DEBUG (fsm, FSM))
- plog_debug (peer->log, "%s [FSM] Non blocking connect waiting result",
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [FSM] Non blocking connect waiting result",
peer->host);
if (peer->fd < 0)
{
static int
bgp_fsm_event_error (struct peer *peer)
{
- plog_err (peer->log, "%s [FSM] unexpected packet received in state %s",
+ zlog_err ("%s [FSM] unexpected packet received in state %s",
peer->host, LOOKUP (bgp_status_msg, peer->status));
return bgp_stop_with_notify (peer, BGP_NOTIFY_FSM_ERR, 0);
static int
bgp_fsm_holdtime_expire (struct peer *peer)
{
- if (BGP_DEBUG (fsm, FSM))
- plog_debug (peer->log, "%s [FSM] Hold timer expire", peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [FSM] Hold timer expire", peer->host);
return bgp_stop_with_notify (peer, BGP_NOTIFY_HOLD_ERR, 0);
}
if (peer->t_gr_stale)
{
BGP_TIMER_OFF (peer->t_gr_stale);
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s graceful restart stalepath timer stopped", peer->host);
}
}
if (peer->t_gr_restart)
{
BGP_TIMER_OFF (peer->t_gr_restart);
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s graceful restart timer stopped", peer->host);
}
if (peer->doppelganger && (peer->doppelganger->status != Deleted))
{
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug("[Event] Deleting stub connection for peer %s", peer->host);
if (peer->doppelganger->status > Active)
static int
bgp_ignore (struct peer *peer)
{
- if (BGP_DEBUG (fsm, FSM))
- zlog (peer->log, LOG_DEBUG, "%s [FSM] bgp_ignore called", peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [FSM] bgp_ignore called", peer->host);
return 0;
}
/* Logging this event. */
next = FSM [peer->status -1][event - 1].next_state;
- if (BGP_DEBUG (fsm, FSM) && peer->status != next)
- plog_debug (peer->log, "%s [FSM] %s (%s->%s)", peer->host,
+ if (bgp_debug_neighbor_events(peer) && peer->status != next)
+ zlog_debug ("%s [FSM] %s (%s->%s)", peer->host,
bgp_event_str[event],
LOOKUP (bgp_status_msg, peer->status),
LOOKUP (bgp_status_msg, next));
void
sighup (void)
{
- zlog (NULL, LOG_INFO, "SIGHUP received");
+ zlog_info ("SIGHUP received");
/* Terminate all thread. */
bgp_terminate ();
if (zlog_default)
closezlog (zlog_default);
- if (CONF_BGP_DEBUG (normal, NORMAL))
- log_memstats_stderr ("bgpd");
-
exit (status);
}
old_mpath_count = 0;
prev_mpath = new_best;
mp_node = listhead (mp_list);
- debug = BGP_DEBUG (events, EVENTS);
+ debug = bgp_debug_update(NULL, &rn->p, 1) || bgp_debug_update(NULL, &rn->p, 0);
if (debug)
prefix2str (&rn->p, pfx_buf, sizeof (pfx_buf));
#endif /* HAVE_TCP_MD5SIG */
if (ret < 0)
- zlog (NULL, LOG_WARNING, "can't set TCP_MD5SIG option on socket %d: %s",
- socket, safe_strerror (en));
+ zlog_warn ("can't set TCP_MD5SIG option on socket %d: %s", socket, safe_strerror (en));
return ret;
}
/* Set socket send buffer size */
bgp_update_sock_send_buffer_size(bgp_sock);
- if (BGP_DEBUG (events, EVENTS))
- zlog_debug ("[Event] BGP connection from host %s", inet_sutop (&su, buf));
-
/* Check remote IP address */
peer1 = peer_lookup (NULL, &su);
if (! peer1)
{
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
{
zlog_debug ("[Event] BGP connection IP address %s is not configured",
inet_sutop (&su, buf));
if (CHECK_FLAG(peer1->flags, PEER_FLAG_SHUTDOWN))
{
- zlog_debug ("[Event] connection from %s rejected due to admin shutdown",
- inet_sutop (&su, buf));
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("[Event] connection from %s rejected due to admin shutdown",
+ inet_sutop (&su, buf));
close (bgp_sock);
return -1;
}
{
struct bgp *bgp = peer1->bgp;
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer1))
zlog_debug("[Event] Closing incoming conn for %s (0x%x) state %d",
peer1->host, peer1, peer1->status);
close (bgp_sock);
return -1;
}
+ if (bgp_debug_neighbor_events(peer1))
+ zlog_debug ("[Event] BGP connection from host %s", inet_sutop (&su, buf));
+
if (peer1->doppelganger)
{
/* We have an existing connection. Kill the existing one and run
with this one.
*/
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("[Event] New active connection from peer %s, Killing"
" previous active connection", peer1->host);
peer_delete(peer1->doppelganger);
if (ret < 0)
{
- zlog (peer->log, LOG_INFO, "bind to interface %s failed", name);
+ zlog_info ("bind to interface %s failed", name);
return ret;
}
#endif /* SO_BINDTODEVICE */
ifindex = if_nametoindex (peer->conf_if ? peer->conf_if : peer->ifname);
#endif /* HAVE_IPV6 */
- if (BGP_DEBUG (events, EVENTS))
- plog_debug (peer->log, "%s [Event] Connect start to %s fd %d",
- peer->host, peer->host, peer->fd);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [Event] Connect start to %s fd %d",
+ peer->host, peer->host, peer->fd);
/* Connect to the remote peer. */
return sockunion_connect (peer->fd, &peer->su, htons (peer->port), ifindex);
bgp_capability_mp_data (s, &mpc);
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer->host))
zlog_debug ("%s OPEN has MP_EXT CAP for afi/safi: %u/%u",
peer->host, mpc.afi, mpc.safi);
bgp_capability_orf_not_support (struct peer *peer, afi_t afi, safi_t safi,
u_char type, u_char mode)
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Addr-family %d/%d has ORF type/mode %d/%d not supported",
peer->host, afi, safi, type, mode);
}
afi = entry.mpc.afi;
safi = entry.mpc.safi;
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s ORF Cap entry for afi/safi: %u/%u",
peer->host, entry.mpc.afi, entry.mpc.safi);
continue;
}
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s OPEN has %s ORF capability"
" as %s for afi/safi: %d/%d",
peer->host, LOOKUP (orf_type_str, type),
UNSET_FLAG (restart_flag_time, 0xF000);
peer->v_gr_restart = restart_flag_time;
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
{
zlog_debug ("%s OPEN has Graceful Restart capability", peer->host);
zlog_debug ("%s Peer has%srestarted. Restart Time : %d",
if (!bgp_afi_safi_valid_indices (afi, &safi))
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Addr-family %d/%d(afi/safi) not supported."
" Ignore the Graceful Restart capability",
peer->host, afi, safi);
}
else if (!peer->afc[afi][safi])
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Addr-family %d/%d(afi/safi) not enabled."
" Ignore the Graceful Restart capability",
peer->host, afi, safi);
}
else
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Address family %s is%spreserved", peer->host,
afi_safi_print (afi, safi),
CHECK_FLAG (peer->af_cap[afi][safi],
return -1;
}
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s OPEN has %s capability (%u), length %u",
peer->host,
LOOKUP (capcode_str, caphdr.code),
ret = 0;
error = error_data;
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s rcv OPEN w/ OPTION parameter len: %u",
peer->host, length);
return -1;
}
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s rcvd OPEN w/ optional parameter type %u (%s) len %u",
peer->host, opt_type,
opt_type == BGP_OPEN_OPT_AUTH ? "Authentication" :
&& ! peer->afc_nego[AFI_IP6][SAFI_UNICAST]
&& ! peer->afc_nego[AFI_IP6][SAFI_MULTICAST])
{
- plog_err (peer->log, "%s [Error] Configured AFI/SAFIs do not "
+ zlog_err ("%s [Error] Configured AFI/SAFIs do not "
"overlap with received MP capabilities",
peer->host);
/* If getsockopt is fail, this is fatal error. */
if (ret < 0)
{
- zlog (peer->log, LOG_INFO, "can't get sockopt for nonblocking connect");
+ zlog_info ("can't get sockopt for nonblocking connect");
BGP_EVENT_ADD (peer, TCP_fatal_error);
return -1;
}
}
else
{
- if (BGP_DEBUG (events, EVENTS))
- plog_debug (peer->log, "%s [Event] Connect failed (%s)",
- peer->host, safe_strerror (errno));
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [Event] Connect failed (%s)",
+ peer->host, safe_strerror (errno));
if (change_state)
BGP_EVENT_ADD (peer, TCP_connection_open_failed);
return 0;
size_t mpattrlen_pos = 0;
size_t mpattr_pos = 0;
int num_pfx_adv = 0;
+ char send_attr_str[BUFSIZ];
+ int send_attr_printed;
s = peer->work;
stream_reset (s);
adv = bgp_advertise_clean (peer, adv->adj, afi, safi);
return NULL;
}
+
+ if (BGP_DEBUG (update, UPDATE_OUT) ||
+ BGP_DEBUG (update, UPDATE_PREFIX))
+ {
+ memset (send_attr_str, 0, BUFSIZ);
+ send_attr_printed = 0;
+ bgp_dump_attr (peer, adv->baa->attr, send_attr_str, BUFSIZ);
+ }
}
if (afi == AFI_IP && safi == SAFI_UNICAST)
}
num_pfx_adv++;
- if (BGP_DEBUG (update, UPDATE_OUT))
+ if (bgp_debug_update(peer, &rn->p, 0))
{
+ if (!send_attr_printed)
+ {
+ zlog_debug ("%s send UPDATE w/ attr: %s", peer->host, send_attr_str);
+ send_attr_printed = 1;
+ }
char buf[INET6_BUFSIZ];
- zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d",
- peer->host,
- inet_ntop (rn->p.family, &(rn->p.u.prefix), buf, INET6_BUFSIZ),
- rn->p.prefixlen);
+ zlog_debug ("%s send UPDATE %s/%d",
+ peer->host,
+ inet_ntop (rn->p.family, &(rn->p.u.prefix), buf, INET6_BUFSIZ),
+ rn->p.prefixlen);
}
/* Synchnorize attribute. */
packet = stream_dup (s);
bgp_packet_set_size (packet);
if (BGP_DEBUG (update, UPDATE_OUT))
- zlog(peer->log, LOG_DEBUG,
- "%s form UPDATE (adv) total len %d numPfx %d",
- peer->host,
- (stream_get_endp (s) - stream_get_getp (s)), num_pfx_adv);
+ zlog_debug("%s form UPDATE (adv) total len %d numPfx %d",
+ peer->host,
+ (stream_get_endp (s) - stream_get_getp (s)), num_pfx_adv);
bgp_packet_add (peer, packet);
stream_reset (s);
stream_reset (snlri);
if (DISABLE_BGP_ANNOUNCE)
return NULL;
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("send End-of-RIB for %s to %s", afi_safi_print (afi, safi), peer->host);
s = stream_new (BGP_MAX_PACKET_SIZE);
}
num_pfx_wd++;
- if (BGP_DEBUG (update, UPDATE_OUT))
+ if (bgp_debug_update(peer, &rn->p, 0))
{
char buf[INET6_BUFSIZ];
- zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d -- unreachable",
- peer->host,
- inet_ntop (rn->p.family, &(rn->p.u.prefix), buf, INET6_BUFSIZ),
- rn->p.prefixlen);
+ zlog_debug ("%s send UPDATE %s/%d -- unreachable",
+ peer->host,
+ inet_ntop (rn->p.family, &(rn->p.u.prefix), buf, INET6_BUFSIZ),
+ rn->p.prefixlen);
}
peer->scount[afi][safi]--;
}
bgp_packet_set_size (s);
if (BGP_DEBUG (update, UPDATE_OUT))
- zlog(peer->log, LOG_DEBUG,
- "%s form UPDATE (wd) total len %d numPfx %d",
- peer->host,
- (stream_get_endp (s) - stream_get_getp (s)), num_pfx_wd);
+ zlog_debug("%s form UPDATE (wd) total len %d numPfx %d",
+ peer->host,
+ (stream_get_endp (s) - stream_get_getp (s)), num_pfx_wd);
packet = stream_dup (s);
bgp_packet_add (peer, packet);
stream_reset (s);
#endif /* HAVE_IPV6 */
/* Logging the attribute. */
- if (BGP_DEBUG (update, UPDATE_OUT))
+ if (bgp_debug_update(peer, &p, 0))
{
char attrstr[BUFSIZ];
char buf[INET6_BUFSIZ];
attrstr[0] = '\0';
bgp_dump_attr (peer, attr, attrstr, BUFSIZ);
- zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d %s",
- peer->host, inet_ntop(p.family, &(p.u.prefix), buf, INET6_BUFSIZ),
- p.prefixlen, attrstr);
+ zlog_debug ("%s send UPDATE %s/%d %s",
+ peer->host, inet_ntop(p.family, &(p.u.prefix), buf, INET6_BUFSIZ),
+ p.prefixlen, attrstr);
}
s = stream_new (BGP_MAX_PACKET_SIZE);
total_attr_len = 0;
- if (BGP_DEBUG (update, UPDATE_OUT))
+ if (bgp_debug_update(peer, &p, 0))
{
char buf[INET6_BUFSIZ];
- zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d -- unreachable",
- peer->host, inet_ntop(p.family, &(p.u.prefix), buf, INET6_BUFSIZ),
- p.prefixlen);
+ zlog_debug ("%s send UPDATE %s/%d -- unreachable",
+ peer->host, inet_ntop(p.family, &(p.u.prefix), buf, INET6_BUFSIZ),
+ p.prefixlen);
}
s = stream_new (BGP_MAX_PACKET_SIZE);
/* If withdraw FIFO exists, immediately schedule write */
if (bgp_peer_wd_fifo_exists(peer) && !peer->t_write)
{
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_update(peer, NULL, 0))
zlog_debug("%s scheduling write thread", peer->host);
BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd);
}
/* If update FIFO exists, fire MRAI timer */
if (bgp_peer_adv_fifo_exists(peer, 0) && !peer->radv_adjusted)
{
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_update(peer, NULL, 0))
zlog_debug("%s scheduling MRAI timer", peer->host);
bgp_adjust_routeadv(peer);
}
/* Dump packet if debug option is set. */
/* bgp_packet_dump (s); */
- if (BGP_DEBUG (keepalive, KEEPALIVE))
+ if (bgp_debug_keepalive(peer))
zlog_debug ("%s sending KEEPALIVE", peer->host);
- if (BGP_DEBUG (normal, NORMAL))
- zlog_debug ("%s send message type %d, length (incl. header) %d",
- peer->host, BGP_MSG_KEEPALIVE, length);
/* Add packet to the peer. */
bgp_packet_add (peer, s);
/* Set BGP packet length. */
length = bgp_packet_set_size (s);
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s sending OPEN, version %d, my as %u, holdtime %d, id %s",
peer->host, BGP_VERSION_4, local_as,
send_holdtime, inet_ntoa (peer->local_id));
- if (BGP_DEBUG (normal, NORMAL))
- zlog_debug ("%s send message type %d, length (incl. header) %d",
- peer->host, BGP_MSG_OPEN, length);
-
/* Dump packet if debug option is set. */
/* bgp_packet_dump (s); */
XFREE (MTYPE_TMP, bgp_notify.data);
}
- if (BGP_DEBUG (normal, NORMAL))
- zlog_debug ("%s send message type %d, length (incl. header) %d",
- peer->host, BGP_MSG_NOTIFY, length);
-
/* peer reset cause */
if (sub_code != BGP_NOTIFY_CEASE_CONFIG_CHANGE)
{
if (sub_code == BGP_NOTIFY_CEASE_ADMIN_RESET)
- {
peer->last_reset = PEER_DOWN_USER_RESET;
- zlog_info ("Notification sent to neighbor %s: User reset", peer->host);
- }
else if (sub_code == BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN)
- {
peer->last_reset = PEER_DOWN_USER_SHUTDOWN;
- zlog_info ("Notification sent to neighbor %s: shutdown", peer->host);
- }
else
- {
peer->last_reset = PEER_DOWN_NOTIFY_SEND;
- zlog_info ("Notification sent to neighbor %s: type %u/%u",
- peer->host, code, sub_code);
- }
}
- else
- zlog_info ("Notification sent to neighbor %s:%d: configuration change",
- peer->host, peer->fd);
/* Call immediately. */
BGP_WRITE_OFF (peer->t_write);
{
UNSET_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND);
stream_putc (s, ORF_COMMON_PART_REMOVE_ALL);
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s sending REFRESH_REQ to remove ORF(%d) (%s) for afi/safi: %d/%d",
peer->host, orf_type,
(when_to_refresh == REFRESH_DEFER ? "defer" : "immediate"),
prefix_bgp_orf_entry (s, filter->plist[FILTER_IN].plist,
ORF_COMMON_PART_ADD, ORF_COMMON_PART_PERMIT,
ORF_COMMON_PART_DENY);
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s sending REFRESH_REQ with pfxlist ORF(%d) (%s) for afi/safi: %d/%d",
peer->host, orf_type,
(when_to_refresh == REFRESH_DEFER ? "defer" : "immediate"),
/* Set packet size. */
length = bgp_packet_set_size (s);
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
{
if (! orf_refresh)
zlog_debug ("%s sending REFRESH_REQ for afi/safi: %d/%d",
peer->host, afi, safi);
- zlog_debug ("%s send message type %d, length (incl. header) %d",
- peer->host, CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_NEW_RCV) ?
- BGP_MSG_ROUTE_REFRESH_NEW : BGP_MSG_ROUTE_REFRESH_OLD, length);
}
/* Make real packet. */
stream_putc (s, 0);
stream_putc (s, safi);
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s sending CAPABILITY has %s MP_EXT CAP for afi/safi: %d/%d",
peer->host, action == CAPABILITY_ACTION_SET ?
"Advertising" : "Removing", afi, safi);
/* Add packet to the peer. */
bgp_packet_add (peer, packet);
- if (BGP_DEBUG (normal, NORMAL))
- zlog_debug ("%s send message type %d, length (incl. header) %d",
- peer->host, BGP_MSG_CAPABILITY, length);
-
BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd);
}
remote_id.s_addr = stream_get_ipv4 (peer->ibuf);
/* Receive OPEN message log */
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s rcv OPEN, version %d, remote-as (in open) %u,"
" holdtime %d, id %s",
peer->host, version, remote_as, holdtime,
|| IPV4_CLASS_DE (ntohl (remote_id.s_addr))
|| ntohl (peer->local_id.s_addr) == ntohl (remote_id.s_addr))
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s bad OPEN, wrong router identifier %s",
peer->host, inet_ntoa (remote_id));
bgp_notify_send_with_data (peer,
{
u_int16_t maxver = htons(BGP_VERSION_4);
/* XXX this reply may not be correct if version < 4 XXX */
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s bad protocol version, remote requested %d, local request %d",
peer->host, version, BGP_VERSION_4);
/* Data must be in network byte order here */
/* Check neighbor as number. */
if (remote_as != peer->as)
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s bad OPEN, remote AS is %u, expected %u",
peer->host, remote_as, peer->as);
bgp_notify_send_with_data (peer,
}
else
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s rcvd OPEN w/ OPTION parameter len: 0",
peer->host);
}
struct listnode *node, *nnode;
struct peer *peer;
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("Checking update delay, T: %d R: %d I:%d E: %d", bgp->established,
bgp->restarted_peers, bgp->implicit_eors, bgp->explicit_eors);
&& !CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)
&& !peer->update_delay_over)
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug (" Peer %s pending, continuing read-only mode",
peer->host);
return;
if (!bgp_update_delay_active(peer->bgp)) return; /* BGP update delay has ended */
if (peer->update_delay_over) return; /* This peer has already been considered */
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("Peer %s: Checking restarted", peer->host);
if (peer->status == Established)
if (!bgp_update_delay_active(peer->bgp)) return; /* BGP update delay has ended */
if (peer->update_delay_over) return; /* This peer has already been considered */
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("Peer %s: Checking implicit EORs", peer->host);
if (peer->status == Established)
if (!bgp_update_delay_active(peer->bgp)) return; /* BGP update delay has ended */
if (peer->update_delay_over) return; /* This peer has already been considered */
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("Peer %s: Checking explicit EORs", peer->host);
for (afi = AFI_IP; afi < AFI_MAX; afi++)
if (peer->afc_nego[afi][safi] &&
!CHECK_FLAG(peer->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug (" afi %d safi %d didnt receive EOR", afi, safi);
return;
}
memset (&mp_withdraw, 0, sizeof (struct bgp_nlri));
attr.extra = &extra;
num_pfx_adv = num_pfx_wd = 0;
+ memset (peer->rcvd_attr_str, 0, BUFSIZ);
+ peer->rcvd_attr_printed = 0;
s = peer->ibuf;
end = stream_pnt (s) + size;
if (ret < 0)
return -1;
- if (BGP_DEBUG (packet, PACKET_RECV))
- zlog_debug ("%s [Update:RECV] Unfeasible NLRI received", peer->host);
+ zlog_err ("%s [Update:RECV] Unfeasible NLRI received", peer->host);
withdraw.afi = AFI_IP;
withdraw.safi = SAFI_UNICAST;
}
/* Logging the attribute. */
- if (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW
- || BGP_DEBUG (update, UPDATE_IN))
+ if (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW ||
+ BGP_DEBUG (update, UPDATE_IN) ||
+ BGP_DEBUG (update, UPDATE_PREFIX))
{
- char attrstr[BUFSIZ];
- attrstr[0] = '\0';
-
- ret= bgp_dump_attr (peer, &attr, attrstr, BUFSIZ);
- int lvl = (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW)
- ? LOG_ERR : LOG_DEBUG;
+ ret = bgp_dump_attr (peer, &attr, peer->rcvd_attr_str, BUFSIZ);
if (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW)
- zlog (peer->log, LOG_ERR,
- "%s rcvd UPDATE with errors in attr(s)!! Withdrawing route.",
- peer->host);
+ zlog_err ("%s rcvd UPDATE with errors in attr(s)!! Withdrawing route.",
+ peer->host);
- if (ret)
- zlog (peer->log, lvl, "%s rcvd UPDATE w/ attr: %s",
- peer->host, attrstr);
+ if (ret && bgp_debug_update(peer, NULL, 1))
+ {
+ zlog_debug ("%s rcvd UPDATE w/ attr: %s", peer->host, peer->rcvd_attr_str);
+ peer->rcvd_attr_printed = 1;
+ }
}
/* Network Layer Reachability Information. */
}
if (BGP_DEBUG (update, UPDATE_IN))
- zlog(peer->log, LOG_DEBUG,
- "%s rcvd UPDATE wlen %d wpfx %d attrlen %d alen %d apfx %d",
- peer->host, withdraw_len, num_pfx_wd, attribute_len,
- update_len, num_pfx_adv);
+ zlog_debug("%s rcvd UPDATE wlen %d wpfx %d attrlen %d alen %d apfx %d",
+ peer->host, withdraw_len, num_pfx_wd, attribute_len,
+ update_len, num_pfx_adv);
/* NLRI is processed only when the peer is configured specific
Address Family and Subsequent Address Family. */
if (peer->nsf[AFI_IP][SAFI_UNICAST])
bgp_clear_stale_route (peer, AFI_IP, SAFI_UNICAST);
- if (BGP_DEBUG (normal, NORMAL))
- zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv4 Unicast from %s",
- peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("rcvd End-of-RIB for IPv4 Unicast from %s", peer->host);
}
}
if (peer->afc[AFI_IP][SAFI_MULTICAST])
if (peer->nsf[AFI_IP][SAFI_MULTICAST])
bgp_clear_stale_route (peer, AFI_IP, SAFI_MULTICAST);
- if (BGP_DEBUG (normal, NORMAL))
- zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv4 Multicast from %s",
- peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("rcvd End-of-RIB for IPv4 Multicast from %s", peer->host);
}
}
if (peer->afc[AFI_IP6][SAFI_UNICAST])
if (peer->nsf[AFI_IP6][SAFI_UNICAST])
bgp_clear_stale_route (peer, AFI_IP6, SAFI_UNICAST);
- if (BGP_DEBUG (normal, NORMAL))
- zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv6 Unicast from %s",
- peer->host);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("rcvd End-of-RIB for IPv6 Unicast from %s", peer->host);
}
}
if (peer->afc[AFI_IP6][SAFI_MULTICAST])
if (peer->nsf[AFI_IP6][SAFI_MULTICAST])
bgp_clear_stale_route (peer, AFI_IP6, SAFI_MULTICAST);
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv6 Multicast from %s",
- peer->host);
+ if (bgp_debug_update(peer, NULL, 1))
+ zlog_debug ("rcvd End-of-RIB for IPv6 Multicast from %s", peer->host);
}
}
if (peer->afc[AFI_IP][SAFI_MPLS_VPN])
&& mp_withdraw.safi == SAFI_MPLS_LABELED_VPN
&& mp_withdraw.length == 0)
{
- /* End-of-RIB received */
- if (!CHECK_FLAG (peer->af_sflags[AFI_IP][SAFI_MPLS_VPN],
+
+ /* End-of-RIB received */
+ if (!CHECK_FLAG (peer->af_sflags[AFI_IP][SAFI_MPLS_VPN],
PEER_STATUS_EOR_RECEIVED))
- {
+ {
SET_FLAG (peer->af_sflags[AFI_IP][SAFI_MPLS_VPN], PEER_STATUS_EOR_RECEIVED);
- bgp_update_explicit_eors(peer);
- }
+ bgp_update_explicit_eors(peer);
+ }
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for VPNv4 Unicast from %s",
- peer->host);
+ if (bgp_debug_update(peer, NULL, 1))
+ zlog_debug ("rcvd End-of-RIB for VPNv4 Unicast from %s", peer->host);
}
}
static void
bgp_keepalive_receive (struct peer *peer, bgp_size_t size)
{
- if (BGP_DEBUG (keepalive, KEEPALIVE))
+ if (bgp_debug_keepalive(peer))
zlog_debug ("%s KEEPALIVE rcvd", peer->host);
BGP_EVENT_ADD (peer, Receive_KEEPALIVE_message);
/* If peer does not have the capability, send notification. */
if (! CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_ADV))
{
- plog_err (peer->log, "%s [Error] BGP route refresh is not enabled",
+ zlog_err ("%s [Error] BGP route refresh is not enabled",
peer->host);
bgp_notify_send (peer,
BGP_NOTIFY_HEADER_ERR,
/* Status must be Established. */
if (peer->status != Established)
{
- plog_err (peer->log,
- "%s [Error] Route refresh packet received under status %s",
+ zlog_err ("%s [Error] Route refresh packet received under status %s",
peer->host, LOOKUP (bgp_status_msg, peer->status));
bgp_notify_send (peer, BGP_NOTIFY_FSM_ERR, 0);
return;
reserved = stream_getc (s);
safi = stream_getc (s);
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_update(peer, NULL, 0))
zlog_debug ("%s rcvd REFRESH_REQ for afi/safi: %d/%d",
peer->host, afi, safi);
|| (safi != SAFI_UNICAST && safi != SAFI_MULTICAST
&& safi != SAFI_MPLS_LABELED_VPN))
{
- if (BGP_DEBUG (normal, NORMAL))
- {
- zlog_debug ("%s REFRESH_REQ for unrecognized afi/safi: %d/%d - ignored",
- peer->host, afi, safi);
- }
+ zlog_info ("%s REFRESH_REQ for unrecognized afi/safi: %d/%d - ignored",
+ peer->host, afi, safi);
return;
}
char name[BUFSIZ];
int ret;
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
{
zlog_debug ("%s rcvd Prefixlist ORF(%d) length %d",
peer->host, orf_type, orf_len);
/* after ++: p_pnt <= p_end */
if (common & ORF_COMMON_PART_REMOVE_ALL)
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s rcvd Remove-All pfxlist ORF request", peer->host);
prefix_bgp_orf_remove_all (name);
break;
memcpy (&orfp.p.u.prefix, p_pnt, psize);
p_pnt += psize;
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
{
char buf[INET6_BUFSIZ];
if (!ok || (ret != CMD_SUCCESS))
{
- if (BGP_DEBUG (normal, NORMAL))
- zlog_debug ("%s Received misformatted prefixlist ORF."
- " Remove All pfxlist", peer->host);
+ zlog_info ("%s Received misformatted prefixlist ORF."
+ " Remove All pfxlist", peer->host);
prefix_bgp_orf_remove_all (name);
break;
}
}
stream_forward_getp (s, orf_len);
}
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s rcvd Refresh %s ORF request", peer->host,
when_to_refresh == REFRESH_DEFER ? "Defer" : "Immediate");
if (when_to_refresh == REFRESH_DEFER)
return -1;
}
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s CAPABILITY has action: %d, code: %u, length %u",
peer->host, action, hdr->code, hdr->length);
if (!bgp_afi_safi_valid_indices (afi, &safi))
{
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Dynamic Capability MP_EXT afi/safi invalid "
"(%u/%u)", peer->host, afi, safi);
continue;
}
/* Address family check. */
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s CAPABILITY has %s MP_EXT CAP for afi/safi: %u/%u",
peer->host,
action == CAPABILITY_ACTION_SET
/* Fetch pointer. */
pnt = stream_pnt (peer->ibuf);
- if (BGP_DEBUG (normal, NORMAL))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s rcv CAPABILITY", peer->host);
/* If peer does not have the capability, send notification. */
if (! CHECK_FLAG (peer->cap, PEER_CAP_DYNAMIC_ADV))
{
- plog_err (peer->log, "%s [Error] BGP dynamic capability is not enabled",
+ zlog_err ("%s [Error] BGP dynamic capability is not enabled",
peer->host);
bgp_notify_send (peer,
BGP_NOTIFY_HEADER_ERR,
/* Status must be Established. */
if (peer->status != Established)
{
- plog_err (peer->log,
- "%s [Error] Dynamic capability packet received under status %s", peer->host, LOOKUP (bgp_status_msg, peer->status));
+ zlog_err ("%s [Error] Dynamic capability packet received under status %s",
+ peer->host, LOOKUP (bgp_status_msg, peer->status));
bgp_notify_send (peer, BGP_NOTIFY_FSM_ERR, 0);
return -1;
}
if (nbytes == -2)
return -1;
- plog_err (peer->log, "%s [Error] bgp_read_packet error: %s",
- peer->host, safe_strerror (errno));
+ zlog_err ("%s [Error] bgp_read_packet error: %s",
+ peer->host, safe_strerror (errno));
if (peer->status == Established)
{
/* When read byte is zero : clear bgp peer and return */
if (nbytes == 0)
{
- if (BGP_DEBUG (events, EVENTS))
- plog_debug (peer->log, "%s [Event] BGP connection closed fd %d",
- peer->host, peer->fd);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s [Event] BGP connection closed fd %d",
+ peer->host, peer->fd);
if (peer->status == Established)
{
size = stream_getw (peer->ibuf);
type = stream_getc (peer->ibuf);
- if (BGP_DEBUG (normal, NORMAL) && type != 2 && type != 0)
- zlog_debug ("%s rcv message type %d, length (excl. header) %d",
- peer->host, type, size - BGP_HEADER_SIZE);
-
/* Marker check */
if (((type == BGP_MSG_OPEN) || (type == BGP_MSG_KEEPALIVE))
&& ! bgp_marker_all_one (peer->ibuf, BGP_MARKER_SIZE))
&& type != BGP_MSG_ROUTE_REFRESH_OLD
&& type != BGP_MSG_CAPABILITY)
{
- if (BGP_DEBUG (normal, NORMAL))
- plog_debug (peer->log,
- "%s unknown message type 0x%02x",
- peer->host, type);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s unknown message type 0x%02x",
+ peer->host, type);
bgp_notify_send_with_data (peer,
BGP_NOTIFY_HEADER_ERR,
BGP_NOTIFY_HEADER_BAD_MESTYPE,
|| (type == BGP_MSG_ROUTE_REFRESH_OLD && size < BGP_MSG_ROUTE_REFRESH_MIN_SIZE)
|| (type == BGP_MSG_CAPABILITY && size < BGP_MSG_CAPABILITY_MIN_SIZE))
{
- if (BGP_DEBUG (normal, NORMAL))
- plog_debug (peer->log,
- "%s bad message length - %d for %s",
- peer->host, size,
- type == 128 ? "ROUTE-REFRESH" :
- bgp_type_str[(int) type]);
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug ("%s bad message length - %d for %s",
+ peer->host, size,
+ type == 128 ? "ROUTE-REFRESH" :
+ bgp_type_str[(int) type]);
bgp_notify_send_with_data (peer,
BGP_NOTIFY_HEADER_ERR,
BGP_NOTIFY_HEADER_BAD_MESLEN,
#define FILTER_EXIST_WARN(F,f,filter) \
if (BGP_DEBUG (update, UPDATE_IN) \
&& !(F ## _IN (filter))) \
- plog_warn (peer->log, "%s: Could not find configured input %s-list %s!", \
+ zlog_warn ("%s: Could not find configured input %s-list %s!", \
peer->host, #f, F ## _IN_NAME(filter));
if (DISTRIBUTE_IN_NAME (filter)) {
#define FILTER_EXIST_WARN(F,f,filter) \
if (BGP_DEBUG (update, UPDATE_OUT) \
&& !(F ## _OUT (filter))) \
- plog_warn (peer->log, "%s: Could not find configured output %s-list %s!", \
+ zlog_warn ("%s: Could not find configured output %s-list %s!", \
peer->host, #f, F ## _OUT_NAME(filter));
if (DISTRIBUTE_OUT_NAME (filter)) {
{
if (IPV4_ADDR_SAME (&peer->remote_id, &riattr->extra->originator_id))
{
- if (BGP_DEBUG (filter, FILTER))
- zlog (peer->log, LOG_DEBUG,
- "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (bgp_debug_update(peer, p, 0))
+ zlog_debug("%s [Update:SEND] %s/%d originator-id is same as remote router-id",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
return 0;
}
}
/* Output filter check. */
if (bgp_output_filter (peer, p, riattr, afi, safi) == FILTER_DENY)
{
- if (BGP_DEBUG (filter, FILTER))
- zlog (peer->log, LOG_DEBUG,
- "%s [Update:SEND] %s/%d is filtered",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (bgp_debug_update(peer, p, 0))
+ zlog_debug("%s [Update:SEND] %s/%d is filtered",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
return 0;
}
/* AS path loop check. */
if (aspath_loop_check (riattr->aspath, peer->as))
{
- if (BGP_DEBUG (filter, FILTER))
- zlog (peer->log, LOG_DEBUG,
- "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
- peer->host, peer->as);
+ if (bgp_debug_update(peer, p, 0))
+ zlog_debug("%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
+ peer->host, peer->as);
return 0;
}
#endif /* BGP_SEND_ASPATH_CHECK */
{
if (aspath_loop_check(riattr->aspath, bgp->confed_id))
{
- if (BGP_DEBUG (filter, FILTER))
- zlog (peer->log, LOG_DEBUG,
- "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
- peer->host,
- bgp->confed_id);
+ if (bgp_debug_update(peer, p, 0))
+ zlog_debug("%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
+ peer->host,
+ bgp->confed_id);
return 0;
}
}
if (IPV4_ADDR_SAME (&rsclient->remote_id,
&riattr->extra->originator_id))
{
- if (BGP_DEBUG (filter, FILTER))
- zlog (rsclient->log, LOG_DEBUG,
- "%s [Update:SEND] %s/%d originator-id is same as remote router-id",
- rsclient->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (bgp_debug_update(rsclient, p, 0))
+ zlog_debug ("%s [Update:SEND] %s/%d originator-id is same as remote router-id",
+ rsclient->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
return 0;
}
}
/* Output filter check. */
if (bgp_output_filter (rsclient, p, riattr, afi, safi) == FILTER_DENY)
{
- if (BGP_DEBUG (filter, FILTER))
- zlog (rsclient->log, LOG_DEBUG,
- "%s [Update:SEND] %s/%d is filtered",
- rsclient->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (bgp_debug_update(rsclient, p, 0))
+ zlog_debug ("%s [Update:SEND] %s/%d is filtered",
+ rsclient->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
return 0;
}
/* AS path loop check. */
if (aspath_loop_check (riattr->aspath, rsclient->as))
{
- if (BGP_DEBUG (filter, FILTER))
- zlog (rsclient->log, LOG_DEBUG,
- "%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
- rsclient->host, rsclient->as);
+ if (bgp_debug_update(rsclient, p, 0))
+ zlog_debug ("%s [Update:SEND] suppress announcement to peer AS %u is AS path.",
+ rsclient->host, rsclient->as);
return 0;
}
#endif /* BGP_SEND_ASPATH_CHECK */
peer = THREAD_ARG (thread);
peer->t_pmax_restart = NULL;
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Maximum-prefix restart timer expired, restore peering",
peer->host);
&& ! always)
return 0;
- zlog (peer->log, LOG_INFO,
- "%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, "
- "limit %ld", afi_safi_print (afi, safi), peer->host,
- peer->pcount[afi][safi], peer->pmax[afi][safi]);
+ zlog_info ("%%MAXPFXEXCEED: No. of %s prefix received from %s %ld exceed, "
+ "limit %ld", afi_safi_print (afi, safi), peer->host,
+ peer->pcount[afi][safi], peer->pmax[afi][safi]);
SET_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_PREFIX_LIMIT);
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
{
peer->v_pmax_restart = peer->pmax_restart[afi][safi] * 60;
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Maximum-prefix restart timer started for %d secs",
peer->host, peer->v_pmax_restart);
&& ! always)
return 0;
- zlog (peer->log, LOG_INFO,
- "%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
- afi_safi_print (afi, safi), peer->host, peer->pcount[afi][safi],
- peer->pmax[afi][safi]);
+ zlog_info ("%%MAXPFX: No. of %s prefix received from %s reaches %ld, max %ld",
+ afi_safi_print (afi, safi), peer->host, peer->pcount[afi][safi],
+ peer->pmax[afi][safi]);
SET_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_PREFIX_THRESHOLD);
}
else
bgp_info_unset_flag (rn, ri, BGP_INFO_ATTR_CHANGED);
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG,
- "%s rcvd %s/%d for RS-client %s...duplicate ignored",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen, rsclient->host);
+ if (bgp_debug_update(peer, p, 1))
+ zlog_debug ("%s rcvd %s/%d for RS-client %s...duplicate ignored",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen, rsclient->host);
+
bgp_unlock_node (rn);
bgp_attr_unintern (&attr_new);
bgp_info_restore (rn, ri);
/* Received Logging. */
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d for RS-client %s",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen, rsclient->host);
+ if (bgp_debug_update(peer, p, 1))
+ zlog_debug ("%s rcvd %s/%d for RS-client %s",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen, rsclient->host);
/* The attribute is changed. */
bgp_info_set_flag (rn, ri, BGP_INFO_ATTR_CHANGED);
}
/* Received Logging. */
- if (BGP_DEBUG (update, UPDATE_IN))
+ if (bgp_debug_update(peer, p, 1))
{
- zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d for RS-client %s",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen, rsclient->host);
+ zlog_debug ("%s rcvd %s/%d for RS-client %s",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen, rsclient->host);
}
new = info_make(type, sub_type, peer, attr_new, rn);
filtered:
/* This BGP update is filtered. Log the reason then update BGP entry. */
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG,
- "%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s",
- peer->host,
- inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen, rsclient->host, reason);
+ if (bgp_debug_update(peer, p, 1))
+ zlog_debug ("%s rcvd UPDATE about %s/%d -- DENIED for RS-client %s due to: %s",
+ peer->host,
+ inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen, rsclient->host, reason);
if (ri)
bgp_rib_remove (rn, ri, peer, afi, safi);
/* Withdraw specified route from routing table. */
if (ri && ! CHECK_FLAG (ri->flags, BGP_INFO_HISTORY))
bgp_rib_withdraw (rn, ri, peer, afi, safi);
- else if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG,
- "%s Can't find the route %s/%d", peer->host,
- inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ else if (bgp_debug_update(peer, p, 1))
+ zlog_debug ("%s Can't find the route %s/%d", peer->host,
+ inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
/* Unlock bgp_node_get() lock. */
bgp_unlock_node (rn);
&& peer->sort == BGP_PEER_EBGP
&& CHECK_FLAG (ri->flags, BGP_INFO_HISTORY))
{
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (bgp_debug_update(peer, p, 1))
+ zlog_debug ("%s rcvd %s/%d",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
if (bgp_damp_update (ri, rn, afi, safi) != BGP_DAMP_SUPPRESSED)
{
}
else /* Duplicate - odd */
{
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG,
- "%s rcvd %s/%d...duplicate ignored",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (bgp_debug_update(peer, p, 1))
+ {
+ if (!peer->rcvd_attr_printed)
+ {
+ zlog_debug ("%s rcvd UPDATE w/ attr: %s", peer->host, peer->rcvd_attr_str);
+ peer->rcvd_attr_printed = 1;
+ }
+
+ zlog_debug ("%s rcvd %s/%d...duplicate ignored",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
+ }
/* graceful restart STALE flag unset. */
if (CHECK_FLAG (ri->flags, BGP_INFO_STALE))
/* Withdraw/Announce before we fully processed the withdraw */
if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED))
{
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d, flapped quicker than processing",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (bgp_debug_update(peer, p, 1))
+ zlog_debug ("%s rcvd %s/%d, flapped quicker than processing",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
bgp_info_restore (rn, ri);
}
/* Received Logging. */
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (bgp_debug_update(peer, p, 1))
+ zlog_debug ("%s rcvd %s/%d",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
/* graceful restart STALE flag unset. */
if (CHECK_FLAG (ri->flags, BGP_INFO_STALE))
}
/* Received Logging. */
- if (BGP_DEBUG (update, UPDATE_IN))
+ if (bgp_debug_update(peer, p, 1))
{
- zlog (peer->log, LOG_DEBUG, "%s rcvd %s/%d",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (!peer->rcvd_attr_printed)
+ {
+ zlog_debug ("%s rcvd UPDATE w/ attr: %s", peer->host, peer->rcvd_attr_str);
+ peer->rcvd_attr_printed = 1;
+ }
+
+ zlog_debug ("%s rcvd %s/%d",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
}
/* Make new BGP info. */
/* This BGP update is filtered. Log the reason then update BGP
entry. */
filtered:
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG,
- "%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
- peer->host,
- inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen, reason);
+ if (bgp_debug_update(peer, p, 1))
+ {
+ if (!peer->rcvd_attr_printed)
+ {
+ zlog_debug ("%s rcvd UPDATE w/ attr: %s", peer->host, peer->rcvd_attr_str);
+ peer->rcvd_attr_printed = 1;
+ }
+
+ zlog_debug ("%s rcvd UPDATE about %s/%d -- DENIED due to: %s",
+ peer->host,
+ inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen, reason);
+ }
if (ri)
bgp_rib_remove (rn, ri, peer, afi, safi);
}
/* Logging. */
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG, "%s rcvd UPDATE about %s/%d -- withdrawn",
- peer->host,
- inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ if (bgp_debug_update(peer, p, 1))
+ zlog_debug ("%s rcvd UPDATE about %s/%d -- withdrawn",
+ peer->host,
+ inet_ntop(p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
/* Lookup node. */
rn = bgp_afi_node_get (bgp->rib[afi][safi], afi, safi, p, prd);
/* Withdraw specified route from routing table. */
if (ri && ! CHECK_FLAG (ri->flags, BGP_INFO_HISTORY))
bgp_rib_withdraw (rn, ri, peer, afi, safi);
- else if (BGP_DEBUG (update, UPDATE_IN))
- zlog (peer->log, LOG_DEBUG,
- "%s Can't find the route %s/%d", peer->host,
- inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen);
+ else if (bgp_debug_update(peer, p, 1))
+ zlog_debug ("%s Can't find the route %s/%d", peer->host,
+ inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen);
/* Unlock bgp_node_get() lock. */
bgp_unlock_node (rn);
* semantically incorrect (eg. an unexpected multicast IP
* address), it should ignore the prefix.
*/
- zlog (peer->log, LOG_ERR,
- "IPv4 unicast NLRI is multicast address %s",
- inet_ntoa (p.u.prefix4));
+ zlog_err ("IPv4 unicast NLRI is multicast address %s",
+ inet_ntoa (p.u.prefix4));
return -1;
}
{
char buf[BUFSIZ];
- zlog (peer->log, LOG_WARNING,
- "IPv6 link-local NLRI received %s ignore this NLRI",
- inet_ntop (AF_INET6, &p.u.prefix6, buf, BUFSIZ));
+ zlog_warn ("IPv6 link-local NLRI received %s ignore this NLRI",
+ inet_ntop (AF_INET6, &p.u.prefix6, buf, BUFSIZ));
continue;
}
if ((afi == AFI_IP && prefixlen > 32)
|| (afi == AFI_IP6 && prefixlen > 128))
{
- plog_err (peer->log,
- "%s [Error] Update packet error (wrong prefix length %d)",
+ zlog_err ("%s [Error] Update packet error (wrong prefix length %d)",
peer->host, prefixlen);
bgp_notify_send (peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_INVAL_NETWORK);
if (pnt + psize > end)
{
- plog_err (peer->log,
- "%s [Error] Update packet error"
+ zlog_err ("%s [Error] Update packet error"
" (prefix data overflow prefix size is %d)",
peer->host, psize);
bgp_notify_send (peer, BGP_NOTIFY_UPDATE_ERR,
/* Packet length consistency check. */
if (pnt != end)
{
- plog_err (peer->log,
- "%s [Error] Update packet error"
+ zlog_err ("%s [Error] Update packet error"
" (prefix length mismatch with total length)",
peer->host);
bgp_notify_send (peer, BGP_NOTIFY_UPDATE_ERR,
== RMAP_DENY)
{
/* This BGP update is filtered. Log the reason then update BGP entry. */
- if (BGP_DEBUG (update, UPDATE_IN))
- zlog (rsclient->log, LOG_DEBUG,
- "Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy",
- inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
- p->prefixlen, rsclient->host);
+ if (bgp_debug_update(rsclient, p, 1))
+ zlog_debug ("Static UPDATE about %s/%d -- DENIED for RS-client %s due to: import-policy",
+ inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
+ p->prefixlen, rsclient->host);
bgp->peer_self->rmap_type = 0;
{
pc->count[PCOUNT_COUNTED]++;
if (CHECK_FLAG (ri->flags, BGP_INFO_UNUSEABLE))
- plog_warn (peer->log,
- "%s [pcount] %s/%d is counted but flags 0x%x",
+ zlog_warn ("%s [pcount] %s/%d is counted but flags 0x%x",
peer->host,
inet_ntop(rn->p.family, &rn->p.u.prefix,
buf, SU_ADDRSTRLEN),
else
{
if (!CHECK_FLAG (ri->flags, BGP_INFO_UNUSEABLE))
- plog_warn (peer->log,
- "%s [pcount] %s/%d not counted but flags 0x%x",
+ zlog_warn ("%s [pcount] %s/%d not counted but flags 0x%x",
peer->host,
inet_ntop(rn->p.family, &rn->p.u.prefix,
buf, SU_ADDRSTRLEN),
if (CHECK_FLAG (peer->af_flags[afi][safi],
PEER_FLAG_SOFT_RECONFIG))
{
- if (BGP_DEBUG(events, EVENTS))
+ if (bgp_debug_update(peer, NULL, 1))
zlog_debug("Processing route_map %s update on "
"peer %s (inbound, soft-reconfig)",
rmap_name, peer->host);
|| CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_NEW_RCV))
{
- if (BGP_DEBUG(events, EVENTS))
+ if (bgp_debug_update(peer, NULL, 1))
zlog_debug("Processing route_map %s update on "
"peer %s (inbound, route-refresh)",
rmap_name, peer->host);
if (CHECK_FLAG (peer->af_flags[afi][safi],
PEER_FLAG_SOFT_RECONFIG))
{
- if (BGP_DEBUG(events, EVENTS))
+ if (bgp_debug_update(peer, NULL, 1))
zlog_debug("Processing route_map %s update on "
"peer %s (import, soft-reconfig)",
rmap_name, peer->host);
else if (CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_OLD_RCV)
|| CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_NEW_RCV))
{
- if (BGP_DEBUG(events, EVENTS))
+ if (bgp_debug_update(peer, NULL, 1))
zlog_debug("Processing route_map %s update on "
"peer %s (import, route-refresh)",
rmap_name, peer->host);
filter->map[RMAP_OUT].map =
route_map_lookup_by_name (filter->map[RMAP_OUT].name);
- if (BGP_DEBUG(events, EVENTS))
+ if (bgp_debug_update(peer, NULL, 0))
zlog_debug("Processing route_map %s update on peer %s (outbound)",
rmap_name, peer->host);
peer->default_rmap[afi][safi].map =
route_map_lookup_by_name (peer->default_rmap[afi][safi].name);
- if (BGP_DEBUG(events, EVENTS))
+ if (bgp_debug_update(peer, NULL, 0))
zlog_debug("Processing route_map %s update on "
"default-originate", rmap_name);
{
bgp->table_map[afi][safi].map =
route_map_lookup_by_name (bgp->table_map[afi][safi].name);
- if (BGP_DEBUG(events, EVENTS))
+ if (BGP_DEBUG (zebra, ZEBRA))
zlog_debug("Processing route_map %s update on "
"table map", rmap_name);
if (route_update)
if (route_update)
if (!bgp_static->backdoor)
{
- if (BGP_DEBUG(events, EVENTS))
+ if (bgp_debug_zebra(&bn->p))
zlog_debug("Processing route_map %s update on "
"static route %s", rmap_name,
inet_ntop (bn->p.family, &bn->p.u.prefix,
if (bgp->redist[afi][i] && route_update)
{
- if (BGP_DEBUG(events, EVENTS))
+ if (BGP_DEBUG (zebra, ZEBRA))
zlog_debug("Processing route_map %s update on "
"redistributed routes", rmap_name);
bgp->t_rmap_update = NULL;
- if (BGP_DEBUG(events, EVENTS))
- zlog_debug("Started processing route map update");
-
route_map_walk_update_list((void *)bgp, bgp_route_map_process_update_cb);
- if (BGP_DEBUG(events, EVENTS))
- zlog_debug("Finished processing route map update");
-
return (0);
}
{
if (bgp->t_rmap_update == NULL)
{
- if (BGP_DEBUG(events, EVENTS))
- zlog_debug("Starting route map update timer (in %d secs)",
- bgp->rmap_update_timer);
/* rmap_update_timer of 0 means don't do route updates */
if (bgp->rmap_update_timer)
bgp->t_rmap_update =
static void
bgp_route_map_add (const char *rmap_name)
{
- if (BGP_DEBUG (events, EVENTS))
- zlog_debug ("received route-map add of %s", rmap_name);
-
if (route_map_mark_updated(rmap_name, 0) == 0)
bgp_route_map_mark_update(rmap_name);
static void
bgp_route_map_delete (const char *rmap_name)
{
- if (BGP_DEBUG (events, EVENTS))
- zlog_debug ("received route-map delete of %s", rmap_name);
-
if (route_map_mark_updated(rmap_name, 1) == 0)
bgp_route_map_mark_update(rmap_name);
static void
bgp_route_map_event (route_map_event_t event, const char *rmap_name)
{
- if (BGP_DEBUG (events, EVENTS))
- zlog_debug ("received route-map event for %s", rmap_name);
-
if (route_map_mark_updated(rmap_name, 0) == 0)
bgp_route_map_mark_update(rmap_name);
filter = &peer->filter[afi][safi];
if (ROUTE_MAP_OUT_NAME(filter))
{
- if (BGP_DEBUG(update, UPDATE_OUT))
+ if (bgp_debug_update(peer, NULL, 0))
zlog_debug("%s: Announcing routes again for peer %s"
"(afi=%d, safi=%d", __func__, peer->host, afi,
safi);
zebra_router_id_update_read(zclient->ibuf,&router_id);
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (BGP_DEBUG (zebra, ZEBRA))
{
char buf[128];
prefix2str(&router_id, buf, sizeof(buf));
ifp = zebra_interface_add_read (zclient->ibuf);
- if (BGP_DEBUG(zebra, ZEBRA) && ifp)
+ if (BGP_DEBUG (zebra, ZEBRA) && ifp)
zlog_debug("Zebra rcvd: interface add %s", ifp->name);
return 0;
ifp = zebra_interface_state_read (s);
ifp->ifindex = IFINDEX_INTERNAL;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (BGP_DEBUG (zebra, ZEBRA))
zlog_debug("Zebra rcvd: interface delete %s", ifp->name);
return 0;
if (! ifp)
return 0;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (BGP_DEBUG (zebra, ZEBRA))
zlog_debug("Zebra rcvd: interface %s up", ifp->name);
for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, c))
if (! ifp)
return 0;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (BGP_DEBUG (zebra, ZEBRA))
zlog_debug("Zebra rcvd: interface %s down", ifp->name);
for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, c))
if (ifp == NULL)
return 0;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (BGP_DEBUG (zebra, ZEBRA))
{
char buf[128];
prefix2str(&p, buf, sizeof(buf));
if (ifc == NULL)
return 0;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(ifc->address))
{
char buf[128];
prefix2str(ifc->address, buf, sizeof(buf));
if (ifc == NULL)
return 0;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(ifc->address))
{
char buf[128];
prefix2str(ifc->address, buf, sizeof(buf));
if (ifc == NULL)
return 0;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(ifc->address))
{
char buf[128];
prefix2str(ifc->address, buf, sizeof(buf));
if (ifc == NULL)
return 0;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(ifc->address))
{
char buf[128];
prefix2str(ifc->address, buf, sizeof(buf));
if (command == ZEBRA_IPV4_ROUTE_ADD)
{
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(&p))
{
char buf[2][INET_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv4 route add %s %s/%d nexthop %s metric %u tag %d",
}
else
{
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(&p))
{
char buf[2][INET_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv4 route delete %s %s/%d "
if (command == ZEBRA_IPV6_ROUTE_ADD)
{
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(&p))
{
char buf[2][INET6_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv6 route add %s %s/%d nexthop %s metric %u tag %d",
}
else
{
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(&p))
{
char buf[2][INET6_ADDRSTRLEN];
zlog_debug("Zebra rcvd: IPv6 route delete %s %s/%d "
if (route_map_apply(map, p, RMAP_BGP, info) != RMAP_DENYMATCH)
return 1;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(p))
{
if (p->family == AF_INET)
{
api.distance = distance;
}
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(p))
{
int i;
zlog_debug("Zebra send: IPv4 route %s %s/%d metric %u tag %d"
api.tag = tag;
}
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(p))
{
int i;
zlog_debug("Zebra send: IPv6 route %s %s/%d metric %u tag %d",
api.tag = info->attr->extra->tag;
}
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(p))
{
char buf[2][INET_ADDRSTRLEN];
zlog_debug("Zebra send: IPv4 route delete %s/%d nexthop %s metric %u tag %d",
api.tag = info->attr->extra->tag;
}
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (bgp_debug_zebra(p))
{
char buf[2][INET6_ADDRSTRLEN];
zlog_debug("Zebra send: IPv6 route delete %s/%d nexthop %s metric %u tag %d",
if (zclient->sock < 0)
return CMD_WARNING;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (BGP_DEBUG (zebra, ZEBRA))
zlog_debug("Zebra send: redistribute add %s", zebra_route_string(type));
/* Send distribute add message to zebra. */
if (zclient->sock < 0)
return -1;
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (BGP_DEBUG (zebra, ZEBRA))
zlog_debug("Zebra send: redistribute add %s", zebra_route_string(type));
/* Send distribute add message to zebra. */
&& zclient->sock >= 0)
{
/* Send distribute delete message to zebra. */
- if (BGP_DEBUG(zebra, ZEBRA))
+ if (BGP_DEBUG (zebra, ZEBRA))
zlog_debug("Zebra send: redistribute delete %s",
zebra_route_string(type));
zebra_redistribute_send (ZEBRA_REDISTRIBUTE_DELETE, zclient, type);
}
/* Peer comparison function for sorting. */
-static int
+int
peer_cmp (struct peer *p1, struct peer *p2)
{
return sockunion_cmp (&p1->su, &p2->su);
if (peer->t_gr_restart)
{
BGP_TIMER_OFF (peer->t_gr_restart);
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s graceful restart timer stopped", peer->host);
}
if (peer->t_gr_stale)
{
BGP_TIMER_OFF (peer->t_gr_stale);
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s graceful restart stalepath timer stopped", peer->host);
}
bgp_clear_route_all (peer);
if (peer->t_pmax_restart)
{
BGP_TIMER_OFF (peer->t_pmax_restart);
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Maximum-prefix restart timer canceled",
peer->host);
}
}
else if (peer->status < Established)
{
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Min-ttl changed", peer->host);
bgp_session_reset(peer);
}
if (peer->t_pmax_restart)
{
BGP_TIMER_OFF (peer->t_pmax_restart);
- if (BGP_DEBUG (events, EVENTS))
+ if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s Maximum-prefix restart timer canceled",
peer->host);
}
char *ifname; /* bind interface name. */
char *update_if;
union sockunion *update_source;
- struct zlog *log;
union sockunion *su_local; /* Sockunion of local address. */
union sockunion *su_remote; /* Sockunion of remote address. */
/* ORF Prefix-list */
struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX];
+ /* Text description of last attribute rcvd */
+ char rcvd_attr_str[BUFSIZ];
+
+ /* Track if we printed the attribute in debugs */
+ int rcvd_attr_printed;
+
/* Prefix count. */
unsigned long pcount[AFI_MAX][SAFI_MAX];
extern int bgp_route_map_update_timer (struct thread *thread);
extern void bgp_route_map_terminate(void);
+
+extern int peer_cmp (struct peer *p1, struct peer *p2);
#endif /* _QUAGGA_BGPD_H */
DEFUN (show_debugging,
show_debugging_cmd,
- "show debugging",
+ "show debugging isis",
SHOW_STR
- "State of each debugging option\n")
+ "State of each debugging option\n"
+ ISIS_STR)
{
vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
print_debug (vty, isis->debugs, 1);
#undef ZLOG_FUNC
-#define PLOG_FUNC(FUNCNAME,PRIORITY) \
-void \
-FUNCNAME(struct zlog *zl, const char *format, ...) \
-{ \
- va_list args; \
- va_start(args, format); \
- vzlog (zl, PRIORITY, format, args); \
- va_end(args); \
-}
-
-PLOG_FUNC(plog_err, LOG_ERR)
-
-PLOG_FUNC(plog_warn, LOG_WARNING)
-
-PLOG_FUNC(plog_info, LOG_INFO)
-
-PLOG_FUNC(plog_notice, LOG_NOTICE)
-
-PLOG_FUNC(plog_debug, LOG_DEBUG)
-
-#undef PLOG_FUNC
-
void
_zlog_assert_failed (const char *assertion, const char *file,
unsigned int line, const char *function)
extern void zlog_notice (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
extern void zlog_debug (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
-/* For bgpd's peer oriented log. */
-extern void plog_err (struct zlog *, const char *format, ...)
- PRINTF_ATTRIBUTE(2, 3);
-extern void plog_warn (struct zlog *, const char *format, ...)
- PRINTF_ATTRIBUTE(2, 3);
-extern void plog_info (struct zlog *, const char *format, ...)
- PRINTF_ATTRIBUTE(2, 3);
-extern void plog_notice (struct zlog *, const char *format, ...)
- PRINTF_ATTRIBUTE(2, 3);
-extern void plog_debug (struct zlog *, const char *format, ...)
- PRINTF_ATTRIBUTE(2, 3);
-
/* Set logging level for the given destination. If the log_level
argument is ZLOG_DISABLED, then the destination is disabled.
This function should not be used for file logging (use zlog_set_file
{ MTYPE_TRANSIT, "BGP transit attr" },
{ MTYPE_TRANSIT_VAL, "BGP transit val" },
{ 0, NULL },
+ { MTYPE_BGP_DEBUG_FILTER, "BGP debug filter" },
+ { 0, NULL },
{ MTYPE_BGP_DISTANCE, "BGP distance" },
{ MTYPE_BGP_NEXTHOP_CACHE, "BGP nexthop" },
{ MTYPE_BGP_CONFED_LIST, "BGP confed list" },
struct peer *peer;
int i, j;
- conf_bgp_debug_fsm = -1UL;
- conf_bgp_debug_events = -1UL;
+ conf_bgp_debug_neighbor_events = -1UL;
conf_bgp_debug_packet = -1UL;
- conf_bgp_debug_normal = -1UL;
conf_bgp_debug_as4 = -1UL;
- term_bgp_debug_fsm = -1UL;
- term_bgp_debug_events = -1UL;
+ term_bgp_debug_neighbor_events = -1UL;
term_bgp_debug_packet = -1UL;
- term_bgp_debug_normal = -1UL;
term_bgp_debug_as4 = -1UL;
master = thread_master_create ();
struct peer *peer;
int i, j;
- conf_bgp_debug_fsm = -1UL;
- conf_bgp_debug_events = -1UL;
+ conf_bgp_debug_neighbor_events = -1UL;
conf_bgp_debug_packet = -1UL;
- conf_bgp_debug_normal = -1UL;
conf_bgp_debug_as4 = -1UL;
- term_bgp_debug_fsm = -1UL;
- term_bgp_debug_events = -1UL;
+ term_bgp_debug_neighbor_events = -1UL;
term_bgp_debug_packet = -1UL;
- term_bgp_debug_normal = -1UL;
term_bgp_debug_as4 = -1UL;
master = thread_master_create ();