]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fix bug in stats_rt_notify()
authorVojtech Vilimek <vojtech.vilimek@nic.cz>
Fri, 15 Jul 2022 11:59:14 +0000 (13:59 +0200)
committerVojtech Vilimek <vojtech.vilimek@nic.cz>
Fri, 15 Jul 2022 11:59:14 +0000 (13:59 +0200)
proto/stats/stats.c

index a648f49d1878076ee3483bd1cead5c1ba1fc5488..ab0b664af36259008afaa18145802d1cebdbe00b 100644 (file)
@@ -36,23 +36,16 @@ stats_rt_notify(struct proto *P, struct channel *src_ch, const net_addr *n, rte
   struct stats_config *cf = (void *) P->cf;
   log(L_INFO "stats_rf_notify()");
 
-  if (new && old)
+  if (old)
   {
-    new->generation = old->generation + 1;
     p->counters[old->generation]--;
-    p->counters[new->generation]++;
-    log(L_INFO "counter %u increased", new->generation);
-  }
-  else if (new && !old)
-  {
-    new->generation = 0;
-    p->counters[0]++;
-    log(L_INFO "counter 0 increased");
+    log(L_INFO "counter %u decreased", old->generation);
   }
-  else if (!new && old)
+
+  if (new)
   {
-    (p->counters[old->generation])--;
-    log(L_INFO "counter %u decreased", old->generation);
+    p->counters[new->generation]++;
+    log(L_INFO "counter %u increased", new->generation);
   }
 }