]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Use correct comparison on max generation
authorVojtech Vilimek <vojtech.vilimek@nic.cz>
Thu, 21 Jul 2022 15:06:09 +0000 (17:06 +0200)
committerVojtech Vilimek <vojtech.vilimek@nic.cz>
Thu, 21 Jul 2022 15:06:09 +0000 (17:06 +0200)
proto/stats/stats.c

index 1670e7844e09b867d376db7edf4c83d1ee9542a5..68f58724d861e075f77f6003a248d07542acd91d 100644 (file)
@@ -39,7 +39,7 @@ stats_rt_notify(struct proto *P UNUSED, struct channel *src_ch, const net_addr *
   if (old)
   {
     ch->counters[old->generation]--;
-    if (old->generation < ch->max_generation)
+    if (old->generation <= ch->max_generation)
     {
       changed = 1;
       ch->counters[COUNTER]--;
@@ -49,7 +49,7 @@ stats_rt_notify(struct proto *P UNUSED, struct channel *src_ch, const net_addr *
   if (new)
   {
     ch->counters[new->generation]++;
-    if (new->generation < ch->max_generation)
+    if (new->generation <= ch->max_generation)
     {
       changed = 1;
       ch->counters[COUNTER]++;
@@ -136,7 +136,7 @@ stats_reconfigure(struct proto *P, struct proto_config *CF)
 
       /* recalculate sum */
       sc->counters[COUNTER] = 0;
-      for (u8 i = 0; i < sc->max_generation; i++)
+      for (u8 i = 0; i <= sc->max_generation; i++)
        sc->counters[COUNTER] += sc->counters[i];
 
       sc->sum = sc->counters[COUNTER];