]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: Reestablish preferred counters
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Sat, 2 Feb 2019 12:28:16 +0000 (13:28 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Sat, 2 Feb 2019 12:28:16 +0000 (13:28 +0100)
nest/proto.c
nest/protocol.h
nest/rt-table.c

index fadce6c7c3e70d4fb59c05dd635a189403cc8837..ab92d90fe52ddb1470ccfc75011ca1869c79bb65 100644 (file)
@@ -1696,8 +1696,8 @@ channel_show_stats(struct channel *c)
     cli_msg(-1006, "    Routes:         %u imported, %u filtered, %u exported",
            s->imp_routes, s->filt_routes, s->exp_routes);
   else
-    cli_msg(-1006, "    Routes:         %u imported, %u exported",
-           s->imp_routes, s->exp_routes);
+    cli_msg(-1006, "    Routes:         %u imported, %u exported, %u preferred",
+           s->imp_routes, s->exp_routes, s->pref_routes);
 
   cli_msg(-1006, "    Route change stats:     received   rejected   filtered    ignored   accepted");
   cli_msg(-1006, "      Import updates:     %10u %10u %10u %10u %10u",
index 7f539aef60f2d9b88463a732eb823259244c3409..6c04071b55b739fb6d1d35a05d87d4dd4dd28a4b 100644 (file)
@@ -134,6 +134,7 @@ struct proto_stats {
   /* Import - from protocol to core */
   u32 imp_routes;              /* Number of routes successfully imported to the (adjacent) routing table */
   u32 filt_routes;             /* Number of routes rejected in import filter but kept in the routing table */
+  u32 pref_routes;             /* Number of routes selected as best in the (adjacent) routing table */
   u32 imp_updates_received;    /* Number of route updates received */
   u32 imp_updates_invalid;     /* Number of route updates rejected as invalid */
   u32 imp_updates_filtered;    /* Number of route updates rejected by filters */
index 9952d91ad38a01774f70705a2d593df23728ca63..0224d4349c1e51ae7e2613c68f4e7ad7ecc7c23a 100644 (file)
@@ -901,8 +901,16 @@ rte_announce(rtable *tab, unsigned type, net *net, rte *new, rte *old,
   if (!old && !new)
     return;
 
-  if ((type == RA_OPTIMAL) && tab->hostcache)
-    rt_notify_hostcache(tab, net);
+  if (type == RA_OPTIMAL)
+  {
+    if (new)
+      new->sender->stats.pref_routes++;
+    if (old)
+      old->sender->stats.pref_routes--;
+
+    if (tab->hostcache)
+      rt_notify_hostcache(tab, net);
+  }
 
   struct channel *c; node *n;
   WALK_LIST2(c, n, tab->channels, table_node)