From: Vojtech Vilimek Date: Fri, 15 Jul 2022 11:59:14 +0000 (+0200) Subject: Fix bug in stats_rt_notify() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=248236db6d5feb21915ea10537bfec2b2d9899d4;p=thirdparty%2Fbird.git Fix bug in stats_rt_notify() --- diff --git a/proto/stats/stats.c b/proto/stats/stats.c index a648f49d1..ab0b664af 100644 --- a/proto/stats/stats.c +++ b/proto/stats/stats.c @@ -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); } }