diff options
author | paul <paul> | 2004-07-09 17:48:53 +0000 |
---|---|---|
committer | paul <paul> | 2004-07-09 17:48:53 +0000 |
commit | e01f9cbb87123217ac6d88c12ddb784fca9cc5b7 (patch) | |
tree | edf78b44ec8c5979afe0abdeefa8b33572e67ef7 /bgpd/bgp_debug.c | |
parent | b9790b34c825e390c818044f6666f73beee1d373 (diff) | |
download | quagga-e01f9cbb87123217ac6d88c12ddb784fca9cc5b7.tar.bz2 quagga-e01f9cbb87123217ac6d88c12ddb784fca9cc5b7.tar.xz |
2004-07-09 Paul Jakma <paul@dishone.st>
Merge of GNU Zebra cvs2svn changesets r799, r800 and r807.
* bgp_dump.c: (bgp_dump_attr) cleanup. return status code. check
attributes present before printing.
* bgp_dump.c: update bgp_dump_attr prototype.
* bgp_packet.c: (bgp_update_receive) init attrstr. check status
of bgp_dump_attr. Log end-of-rib UPDATEs.
Diffstat (limited to 'bgpd/bgp_debug.c')
-rw-r--r-- | bgpd/bgp_debug.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 8141c8b9..9c5208da 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -158,16 +158,18 @@ char *bgp_origin_str[] = {"i","e","?"}; char *bgp_origin_long_str[] = {"IGP","EGP","incomplete"}; /* Dump attribute. */ -void +int bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) { - if (! attr) - return; + return 0; - snprintf (buf, size, "nexthop %s", inet_ntoa (attr->nexthop)); - snprintf (buf + strlen (buf), size - strlen (buf), ", origin %s", - bgp_origin_str[attr->origin]); + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP))) + snprintf (buf, size, "nexthop %s", inet_ntoa (attr->nexthop)); + + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ORIGIN))) + snprintf (buf + strlen (buf), size - strlen (buf), ", origin %s", + bgp_origin_str[attr->origin]); #ifdef HAVE_IPV6 { @@ -186,42 +188,47 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) } #endif /* HAVE_IPV6 */ - if (peer_sort (peer) == BGP_PEER_IBGP) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))) snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %d", attr->local_pref); - if (attr->med) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))) snprintf (buf + strlen (buf), size - strlen (buf), ", metric %d", attr->med); - if (attr->community) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES))) snprintf (buf + strlen (buf), size - strlen (buf), ", community %s", community_str (attr->community)); - if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE)) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE))) snprintf (buf + strlen (buf), size - strlen (buf), ", atomic-aggregate"); - if (attr->aggregator_as) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR))) snprintf (buf + strlen (buf), size - strlen (buf), ", aggregated by %d %s", attr->aggregator_as, inet_ntoa (attr->aggregator_addr)); - if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID)) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_ORIGINATOR_ID))) snprintf (buf + strlen (buf), size - strlen (buf), ", originator %s", inet_ntoa (attr->originator_id)); - if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_CLUSTER_LIST)) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_CLUSTER_LIST))) { int i; - snprintf (buf + strlen (buf), size - strlen (buf), ", clusterlist "); + snprintf (buf + strlen (buf), size - strlen (buf), ", clusterlist"); for (i = 0; i < attr->cluster->length / 4; i++) - snprintf (buf + strlen (buf), size - strlen (buf), "%s", + snprintf (buf + strlen (buf), size - strlen (buf), " %s", inet_ntoa (attr->cluster->list[i])); } - if (attr->aspath) + if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AS_PATH))) snprintf (buf + strlen (buf), size - strlen (buf), ", path %s", aspath_print (attr->aspath)); + + if (strlen (buf) > 1) + return 1; + else + return 0; } /* dump notify packet */ |