From 74a82ef4280e44f4e49a4bb03951b60d0da0da29 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 29 Jun 2023 14:33:35 +0000 Subject: [PATCH] rpki-client: fix vap_pas stats A small mistake in a diff broke the counters. Make them AFI agnostic and adjust ometric output. guidance & ok claudio --- usr.sbin/rpki-client/aspa.c | 4 ++-- usr.sbin/rpki-client/extern.h | 8 ++------ usr.sbin/rpki-client/main.c | 4 +--- usr.sbin/rpki-client/output-ometric.c | 8 ++------ usr.sbin/rpki-client/repo.c | 10 ++-------- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/usr.sbin/rpki-client/aspa.c b/usr.sbin/rpki-client/aspa.c index 35c8ffa5154..ead8cc9c577 100644 --- a/usr.sbin/rpki-client/aspa.c +++ b/usr.sbin/rpki-client/aspa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aspa.c,v 1.20 2023/06/28 17:24:20 tb Exp $ */ +/* $OpenBSD: aspa.c,v 1.21 2023/06/29 14:33:35 tb Exp $ */ /* * Copyright (c) 2022 Job Snijders * Copyright (c) 2022 Theo Buehler @@ -369,7 +369,7 @@ aspa_insert_vaps(struct vap_tree *tree, struct aspa *aspa, struct repo *rp) aspa->providers[i] < v->providers[j]) { /* merge provider from aspa into v */ repo_stat_inc(rp, v->talid, RTYPE_ASPA, - STYPE_BOTH + aspa->providers[i]); + STYPE_PROVIDERS); insert_vap(v, j, &aspa->providers[i]); i++; } else if (aspa->providers[i] == v->providers[j]) diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index d32c1313e89..e41baff2f1d 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.187 2023/06/29 10:28:25 tb Exp $ */ +/* $OpenBSD: extern.h,v 1.188 2023/06/29 14:33:35 tb Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -530,9 +530,7 @@ enum stype { STYPE_TOTAL, STYPE_UNIQUE, STYPE_DEC_UNIQUE, - STYPE_BOTH, - STYPE_ONLY_IPV4, - STYPE_ONLY_IPV6, + STYPE_PROVIDERS, }; struct repo; @@ -562,8 +560,6 @@ struct repotalstats { uint32_t vaps; /* total number of Validated ASPA Payloads */ uint32_t vaps_uniqs; /* total number of unique VAPs */ uint32_t vaps_pas; /* total number of providers */ - uint32_t vaps_pas4; /* total number of IPv4 only providers */ - uint32_t vaps_pas6; /* total number of IPv6 only providers */ uint32_t vrps; /* total number of Validated ROA Payloads */ uint32_t vrps_uniqs; /* number of unique vrps */ }; diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index 771b8cfc7c6..e708666310b 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.243 2023/06/23 11:36:24 claudio Exp $ */ +/* $OpenBSD: main.c,v 1.244 2023/06/29 14:33:35 tb Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -750,8 +750,6 @@ sum_stats(const struct repo *rp, const struct repotalstats *in, void *arg) out->vaps += in->vaps; out->vaps_uniqs += in->vaps_uniqs; out->vaps_pas += in->vaps_pas; - out->vaps_pas4 += in->vaps_pas4; - out->vaps_pas6 += in->vaps_pas6; } static void diff --git a/usr.sbin/rpki-client/output-ometric.c b/usr.sbin/rpki-client/output-ometric.c index 53ab900d768..350cf0294ac 100644 --- a/usr.sbin/rpki-client/output-ometric.c +++ b/usr.sbin/rpki-client/output-ometric.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output-ometric.c,v 1.4 2023/06/05 14:19:13 claudio Exp $ */ +/* $OpenBSD: output-ometric.c,v 1.5 2023/06/29 14:33:35 tb Exp $ */ /* * Copyright (c) 2022 Claudio Jeker * @@ -83,11 +83,7 @@ set_common_stats(const struct repotalstats *in, struct ometric *metric, ometric_set_int_with_labels(metric, in->vaps_uniqs, OKV("type", "state"), OKV("vap", "unique"), ol); ometric_set_int_with_labels(metric, in->vaps_pas, - OKV("type", "state"), OKV("vap providers", "both"), ol); - ometric_set_int_with_labels(metric, in->vaps_pas4, - OKV("type", "state"), OKV("vap providers", "IPv4 only"), ol); - ometric_set_int_with_labels(metric, in->vaps_pas6, - OKV("type", "state"), OKV("vap providers", "IPv6 only"), ol); + OKV("type", "state"), OKV("vap providers", "total"), ol); } static void diff --git a/usr.sbin/rpki-client/repo.c b/usr.sbin/rpki-client/repo.c index e3d684fe132..1a1bb49a0ee 100644 --- a/usr.sbin/rpki-client/repo.c +++ b/usr.sbin/rpki-client/repo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: repo.c,v 1.49 2023/06/29 14:09:42 claudio Exp $ */ +/* $OpenBSD: repo.c,v 1.50 2023/06/29 14:33:35 tb Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -1473,15 +1473,9 @@ repo_stat_inc(struct repo *rp, int talid, enum rtype type, enum stype subtype) case STYPE_DEC_UNIQUE: rp->stats[talid].vaps_uniqs--; break; - case STYPE_BOTH: + case STYPE_PROVIDERS: rp->stats[talid].vaps_pas++; break; - case STYPE_ONLY_IPV4: - rp->stats[talid].vaps_pas4++; - break; - case STYPE_ONLY_IPV6: - rp->stats[talid].vaps_pas6++; - break; default: break; } -- 2.20.1