summaryrefslogtreecommitdiff
path: root/nest/proto.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-06-04 01:22:56 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-06-04 01:22:56 +0200
commit925fe2d3de0e12c644f91f94d13bf388aeda9b57 (patch)
treed9813e6386919303336553495f2010b42bd604e5 /nest/proto.c
parentc07c65d6d079eaf4525f03f5d126d51caa2595d6 (diff)
Implements route statistics and fixes some minor bugs.
Diffstat (limited to 'nest/proto.c')
-rw-r--r--nest/proto.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/nest/proto.c b/nest/proto.c
index 0ad7229c..ef0587b2 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -512,6 +512,9 @@ static void
proto_fell_down(struct proto *p)
{
DBG("Protocol %s down\n", p->name);
+ ASSERT(p->stats.imp_routes == 0);
+
+ bzero(&p->stats, sizeof(struct proto_stats));
rt_unlock_table(p->table);
proto_rethink_goal(p);
}
@@ -693,9 +696,30 @@ proto_do_show(struct proto *p, int verbose)
buf);
if (verbose)
{
- cli_msg(-1006, "\tPreference: %d", p->preference);
- cli_msg(-1006, "\tInput filter: %s", filter_name(p->in_filter));
- cli_msg(-1006, "\tOutput filter: %s", filter_name(p->out_filter));
+ cli_msg(-1006, " Preference: %d", p->preference);
+ cli_msg(-1006, " Input filter: %s", filter_name(p->in_filter));
+ cli_msg(-1006, " Output filter: %s", filter_name(p->out_filter));
+
+ if (p->proto_state != PS_DOWN)
+ {
+ cli_msg(-1006, " Routes: %u imported, %u exported, %u preferred",
+ p->stats.imp_routes, p->stats.exp_routes, p->stats.pref_routes);
+ cli_msg(-1006, " Route change stats: received rejected filtered ignored accepted");
+ cli_msg(-1006, " Import updates: %10u %10u %10u %10u %10u",
+ p->stats.imp_updates_received, p->stats.imp_updates_invalid,
+ p->stats.imp_updates_filtered, p->stats.imp_updates_ignored,
+ p->stats.imp_updates_accepted);
+ cli_msg(-1006, " Import withdraws: %10u %10u --- %10u %10u",
+ p->stats.imp_withdraws_received, p->stats.imp_withdraws_invalid,
+ p->stats.imp_withdraws_ignored, p->stats.imp_withdraws_accepted);
+ cli_msg(-1006, " Export updates: %10u %10u %10u --- %10u",
+ p->stats.exp_updates_received, p->stats.exp_updates_rejected,
+ p->stats.exp_updates_filtered, p->stats.exp_updates_accepted);
+ cli_msg(-1006, " Export withdraws: %10u --- --- --- %10u",
+ p->stats.exp_withdraws_received, p->stats.exp_withdraws_accepted);
+ }
+
+ cli_msg(-1006, "");
}
}