From f28713a0dd14471c19755c7ddefa8370ec3b2049 Mon Sep 17 00:00:00 2001 From: Vojtech Vilimek Date: Thu, 21 Jul 2022 17:06:09 +0200 Subject: [PATCH] Use correct comparison on max generation --- proto/stats/stats.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/stats/stats.c b/proto/stats/stats.c index 1670e784..68f58724 100644 --- a/proto/stats/stats.c +++ b/proto/stats/stats.c @@ -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];