From 2815e61ffbbf9c362896f3912d925cf78e125ee1 Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Thu, 14 Sep 2006 02:56:07 +0000 Subject: [bgpd] Add RIB reporting commands, show bgp ... statistics 2006-09-13 Paul Jakma * bgp_aspath.c: (aspath_highest) new, return highest ASN in an aspath. * bgp_route.c: (bgp_peer_count_walker) new, do the walk done in bgp_peer_counts as a thread. (bgp_peer_counts) move walk to previous and call it via thread_execute so this RIB walk shows up in thread stats. (bgp_table_stats) New, gather some statistics for a given RIB. (bgp_table_stats_walker) New, RIB walker thread for former. (bgp_table_stats_vty) Parsing front-end for 'show bgp ...', useful model for future rationalisation of 'show ... bgp'. (bgp_route_init) Add new RIB stats commands. --- bgpd/bgp_aspath.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'bgpd/bgp_aspath.c') diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 317e9f8d..327406fa 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -434,6 +434,26 @@ aspath_size (struct aspath *aspath) return size; } +/* Return highest public ASN in path */ +as_t +aspath_highest (struct aspath *aspath) +{ + struct assegment *seg = aspath->segments; + as_t highest = 0; + unsigned int i; + + while (seg) + { + for (i = 0; i < seg->length; i++) + if (seg->as[i] > highest + && (seg->as[i] < BGP_PRIVATE_AS_MIN + || seg->as[i] > BGP_PRIVATE_AS_MAX)) + highest = seg->as[i]; + seg = seg->next; + } + return highest; +} + /* Convert aspath structure to string expression. */ static char * aspath_make_str_count (struct aspath *as) -- cgit v1.2.3